Skip to content

Commit e967469

Browse files
committed
Add more directives
* tabs-cloud-providers * website * cloudmgr * stitch * charts * compass * meta * topic * driver
1 parent 1b81e2b commit e967469

File tree

3 files changed

+75
-12
lines changed

3 files changed

+75
-12
lines changed

snooty/gizaparser/nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def inherit(project_config: ProjectConfig,
109109
changes[field_name] = new_value
110110
value = new_value
111111

112-
if value is not None:
112+
if value is not None and obj.ref and not obj.ref.startswith('_'):
113113
changes[field_name] = substitute(value, replacement, diagnostics)
114114

115115
return dataclasses.replace(obj, **changes) if changes else obj

snooty/gizaparser/test_nodes.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from dataclasses import dataclass
22
from pathlib import Path
3-
from typing import List
3+
from typing import List, Optional
44
from . import nodes
55
from ..types import Diagnostic, ProjectConfig
66

@@ -70,14 +70,29 @@ def test_substitution() -> None:
7070

7171

7272
def test_inheritance() -> None:
73+
@dataclass
74+
class TestNode(nodes.Inheritable):
75+
content: Optional[str]
76+
7377
project_config, diagnostics = ProjectConfig.open(Path('test_data'))
74-
parent = nodes.Inheritable('parent', {'foo': 'bar', 'old': ''}, source=None, inherit=None)
75-
child = nodes.Inheritable(
76-
'child',
77-
{'bar': 'baz', 'old': 'new'},
78+
parent = TestNode(
79+
ref='_parent',
80+
replacement={'foo': 'bar', 'old': ''},
81+
source=None,
82+
inherit=None,
83+
content='{{bar}}')
84+
child = TestNode(
85+
ref='child',
86+
replacement={'bar': 'baz', 'old': 'new'},
7887
source=nodes.Inherit('self.yaml', 'parent'),
79-
inherit=None)
88+
inherit=None,
89+
content=None)
90+
parent = nodes.inherit(project_config, parent, None, diagnostics)
8091
child = nodes.inherit(project_config, child, parent, diagnostics)
8192

82-
assert child.replacement == {'foo': 'bar', 'bar': 'baz', 'old': 'new'}
93+
assert child.replacement == {
94+
'foo': 'bar',
95+
'bar': 'baz',
96+
'old': 'new'}
97+
assert child.content == 'baz'
8398
assert not diagnostics

snooty/rstspec.toml

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ output_format = ["html"]
1212
argument_type = "string"
1313
deprecated = true
1414

15+
[directive.div]
16+
deprecated = true
17+
argument_type = "string"
18+
content_type = "block"
19+
20+
[directive.container]
21+
deprecated = true
22+
argument_type = "string"
23+
content_type = "block"
24+
1525
[directive.list-table]
1626
help = """Define a table using nested lists."""
1727
example = """.. list-table::
@@ -150,6 +160,9 @@ inherit = "tabs"
150160
[directive.tabs-auth]
151161
inherit = "tabs"
152162

163+
[directive.tabs-cloud-providers]
164+
inherit = "tabs"
165+
153166
[directive.tab]
154167
argument_type = "string"
155168
content_type = "block"
@@ -271,6 +284,16 @@ inherit = "_guides-base"
271284
help = """Related pages. Typically a list."""
272285
inherit = "_guides-base"
273286

287+
[directive.meta]
288+
help = """Add metadata to the site for SEO."""
289+
options.keywords = "string"
290+
options.description = "string"
291+
292+
[directive.topic]
293+
help = """A block with a self-contained chunk of information."""
294+
argument_type = "string"
295+
content_type = "block"
296+
274297
###### Roles
275298
[role.guilabel]
276299
help = """Used to specify a label or button in a GUI."""
@@ -331,10 +354,6 @@ type = "explicit_title"
331354
help = """Link to a page in the current project."""
332355
type = "explicit_title"
333356

334-
[role.manual]
335-
help = """Link to a page in the latest stable version of the MongoDB manual."""
336-
type = {link = "https://docs.mongodb.com/manual%s"}
337-
338357
[role.ref]
339358
help = """Link to a named target."""
340359
type = "explicit_title"
@@ -415,6 +434,34 @@ type = {link = "https://docs.mongodb.com/v3.6%s"}
415434
[role."v4.0"]
416435
type = {link = "https://docs.mongodb.com/v4.0%s"}
417436

437+
[role.website]
438+
help = """Link to a page in the MongoDB website."""
439+
type = {link = "https://www.mongodb.com%s?jmp=docs"}
440+
441+
[role.manual]
442+
help = """Link to a page in the latest stable version of the MongoDB manual."""
443+
type = {link = "https://docs.mongodb.com/manual%s"}
444+
445+
[role.cloudmgr]
446+
help = """Link to a page in the Cloud Manager docs."""
447+
type = {link = "https://docs.cloudmanager.mongodb.com%s"}
448+
449+
[role.stitch]
450+
help = """Link to a page in the Stitch docs."""
451+
type = {link = "https://docs.mongodb.com/stitch%s"}
452+
453+
[role.charts]
454+
help = """Link to a page in the Charts docs."""
455+
type = {link = "https://docs.mongodb.com/charts/saas%s"}
456+
457+
[role.compass]
458+
help = """Link to a page in the Compass docs."""
459+
type = {link = "https://docs.mongodb.com/compass%s"}
460+
461+
[role.driver]
462+
help = """Link to a driver's page in the Ecosystem docs."""
463+
type = {link = "https://docs.mongodb.com/ecosystem/drivers%s"}
464+
418465
[role.bic]
419466
type = {link = "https://docs.mongodb.com/bi-connector/current%s"}
420467

@@ -463,6 +510,7 @@ inherit = "alert"
463510
[rstobject.msetting]
464511
[rstobject.operator]
465512
[rstobject.option]
513+
[rstobject."mongomirror:option"]
466514
[rstobject.parameter]
467515
[rstobject.phpclass]
468516
[rstobject.phpmethod]

0 commit comments

Comments
 (0)