getnikola/nikola — pull request #1540 by Kwpolska (2014-12-21 11:13:26+00:00)
Title: fix #1285 -- sanitize code blocks.

This pull request fixes #1285 and adds:

1. `NikolaPygmentsHTML`.

This is a Nikola-specific Pygments HTML formatter, which produces code identical to that of reST, but with `table` line numbers (if desired). Code produced by the formatter is therefore compatible with existing `code.css` files, and it also removes the need to write regexps to fix things that didn’t comply.

The Markdown compiler still uses a regexp, another patch is needed for that.

2. A modernized `CodeBlock` directive.

This is a saner and more modern rewrite of the CodeBlock directive from reStructuredText. This version defers the generation of all the HTML to NikolaPygmentsHTML instead of a mix of a Pygments Lexer and a custom hack. As such, we can now use the `table` line numbers instead of the broken `inline` mess that makes copy-pasting impossible.

cc @jcea @ralsina @ravikiranj