copy #891 code to nikola.utils

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
resolve #891 — implement demoting headers

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
fix tests

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
actually fix tests

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
allow the compiler to be None

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
move the header demotion test from markdown to utils

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
flake8

[ci skip]

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
use a real fake compiler

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
missed an instance of the former setup in reST

Note that I am doing that ONLY because I want a single implementation
troughout the entire codebase, without using compiler-specific nonsense.

If we did not do this, we’d have to have “I can do it by myself” value
for the compiler.demote_headers variable (there is no AlreadyDone
singleton in Python, is there?  Lying with False does not count), and
we’d have to query the site config in the reST plugin.  Not worth the
hassle.

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
flake8

[ci skip]

Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>