xref: /petsc/doc/fix_pydata_margins.py (revision f748bf6bfc83f133d5068e6a5445afd45844ada1)
1*1b37a2a7SPierre Jolivet#!/usr/bin/env python3
29f89e73bSBarry Smith""" Reduce the top and bottom margins for <h2> to not waste so much vertical space in the manual pages """
39f89e73bSBarry Smith
49f89e73bSBarry Smithimport os
59f89e73bSBarry Smithimport re
69f89e73bSBarry Smithimport fileinput
79f89e73bSBarry Smith
89f89e73bSBarry Smithdef fix_pydata_margins(root):
99f89e73bSBarry Smith    filename = os.path.join(root, '_static','styles','pydata-sphinx-theme.css')
109f89e73bSBarry Smith    with open(filename, 'r') as source:
119f89e73bSBarry Smith      str = source.read()
129f89e73bSBarry Smith    str = str.replace('var(--pst-font-size-h2)}','var(--pst-font-size-h2);margin-bottom:4px;margin-top:-5px}')
139f89e73bSBarry Smith    with open(filename,'w') as target:
149f89e73bSBarry Smith      target.write(str)
15