Skip to content

Commit

Permalink
Use dark background and monokai style for code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchall committed Jul 21, 2016
1 parent 8d1e884 commit f8b3b37
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .static/dark_background.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
codeblock div[class^='highlight'], pre.literal-block div[class^='highlight'], .rst-content .literal-block div[class^='highlight'], div[class^='highlight'] div[class^='highlight'] {
background-color: #272822;
}
5 changes: 0 additions & 5 deletions .templates/layout.html

This file was deleted.

8 changes: 5 additions & 3 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'emacs'
pygments_style = 'monokai'

# The default language used to highlight source code
highlight_language = 'topas'
Expand Down Expand Up @@ -366,10 +366,12 @@
# If false, no index is generated.
#epub_use_index = True

def setup(sphinx):
def setup(app):
sys.path.insert(0, os.path.abspath('./util'))
from topas_lexer import TopasLexer
sphinx.add_lexer("topas", TopasLexer())
app.add_lexer("topas", TopasLexer())
app.add_stylesheet('pygments.css')
app.add_stylesheet('dark_background.css')

from pygments.styles import STYLE_MAP
print(sorted(STYLE_MAP.keys()))
6 changes: 3 additions & 3 deletions util/topas_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ class TopasLexer(RegexLexer):
'root': [
(r'#.*$', Comment),
(r'(?i)(includefile|inheritedvalue)', Keyword.Namespace),
(r'^([bidus]v?)(:)', bygroups(Keyword.Type, Text)),
(r'^([bidus]v?)(:)', bygroups(Keyword.Type, Name)),
(r'(?i)(ma|el|is|ge|gr|ph|so|sc|tf|ts|vr)([/\w]*/)([\w]+)',
bygroups(Name.Class, Name.Class, Name.Variable)),
bygroups(Name.Class, Name.Class, Name.Attribute)),
(r'"(?i)(true|false|t|f|1|0)"', Keyword.Constant),
(r'"', String, 'string'),
(r'(?<!\w)[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?', Number),
(r'[=+*-]', Operator),
(r'.', Text),
(r'.', Name),
],
'string': [
('[^"]+', String),
Expand Down

0 comments on commit f8b3b37

Please sign in to comment.