Copy the CSS into the built docs

This patch adds code that copies the CSS file into the _static
directory on build. Previously the CSS file was not included in the
built docs.

Change-Id: Ic7cc52b007b0c40b3aa85a242544c3c6aac16c02
This commit is contained in:
Michael Johnson
2019-04-12 17:07:26 -07:00
parent f6f3e0f2d8
commit 68fe0f2067
2 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Adds a handler to copy the CSS file into the _static directory on build.
Previously the CSS file was not being copied over into the built docs.

View File

@@ -19,7 +19,9 @@ It is used via a single directive in the .rst file
"""
from os import path
import re
import shutil
from docutils import nodes
from docutils.parsers import rst
@@ -463,6 +465,15 @@ class Directive(rst.Directive):
return para
def on_build_finished(app, exc):
if exc is None:
src = path.join(path.abspath(path.dirname(__file__)),
'support-matrix.css')
dst = path.join(app.outdir, '_static', 'support-matrix.css')
shutil.copyfile(src, dst)
def setup(app):
app.add_directive('support_matrix', Directive)
app.add_css_file('support-matrix.css')
app.connect('build-finished', on_build_finished)