FIX: warning when lexing CSV, XML & JSON

+ improve the php hack
This commit is contained in:
Victor Feyens 2021-03-25 12:45:07 +01:00
parent 511c8577bc
commit dbf9c91281
2 changed files with 11 additions and 4 deletions

14
conf.py
View File

@ -2,8 +2,8 @@ import os
import sys import sys
from pathlib import Path from pathlib import Path
from pygments.lexers.web import PhpLexer from pygments.lexers import JsonLexer, XmlLexer
from sphinx.highlighting import lexers
from sphinx.util import logging from sphinx.util import logging
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@ -181,8 +181,10 @@ html_permalinks = True # Sphinx >= 3.5
html_js_files = [] html_js_files = []
html_css_files = [] html_css_files = []
# Monkeypatch PHP lexer to not require <?php # PHP lexer option to not require <?php
lexers['php'] = PhpLexer(startinline=True) highlight_options = {
'php': {'startinline': True},
}
#=== Options for LaTeX output ===# #=== Options for LaTeX output ===#
@ -242,6 +244,10 @@ def setup(app):
app.add_config_value('canonical_version', None, 'env') app.add_config_value('canonical_version', None, 'env')
app.add_config_value('versions', None, 'env') app.add_config_value('versions', None, 'env')
app.add_config_value('languages', None, 'env') app.add_config_value('languages', None, 'env')
app.add_lexer('json', JsonLexer())
app.add_lexer('xml', XmlLexer())
app.connect('html-page-context', _generate_alternate_urls) app.connect('html-page-context', _generate_alternate_urls)
app.connect('doctree-resolved', tag_toctrees) # TODO ANVFE review + typo app.connect('doctree-resolved', tag_toctrees) # TODO ANVFE review + typo

View File

@ -1,5 +1,6 @@
docutils~=0.14 docutils~=0.14
pygments~=2.6.1 pygments~=2.6.1
pygments-csv-lexer~=0.1.3
pysass~=0.1.0 pysass~=0.1.0
sphinx~=3.0 sphinx~=3.0
werkzeug==0.14.1 # TODO ANVFE bump werkzeug to 0.16 ? werkzeug==0.14.1 # TODO ANVFE bump werkzeug to 0.16 ?