-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepare docs for generating the help config from them. #107
Labels
enhancement
New feature or request
Comments
progval
added a commit
to progval/inspircd-docs
that referenced
this issue
Nov 18, 2021
This should help with inspircdGH-107. This does not change the HTML output, except for the removed HTML comment (`<!-- This file contains a page fragment. Any changes will affect all pages that include it. -->`) For the record, I used this script: ``` import glob import pprint import re import textwrap for filename in sorted(glob.glob("docs/3/commands/_*.md")): cmd_name = re.match("docs/3/commands/_cmd_(.*).md", filename).group(1) print(cmd_name) with open(filename) as fd: content = fd.read() m = re.match(r".*\n### `(?P<syntax>[^`]+)`\n+(?P<description>[^#]*)\n+(#### Example Usage\n+(?P<example>.*))?$", content, re.DOTALL | re.MULTILINE) pprint.pprint(m.groupdict()) with open(f"docs/3/commands/_{cmd_name}.yml", "wt") as fd: fd.write(textwrap.dedent( f""" name: {cmd_name} syntax: >- {m.group("syntax")} description: |- """ ).lstrip()) fd.write(textwrap.indent(m.group("description"), " ")) if m.group("example"): fd.write("example: |-\n" + textwrap.indent(m.group("example"), " ")) ``` pls a manual edit to `_stats.yml` because the regexp could not handle the extra subtitle
progval
added a commit
to progval/inspircd-docs
that referenced
this issue
Nov 18, 2021
This should help with inspircdGH-107. This does not change the HTML output, except for the removed HTML comment (`<!-- This file contains a page fragment. Any changes will affect all pages that include it. -->`) For the record, I used this script: ``` import glob import pprint import re import textwrap for filename in sorted(glob.glob("docs/3/commands/_*.md")): cmd_name = re.match("docs/3/commands/_cmd_(.*).md", filename).group(1) print(cmd_name) with open(filename) as fd: content = fd.read() m = re.match(r".*\n### `(?P<syntax>[^`]+)`\n+(?P<description>[^#]*)\n+(#### Example Usage\n+(?P<example>.*))?$", content, re.DOTALL | re.MULTILINE) pprint.pprint(m.groupdict()) with open(f"docs/3/commands/_{cmd_name}.yml", "wt") as fd: fd.write(textwrap.dedent( f""" name: {cmd_name} syntax: >- {m.group("syntax")} description: |- """ ).lstrip()) fd.write(textwrap.indent(m.group("description"), " ")) if m.group("example"): fd.write("example: |-\n" + textwrap.indent(m.group("example"), " ")) ``` plus a manual edit to `_stats.yml` because the regexp could not handle the extra subtitle
progval
added a commit
to progval/inspircd-docs
that referenced
this issue
Nov 18, 2021
This should help with inspircdGH-107. This does not change the HTML output, except for the removed HTML comment (`<!-- This file contains a page fragment. Any changes will affect all pages that include it. -->`) For the record, I used this script: ``` import glob import pprint import re import textwrap for filename in sorted(glob.glob("docs/3/commands/_*.md")): cmd_name = re.match("docs/3/commands/_cmd_(.*).md", filename).group(1) print(cmd_name) with open(filename) as fd: content = fd.read() m = re.match(r".*\n### `(?P<syntax>[^`]+)`\n+(?P<description>[^#]*)\n+(#### Example Usage\n+(?P<example>.*))?$", content, re.DOTALL | re.MULTILINE) pprint.pprint(m.groupdict()) with open(f"docs/3/commands/_{cmd_name}.yml", "wt") as fd: fd.write(textwrap.dedent( f""" name: {cmd_name} syntax: >- {m.group("syntax")} description: |- """ ).lstrip()) fd.write(textwrap.indent(m.group("description"), " ")) if m.group("example"): fd.write("example: |-\n" + textwrap.indent(m.group("example"), " ")) ``` plus a manual edit to `_stats.yml` because the regexp could not handle the extra subtitle
progval
added a commit
to progval/inspircd-docs
that referenced
this issue
Nov 18, 2021
This should help with inspircdGH-107. This does not change the HTML output, except for the removed HTML comment (`<!-- This file contains a page fragment. Any changes will affect all pages that include it. -->`) For the record, I used this script: ``` import glob import pprint import re import textwrap for filename in sorted(glob.glob("docs/3/commands/_*.md")): cmd_name = re.match("docs/3/commands/_cmd_(.*).md", filename).group(1) print(cmd_name) with open(filename) as fd: content = fd.read() m = re.match(r".*\n### `(?P<syntax>[^`]+)`\n+(?P<description>[^#]*)\n+(#### Example Usage\n+(?P<example>.*))?$", content, re.DOTALL | re.MULTILINE) pprint.pprint(m.groupdict()) with open(f"docs/3/commands/_{cmd_name}.yml", "wt") as fd: fd.write(textwrap.dedent( f""" name: {cmd_name} syntax: >- {m.group("syntax")} description: |- """ ).lstrip()) fd.write(textwrap.indent(m.group("description"), " ")) if m.group("example"): fd.write("example: |-\n" + textwrap.indent(m.group("example"), " ")) ``` plus a manual edit to `_stats.yml` because the regexp could not handle the extra subtitle
progval
added a commit
to progval/inspircd-docs
that referenced
this issue
Nov 18, 2021
This should help with inspircdGH-107. This does not change the HTML output, except for the removed HTML comment (`<!-- This file contains a page fragment. Any changes will affect all pages that include it. -->`) For the record, I used this script: ``` import glob import pprint import re import textwrap for filename in sorted(glob.glob("docs/3/commands/_*.md")): cmd_name = re.match("docs/3/commands/_cmd_(.*).md", filename).group(1) print(cmd_name) with open(filename) as fd: content = fd.read() m = re.match(r".*\n### `(?P<syntax>[^`]+)`\n+(?P<description>[^#]*)\n+(#### Example Usage\n+(?P<example>.*))?$", content, re.DOTALL | re.MULTILINE) pprint.pprint(m.groupdict()) with open(f"docs/3/commands/_{cmd_name}.yml", "wt") as fd: fd.write(textwrap.dedent( f""" name: {cmd_name} syntax: >- {m.group("syntax")} description: |- """ ).lstrip()) fd.write(textwrap.indent(m.group("description"), " ")) if m.group("example"): fd.write("example: |-\n" + textwrap.indent(m.group("example"), " ")) ``` plus a manual edit to `_stats.yml` because the regexp could not handle the extra subtitle, and added newlines at the end of files missing one.
progval
added a commit
to progval/inspircd-docs
that referenced
this issue
Nov 18, 2021
This allows to programmatically know which example demonstrates each command, which will be used to generate HELPOP files (inspircdGH-107)
SadieCat
pushed a commit
that referenced
this issue
Nov 20, 2021
This allows to programmatically know which example demonstrates each command, which will be used to generate HELPOP files (GH-107)
Done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some changes we need to make before this change:
oper_only
bool field to the commands section of the YAML.example_commands
into the commands section under each module.The text was updated successfully, but these errors were encountered: