forked from scipy-conference/scipy_proceedings
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pygments_highlighting'
Conflicts: LICENSE.txt publisher/writer.py
- Loading branch information
Showing
6 changed files
with
134 additions
and
14 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
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
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
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,29 @@ | ||
# --- Code-block directive from Sphinx --- | ||
|
||
from docutils import nodes | ||
from docutils.parsers.rst import Directive, directives | ||
|
||
class CodeBlock(Directive): | ||
""" | ||
Directive for a code block with special highlighting or line numbering | ||
settings. | ||
""" | ||
|
||
has_content = True | ||
required_arguments = 1 | ||
optional_arguments = 0 | ||
final_argument_whitespace = False | ||
option_spec = { | ||
'linenos': directives.flag, | ||
} | ||
|
||
def run(self): | ||
code = u'\n'.join(self.content) | ||
literal = nodes.literal_block(code, code) | ||
literal['language'] = self.arguments[0] | ||
literal['linenos'] = 'linenos' in self.options | ||
return [literal] | ||
|
||
directives.register_directive('code-block', CodeBlock) | ||
|
||
# --- End code-block directive from Sphinx --- |
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,19 @@ | ||
from pygments.style import Style | ||
from pygments.styles.friendly import FriendlyStyle | ||
from pygments.token import Generic, Comment, Number | ||
|
||
class SphinxStyle(Style): | ||
""" | ||
Like friendly, but a bit darker to enhance contrast on the green | ||
background. | ||
""" | ||
|
||
background_color = '#eeffcc' | ||
default_style = '' | ||
|
||
styles = FriendlyStyle.styles | ||
styles.update({ | ||
Generic.Output: '#333', | ||
Comment: 'italic #408090', | ||
Number: '#208050', | ||
}) |
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