doc: load lexer differently

Pygments 2.2+ has `load_lexer_from_file`, but it looks like some of our
build platforms are on an older version.

Also gotta include the new file in dist tarball.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2018-04-10 13:37:47 -04:00
parent 9eb95b3b0a
commit dff213a968
No known key found for this signature in database
GPG Key ID: DAF48E0F57E0834F
3 changed files with 22 additions and 7 deletions

View File

@ -258,4 +258,5 @@ EXTRA_DIST = frr-sphinx.mk \
figures/ospf_api_architecture.png \
figures/ospf_api_msghdr.png \
figures/ospf_api_msgs1.png \
figures/ospf_api_msgs2.png
figures/ospf_api_msgs2.png \
extra/frrlexer.py

View File

@ -343,6 +343,13 @@ def setup(app):
app.add_object_type('clicmd', 'clicmd')
# css overrides for HTML theme
app.add_stylesheet('overrides.css')
# load FRR config lexer
frrlexer = pygments.lexers.load_lexer_from_file('../extra/frrlexer.py', lexername="FRRLexer")
lexers['frr'] = frrlexer
# load Pygments lexer for FRR config syntax
#
# NB: in Pygments 2.2+ this can be done with `load_lexer_from_file`, but we
# do it manually since not all of our supported build platforms have 2.2
# yet.
#
# frrlexer = pygments.lexers.load_lexer_from_file('../extra/frrlexer.py', lexername="FRRLexer")
custom_namespace = {}
exec(open('../extra/frrlexer.py', 'rb').read(), custom_namespace)
lexers['frr'] = custom_namespace['FRRLexer']()

View File

@ -343,6 +343,13 @@ def setup(app):
app.add_object_type('clicmd', 'clicmd')
# css overrides for HTML theme
app.add_stylesheet('overrides.css')
# load FRR config lexer
frrlexer = pygments.lexers.load_lexer_from_file('../extra/frrlexer.py', lexername="FRRLexer")
lexers['frr'] = frrlexer
# load Pygments lexer for FRR config syntax
#
# NB: in Pygments 2.2+ this can be done with `load_lexer_from_file`, but we
# do it manually since not all of our supported build platforms have 2.2
# yet.
#
# frrlexer = pygments.lexers.load_lexer_from_file('../extra/frrlexer.py', lexername="FRRLexer")
custom_namespace = {}
exec(open('../extra/frrlexer.py', 'rb').read(), custom_namespace)
lexers['frr'] = custom_namespace['FRRLexer']()