a root-relative link to markdown-article a file-relative link to markdown-article

Testing sourcecode directive

1
formatter = self.options and VARIANTS[self.options.keys()[0]]

Testing another case

This will now have a line number in 'custom' since it's the default in pelican.conf, it will …

"> a root-relative link to markdown-article a file-relative link to markdown-article

Testing sourcecode directive

1
formatter = self.options and VARIANTS[self.options.keys()[0]]

Testing another case

This will now have a line number in 'custom' since it's the default in pelican.conf, it will …

" />

Unbelievable !

Or completely awesome. Depends the needs.

a root-relative link to markdown-article a file-relative link to markdown-article

Testing sourcecode directive

1
formatter = self.options and VARIANTS[self.options.keys()[0]]

Testing another case

This will now have a line number in 'custom' since it's the default in pelican.conf, it will have nothing in default.

1
formatter = self.options and VARIANTS[self.options.keys()[0]]

Lovely.

Testing more sourcecode directives

 8def run(self):
self.assert_has_content()
10 try:
lexer = get_lexer_by_name(self.arguments[0])
12 except ValueError:
# no lexer found - use the text one instead of an exception
14 lexer = TextLexer()

16 if ('linenos' in self.options and
self.options['linenos'] not in ('table', 'inline')):
18 self.options['linenos'] = 'table'

20 for flag in ('nowrap', 'nobackground', 'anchorlinenos'):
if flag in self.options:
22 self.options[flag] = True

24 # noclasses should already default to False, but just in case...
formatter = HtmlFormatter(noclasses=False, **self.options)
26 parsed = highlight('\n'.join(self.content), lexer, formatter)
return [nodes.raw('', parsed, format='html')]

Lovely.

Testing even more sourcecode directives

formatter = self.options and VARIANTS[self.options.keys()[0]]

Lovely.

Testing overriding config defaults

Even if the default is line numbers, we can override it here

formatter = self.options and VARIANTS[self.options.keys()[0]]

Lovely.

By @Alexis Métaireau in
Tags :

Comments !