replace custom permalinks with sphinx defaults

This commit is contained in:
Antoine Vandevenne (anv) 2021-01-28 21:02:32 +01:00
parent ebc3e70d0f
commit a1648bc645
3 changed files with 25 additions and 18 deletions

11
conf.py
View File

@ -135,7 +135,8 @@ html_theme_path = ['extensions']
# directory. They are copied after the builtin static files, so a file named "default.css" will
# overwrite the builtin "default.css".
html_static_path = ['static']
html_add_permalinks = ''
html_add_permalinks = '' # Sphinx < 3.5
html_permalinks = True # Sphinx >= 3.5
html_js_files = [
'js/atom.js',
'js/accounts.js',
@ -148,6 +149,10 @@ html_js_files = [
'js/coa-valuation-continental.js',
'js/coa-valuation-anglo-saxon.js',
]
html_css_files = [
'css/accounting.css',
'css/legal.css',
]
#=== Options for LaTeX output ===#
@ -227,10 +232,6 @@ LANGUAGES = {
}
def setup(app):
# VFE TODO: use html_js_files & html_css_files conf attributes instead.
# app.add_stylesheet('css/accounting.css')
# app.add_stylesheet('css/legal.css')
app.connect('html-page-context', canonicalize)
# VFE TODO remove default before merge
app.add_config_value('canonical_root', os.path.dirname(os.path.realpath(__file__)), 'env')

View File

@ -7,19 +7,6 @@
content.querySelectorAll('img').forEach(image => {
image.classList.add('img-fluid');
});
// Add permalink anchors next to body sections
content.querySelectorAll('section').forEach(section => {
const heading = section.querySelector('h1,h2,h3,h4,h5,h6');
if (heading) {
const permalinkMarker = document.createElement('a');
permalinkMarker.href = `#${section.id}`;
permalinkMarker.classList.add('o_permalink_marker');
permalinkMarker.innerText = "O_REMOVE_ME"
heading.classList.add('o_has_permalink_marker'); // TODO EDI do we need this class?
heading.append(permalinkMarker);
}
});
});
})();

View File

@ -536,6 +536,25 @@ dt {
margin-top: -$o-header-height;
}
// TODO EDI this makes permalinks only visible on hover. Please re-write and sort
a.headerlink {
visibility: hidden;
}
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink,
caption:hover > a.headerlink,
p.caption:hover > a.headerlink,
div.code-block-caption:hover > a.headerlink {
visibility: visible;
}
#wrap {
margin-top: $o-header-height;
display: flex;