Skip to content

Commit ca2f220

Browse files
committed
Add support for additional rst constructs
1 parent 93c0a86 commit ca2f220

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

snooty/rstspec.toml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ version = 0
44
[enum]
55
user_level = ["beginner", "intermediate", "advanced"]
66
dedent_mode = ["auto"]
7+
alignment = ["left", "center", "right"]
8+
card_type = ["small", "large"]
79

810
[directive.default-domain]
911
argument_type = "string"
@@ -75,17 +77,33 @@ options.alt = "string"
7577
options.figwidth = "length"
7678
options.scale = "string"
7779
options.width = "length"
80+
options.align = "alignment"
81+
82+
[directive.example]
83+
help = """A section providing an example related to the surrounding text."""
84+
content_type = "block"
7885

7986
[directive.raw]
8087
help = """Include raw unparsed content when rendering into a given output format."""
8188
deprecated = true
8289
argument_type = "string"
8390
content_type = "string"
8491

92+
[directive.only]
93+
help = """Only parse a chunk of content if the condition in the argument is true."""
94+
argument_type = "string"
95+
content_type = "block"
96+
8597
[directive.class]
8698
help = """Set a class on the next element."""
8799
deprecated = true
88100
argument_type = "string"
101+
content_type = "block"
102+
103+
[directive.toctree]
104+
help = """List pages to treat as children of this page."""
105+
content_type = "block"
106+
options.titlesonly = "flag"
89107

90108
[directive.tabs]
91109
content_type = "block"
@@ -94,13 +112,15 @@ options.hidden = "boolean"
94112
options.tabset = "string"
95113

96114
[directive.tabs-cloud]
97-
98115
inherit = "tabs"
99-
[directive.tabs-platforms]
100116

117+
[directive.tabs-platforms]
101118
inherit = "tabs"
119+
102120
[directive.tabs-drivers]
121+
inherit = "tabs"
103122

123+
[directive.tabs-auth]
104124
inherit = "tabs"
105125

106126
[directive.tab]
@@ -118,6 +138,10 @@ argument_type = "string"
118138

119139
[directive.uriwriter]
120140

141+
[directive.card-group]
142+
options.type = "card_type"
143+
content_type = "block"
144+
121145
###### Guides
122146
[directive.card]
123147
help = """A single-page card."""
@@ -214,6 +238,12 @@ inherit = "_guides-base"
214238
[role.guilabel]
215239
help = """Used to specify a label or button in a GUI."""
216240

241+
[role.abbr]
242+
help = """Abbreviation with hover text."""
243+
244+
[role.xml]
245+
help = """Use XML to create reStructuredText nodes."""
246+
217247
[role.doc]
218248
help = """Link to a page in the current project."""
219249

@@ -284,3 +314,7 @@ type = "link http://mongodb.github.io/mongo-java-driver/3.7/javadoc/%s"
284314
[rstobject.update]
285315
[rstobject.query]
286316
[rstobject.setting]
317+
[rstobject.bsontype]
318+
[rstobject.pipeline]
319+
[rstobject.data]
320+
[rstobject.authaction]

snooty/specparser.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class _Inheritable(Protocol):
2727
'uri',
2828
'string',
2929
'length',
30-
'boolean'
30+
'boolean',
31+
'flag'
3132
))
3233

3334
#: docutils option validation function for each of the above primitive types
@@ -39,7 +40,8 @@ class _Inheritable(Protocol):
3940
PrimitiveType.string: str,
4041
PrimitiveType.length: docutils.parsers.rst.directives.length_or_percentage_or_unitless,
4142
PrimitiveType.boolean: lambda argument: docutils.parsers.rst.directives.choice(
42-
argument, ('true', 'false', None))
43+
argument, ('true', 'false', None)),
44+
PrimitiveType.flag: lambda argument: docutils.parsers.rst.directives.flag
4345
}
4446

4547
#: Option types can be a primitive type (PrimitiveType), an enum

0 commit comments

Comments
 (0)