Skip to content

Commit e8fe2a6

Browse files
wowi42Fizzadar
authored andcommitted
docs: fix documentation generation formatting issues
- Fix indentation handling in format_doc_line by removing manual strip - Add blank line after arguments title in generated docs - Fix JSON formatting in crontab fact docstring examples
1 parent d2c899c commit e8fe2a6

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

docs/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ def format_doc_line(line):
99
# Bold the <arg>: part of each line
1010
line = re.sub(r"\+ ([0-9a-z_\/\*]+)(.*)", r"+ **\1**\2", line)
1111

12-
# Strip the first 4 characters (first indent from docstring)
13-
return line[4:]
12+
# Python's __doc__ attribute already dedents docstrings, so we don't need to strip anything
13+
return line

scripts/generate_arguments_doc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def build_arguments_doc():
4040

4141
if arguments_title_doc:
4242
lines.append(cleandoc(arguments_title_doc))
43+
lines.append("")
4344

4445
lines.append(
4546
""".. list-table::

src/pyinfra/facts/crontab.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ class Crontab(FactBase[CrontabFile]):
125125
# or CrontabFile.to_json()
126126
[
127127
{
128-
command: "/path/to/command",
129-
minute: "*",
130-
hour: "*",
131-
month: "*",
132-
day_of_month: "*",
133-
day_of_week: "*",
128+
"command": "/path/to/command",
129+
"minute": "*",
130+
"hour": "*",
131+
"month": "*",
132+
"day_of_month": "*",
133+
"day_of_week": "*",
134134
},
135135
{
136-
"command": "echo another command
136+
"command": "echo another command",
137137
"special_time": "@daily",
138138
}
139139
]

0 commit comments

Comments
 (0)