Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs (Sphinx): added Bareos specific lexer for syntax highlighting
- Loading branch information
1 parent
ed3a293
commit 67cec37
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
docs/manuals/en/new_main_reference/source/extensions/bareos_lexers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from pygments.lexer import RegexLexer, inherit, bygroups | ||
from pygments.lexers.shell import BashLexer | ||
from pygments.token import * | ||
|
||
# | ||
# http://pygments.org/docs/lexerdevelopment/ | ||
# http://pygments.org/docs/tokens/ | ||
# | ||
|
||
# Test: | ||
# cat consolidate.cfg | pygmentize -l extensions/bareos_lexers.py:BareosConfigLexer -x | ||
# | ||
|
||
class BareosBaseLexer(BashLexer): | ||
name = 'BareosBase' | ||
|
||
tokens = { | ||
'root': [ | ||
#(r'(<input>)(.*)(</input>)', bygroups(None, Generic.Emph, None)), | ||
#(r'(<input>)(.*)(</input>)', bygroups(None, Generic.Strong, None)), | ||
(r'(<input>)(.*)(</input>)', bygroups(None, Generic.Heading, None)), | ||
(r'(<strong>)(.*)(</strong>)', bygroups(None, Generic.Strong, None)), | ||
inherit, | ||
], | ||
} | ||
|
||
class BareosConfigLexer(BareosBaseLexer): | ||
name = 'BareosConfig' | ||
aliases = ['bareosconfig', 'bconfig'] | ||
filenames = ['*.cfg'] | ||
|
||
tokens = { | ||
'root': [ | ||
inherit, | ||
], | ||
} | ||
|
||
class BareosConsoleLexer(BareosBaseLexer): | ||
name = 'BareosConsole' | ||
aliases = ['bareosconsole', 'bconsole'] | ||
#filenames = ['*.cfg'] | ||
|
||
tokens = { | ||
'root': [ | ||
inherit, | ||
], | ||
} | ||
|
||
class BareosLogLexer(BareosBaseLexer): | ||
name = 'BareosLog' | ||
aliases = ['bareoslog'] | ||
filenames = ['*.log'] | ||
|
||
tokens = { | ||
'root': [ | ||
inherit, | ||
], | ||
} | ||
|
||
class BareosMessageLexer(BareosBaseLexer): | ||
name = 'BareosMessage' | ||
aliases = ['bareosmessage', 'bmessage'] | ||
#filenames = ['*.log'] | ||
|
||
tokens = { | ||
'root': [ | ||
inherit, | ||
], | ||
} |