diff options
| author | SDGSDG <karmadharma@server.fake> | 2013-08-05 19:53:32 -0700 |
|---|---|---|
| committer | SDGSDG <karmadharma@server.fake> | 2013-08-05 22:50:49 -0700 |
| commit | ece437f8fd69975c9a78aa1bb4c04910d97e7a0e (patch) | |
| tree | ca8f0b48868938b09fec6109ee456f064f6fcb7f /samples/content | |
| parent | e228357f589fb34a5ce2add48a9f16b8f404a181 (diff) | |
| download | pelican-ece437f8fd69975c9a78aa1bb4c04910d97e7a0e.tar.gz | |
Added more pygments options for code blocks
Diffstat (limited to 'samples/content')
| -rw-r--r-- | samples/content/unbelievable.rst | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/samples/content/unbelievable.rst b/samples/content/unbelievable.rst index 745ff217..b990d20c 100644 --- a/samples/content/unbelievable.rst +++ b/samples/content/unbelievable.rst @@ -18,3 +18,56 @@ Testing sourcecode directive Lovely. + +Testing more sourcecode directives +---------------------------------- + +.. sourcecode:: python + :anchorlinenos: + :classprefix: testing + :hl_lines: 10,11,12 + :lineanchors: foo + :linenos: inline + :linenospecial: 2 + :linenostart: 8 + :linenostep: 2 + :lineseparator: <br> + :linespans: foo + :nobackground: + + def run(self): + self.assert_has_content() + try: + lexer = get_lexer_by_name(self.arguments[0]) + except ValueError: + # no lexer found - use the text one instead of an exception + lexer = TextLexer() + + if ('linenos' in self.options and + self.options['linenos'] not in ('table', 'inline')): + self.options['linenos'] = 'table' + + for flag in ('nowrap', 'nobackground', 'anchorlinenos'): + if flag in self.options: + self.options[flag] = True + + # noclasses should already default to False, but just in case... + formatter = HtmlFormatter(noclasses=False, **self.options) + parsed = highlight('\n'.join(self.content), lexer, formatter) + return [nodes.raw('', parsed, format='html')] + + +Lovely. + +Testing even more sourcecode directives +--------------------------------------- + +.. sourcecode:: python + :linenos: table + :nowrap: + + + formatter = self.options and VARIANTS[self.options.keys()[0]] + + +Lovely. |
