8000 sphinxdocs: close repo rule directives (#2892) · vonschultz/rules_python@60c1c8e · GitHub
[go: up one dir, main page]

Skip to content

Commit 60c1c8e

Browse files
authored
sphinxdocs: close repo rule directives (bazel-contrib#2892)
When converting the protos for repo rules to markdown, their blocks weren't being properly closed. To fix, just add the closing colons. Also added a test of the text generation.
1 parent d6af2b7 commit 60c1c8e

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

sphinxdocs/private/proto_to_markdown.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ def _render_repository_rule(self, repo_rule: stardoc_output_pb2.RepositoryRuleIn
216216
self._render_attributes(repo_rule.attribute)
217217
if repo_rule.environ:
218218
self._write(":envvars: ", ", ".join(sorted(repo_rule.environ)))
219-
self._write("\n")
219+
self._write("\n\n")
220+
221+
self._write("::::::\n")
220222

221223
def _render_rule(self, rule: stardoc_output_pb2.RuleInfo):
222224
rule_name = rule.rule_name

sphinxdocs/tests/proto_to_markdown/proto_to_markdown_test.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,41 @@ def test_render_module_extension(self):
272272
273273
274274
:::::
275+
::::::
276+
"""
277+
self.assertIn(expected, actual)
278+
279+
def test_render_repo_rule(self):
280+
proto_text = """
281+
file: "@repo//pkg:foo.bzl"
282+
repository_rule_info: {
283+
rule_name: "repository_rule",
284+
doc_string: "REPOSITORY_RULE_DOC_STRING"
285+
attribute: {
286+
name: "repository_rule_attribute_a",
287+
doc_string: "REPOSITORY_RULE_ATTRIBUTE_A_DOC_STRING"
288+
type: BOOLEAN
289+
default_value: "True"
290+
}
291+
environ: "ENV_VAR_A"
292+
}
293+
"""
294+
actual = self._render(proto_text)
295+
expected = """
296+
::::::{bzl:repo-rule} repository_rule(repository_rule_attribute_a=True)
297+
298+
REPOSITORY_RULE_DOC_STRING
299+
300+
:attr repository_rule_attribute_a:
301+
{bzl:default-value}`True`
302+
{type}`bool`
303+
REPOSITORY_RULE_ATTRIBUTE_A_DOC_STRING
304+
:::{bzl:attr-info} Info
305+
:::
306+
307+
308+
:envvars: ENV_VAR_A
309+
275310
::::::
276311
"""
277312
self.assertIn(expected, actual)

0 commit comments

Comments
 (0)
0