1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00
Files
peeringdb-peeringdb/peeringdb_server/gendocs.py
Matt Griswold 8ef76dc5ab Support 202110 (#1085)
* Block registering private ASN ranges

* Add a continental region field for facilities #1007

* Incorrect order of search results #232

* Allow users to upload a small logo to their record #346

* Sponsor badge CSS and text translation issues #453

* IXP and Facility summary #18

* Add sales email and phone contact to ix object #949

* Increase timeout timer for IX-F JSON importer to 30s #962

* IX-F manually triggered import bugs #1054

* remove survey notifications

* IX-F importer: manual add followed by IX-F prompted add can result in "The server rejected your data" #807

* performance fix for net view

* api documentation generate broken #956

* fix poc set missing from net view

* Auto focus cursor on search field on main website #695

* PeeringDB website has a poor choice of line-breaks for IPv6 addresses. #748

* Delete childless org objects #838

* linting

* poetry lock

* re-add mistakingly dropped translation to email template

* fix template variables

* regen docs

* regen api docs

* fix merge cruft

* django-peeringdb to 2.11 and poetry relock

* linting

* comment out django-peeringdb volume mount

* add missing declaration

Co-authored-by: Stefan Pratter <stefan@20c.com>
Co-authored-by: David Poarch <dpoarch@20c.com>
2021-11-09 09:47:38 -06:00

61 lines
1.8 KiB
Python

import datetime
import os
import django
from pymdgen import doc_module
django.setup()
module_index = {}
command_index = {}
now = datetime.datetime.now()
for entry in os.scandir("peeringdb_server"):
if entry.name == "__init__.py":
continue
if entry.name[0] == ".":
continue
if entry.is_file and entry.name.find(".py") > -1:
outfile = f"docs/dev/modules/{entry.name}.md"
print(f"Generating {outfile}")
with open(outfile, "w") as fh:
doc_text = doc_module(f"peeringdb_server/{entry.name}", section_level=1)
fh.write(f"Generated from {entry.name} on {now}\n\n")
fh.write("\n".join(doc_text))
try:
module_index[entry.name] = doc_text[2]
except IndexError:
continue
for entry in os.scandir("peeringdb_server/management/commands"):
if entry.name == "__init__.py":
continue
if entry.name[0] == ".":
continue
if entry.is_file and entry.name.find(".py") > -1:
try:
doc_text = doc_module(
f"peeringdb_server/management/commands/{entry.name}", section_level=1
)
command_index[entry.name] = doc_text[2]
except Exception:
continue
with open("docs/dev/modules.md", "w") as fh:
mod_names = sorted(module_index.keys())
fh.write(f"Generated on {now}\n\n")
for mod in mod_names:
descr = module_index.get(mod)
fh.write(f"## [{mod}](/docs/dev/modules/{mod}.md)\n\n")
fh.write(f"{descr}\n\n")
with open("docs/dev/commands.md", "w") as fh:
mod_names = sorted(command_index.keys())
fh.write(f"Generated on {now}\n\n")
for mod in mod_names:
descr = command_index.get(mod)
fh.write(f"## {mod}\n\n")
fh.write(f"{descr}\n\n")