Skip to content

Commit 1148e2b

Browse files
authored
🔧 Allow pre/post template global_options (#1428)
1 parent e4c16c8 commit 1148e2b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

‎sphinx_needs/data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,13 @@ class CoreFieldParameters(TypedDict):
280280
"description": "Pre-template of the need.",
281281
"schema": {"type": ["string", "null"], "default": None},
282282
"exclude_external": True,
283+
"allow_default": "str",
283284
},
284285
"post_template": {
285286
"description": "Post-template of the need.",
286287
"schema": {"type": ["string", "null"], "default": None},
287288
"exclude_external": True,
289+
"allow_default": "str",
288290
},
289291
"content": {
290292
"description": "Content of the need.",

‎tests/test_global_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_doc_global_option_old(test_app, snapshot):
3131
"WARNING: needs_global_options 'link3' has a default value that is not of type 'str_list' [needs.config]",
3232
"WARNING: needs_global_options 'bad_value_type' has a default value that is not of type 'str' [needs.config]",
3333
"WARNING: needs_global_options 'too_many_params' has an unknown value format [needs.config]",
34-
"WARNING: needs_global_options 'unknown' must also exist in needs_extra_options, needs_extra_links, or ['constraints', 'layout', 'status', 'style', 'tags'] [needs.config]",
34+
"WARNING: needs_global_options 'unknown' must also exist in needs_extra_options, needs_extra_links, or ['constraints', 'layout', 'post_template', 'pre_template', 'status', 'style', 'tags'] [needs.config]",
3535
"WARNING: needs_global_options uses old, non-dict, format. please update to new format: {'layout': {'default': 'clean_l'}, 'option_1': {'default': 'test_global'}, 'option_2': {'default': \"[[copy('id')]]\"}, 'option_3': {'predicates': [('status == \"implemented\"', 'STATUS_IMPL')]}, 'option_4': {'predicates': [('status == \"closed\"', 'STATUS_CLOSED')], 'default': 'STATUS_UNKNOWN'}, 'option_5': {'predicates': [('status == \"implemented\"', 'STATUS_IMPL'), ('status == \"closed\"', 'STATUS_CLOSED')], 'default': 'final'}, 'link1': {'default': ['SPEC_1']}, 'link2': {'predicates': [('status == \"implemented\"', ['SPEC_2', \"[[copy('link1')]]\"]), ('status == \"closed\"', ['SPEC_3'])], 'default': ['SPEC_1']}, 'tags': {'predicates': [('status == \"implemented\"', ['a', 'b']), ('status == \"closed\"', ['c'])], 'default': ['d']}} [needs.deprecated]",
3636
]
3737

@@ -65,7 +65,7 @@ def test_doc_global_option(test_app, snapshot):
6565
"WARNING: needs_global_options 'link3' has a default value that is not of type 'str_list' [needs.config]",
6666
"WARNING: needs_global_options 'bad_value_type' has a default value that is not of type 'str' [needs.config]",
6767
"WARNING: needs_global_options 'too_many_params', 'predicates', must be a list of (filter string, value) pairs [needs.config]",
68-
"WARNING: needs_global_options 'unknown' must also exist in needs_extra_options, needs_extra_links, or ['constraints', 'layout', 'status', 'style', 'tags'] [needs.config]",
68+
"WARNING: needs_global_options 'unknown' must also exist in needs_extra_options, needs_extra_links, or ['constraints', 'layout', 'post_template', 'pre_template', 'status', 'style', 'tags'] [needs.config]",
6969
]
7070

7171
needs_config = NeedsSphinxConfig(test_app.config)

0 commit comments

Comments
 (0)