docs restructure (#140)

This commit is contained in:
LordGhostX
2023-11-23 12:01:32 +01:00
committed by GitHub
parent 3de936c928
commit 590b7d857a
50 changed files with 431 additions and 859 deletions
+4 -4
View File
@@ -12,7 +12,7 @@ def parse_table_heading(line: str) -> Tuple[str, bool]:
table_heading = re.split('##', line)[1].strip()
if 'config' not in table_heading or 'Application-level' in table_heading:
return None, False
table_heading = table_heading.title()
table_heading = table_heading.capitalize()
word_replace_re = re.compile('|'.join([
r'(Configuration)', r'(And)', r'(Lightpush)',
@@ -20,12 +20,12 @@ def parse_table_heading(line: str) -> Tuple[str, bool]:
r'(Discovery V5)', r'(Websocket)'
]))
word_replace_dict = {
'Configuration': 'Config', 'And': 'and', 'Lightpush': 'Light Push',
'Configuration': 'config', 'And': 'and', 'Lightpush': 'Light push',
'Json-Rpc': 'JSON-RPC', 'Rest Http': 'REST HTTP', 'Dns': 'DNS',
'Discovery V5': 'Discv5', 'Websocket': 'WebSocket'
}
table_heading = word_replace_re.sub(lambda match: word_replace_dict[match.group(0)], table_heading)
return '## ' + table_heading, True
return '## ' + table_heading, Trues
def fetch_config_file(config_path: str) -> str:
config_file = requests.get(config_path)
@@ -37,7 +37,7 @@ def fetch_config_file(config_path: str) -> str:
def extract_config(config_path: str) -> str:
config_data = fetch_config_file(config_path)
config_table = "## Application-Level Config\n\n| Name | Default Value | Description |\n| - | - | - |\n"
config_table = "## Application-level config\n\n| Name | Default Value | Description |\n| - | - | - |\n"
row = {"name": None, "default": "", "description": None}
for line in config_data:
line = line.strip()