summaryrefslogtreecommitdiff
path: root/sphinx/directives/patches.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-05-30 10:44:48 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-06-01 13:42:57 +0900
commite001d358d0dd83f260ec696e2c14a65bd63cde13 (patch)
treeac28ed763003f0e61f8476dc2b9fef3389d67a6c /sphinx/directives/patches.py
parente9c5e3656fc74c66eb31f897c9f485a10912a2c9 (diff)
downloadsphinx-git-e001d358d0dd83f260ec696e2c14a65bd63cde13.tar.gz
Add :force: option to code directives
Diffstat (limited to 'sphinx/directives/patches.py')
-rw-r--r--sphinx/directives/patches.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py
index c102f3461..189e1f7e3 100644
--- a/sphinx/directives/patches.py
+++ b/sphinx/directives/patches.py
@@ -119,6 +119,7 @@ class Code(SphinxDirective):
optional_arguments = 1
option_spec = {
'class': directives.class_option,
+ 'force': directives.flag,
'name': directives.unchanged,
'number-lines': optional_int,
}
@@ -131,6 +132,7 @@ class Code(SphinxDirective):
code = '\n'.join(self.content)
node = nodes.literal_block(code, code,
classes=self.options.get('classes', []),
+ force='force' in self.options,
highlight_args={})
self.add_name(node)
set_source_info(self, node)
@@ -138,14 +140,12 @@ class Code(SphinxDirective):
if self.arguments:
# highlight language specified
node['language'] = self.arguments[0]
- node['force_highlighting'] = True
else:
# no highlight language specified. Then this directive refers the current
# highlight setting via ``highlight`` directive or ``highlight_language``
# configuration.
node['language'] = self.env.temp_data.get('highlight_language',
self.config.highlight_language)
- node['force_highlighting'] = False
if 'number-lines' in self.options:
node['linenos'] = True