diff options
-rw-r--r-- | doc/Makefile.am | 3 | ||||
-rw-r--r-- | doc/developer/conf.py | 13 | ||||
-rw-r--r-- | doc/user/conf.py | 13 |
3 files changed, 22 insertions, 7 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am index 6228683f9..9f58c18cb 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -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 diff --git a/doc/developer/conf.py b/doc/developer/conf.py index eecce4e90..11ec05e0c 100644 --- a/doc/developer/conf.py +++ b/doc/developer/conf.py @@ -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']() diff --git a/doc/user/conf.py b/doc/user/conf.py index 389af4c82..24e27bb5e 100644 --- a/doc/user/conf.py +++ b/doc/user/conf.py @@ -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']() |