pelican/samples/content/unbelievable.rst
2013-08-05 22:50:49 -07:00

73 lines
1.8 KiB
ReStructuredText

Unbelievable !
##############
:date: 2010-10-15 20:30
Or completely awesome. Depends the needs.
`a root-relative link to markdown-article <|filename|/cat1/markdown-article.md>`_
`a file-relative link to markdown-article <|filename|cat1/markdown-article.md>`_
Testing sourcecode directive
----------------------------
.. sourcecode:: python
:linenos:
formatter = self.options and VARIANTS[self.options.keys()[0]]
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.