xref: /petsc/doc/fix_pydata_margins.py (revision 9f89e73be0504993f53c52e51dfa59c7cbbab79e)
1*9f89e73bSBarry Smith#!/usr/bin/env python
2*9f89e73bSBarry Smith""" Reduce the top and bottom margins for <h2> to not waste so much vertical space in the manual pages """
3*9f89e73bSBarry Smith
4*9f89e73bSBarry Smithimport os
5*9f89e73bSBarry Smithimport re
6*9f89e73bSBarry Smithimport fileinput
7*9f89e73bSBarry Smith
8*9f89e73bSBarry Smithdef fix_pydata_margins(root):
9*9f89e73bSBarry Smith    filename = os.path.join(root, '_static','styles','pydata-sphinx-theme.css')
10*9f89e73bSBarry Smith    with open(filename, 'r') as source:
11*9f89e73bSBarry Smith      str = source.read()
12*9f89e73bSBarry Smith    str = str.replace('var(--pst-font-size-h2)}','var(--pst-font-size-h2);margin-bottom:4px;margin-top:-5px}')
13*9f89e73bSBarry Smith    with open(filename,'w') as target:
14*9f89e73bSBarry Smith      target.write(str)
15