Skip to content

Commit

Permalink
get things rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
kratsg committed Jul 25, 2020
1 parent 161d23a commit b615ea6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,3 +434,28 @@ def setup(app):
}
},
}

# generate JSON Schema HTML
import fileinput
from json_schema_for_humans.generate import (
GenerationConfiguration,
generate_from_filename,
)

schema_doc = Path("_static/schema_doc.html")
config = GenerationConfiguration(expand_buttons=False, minify=False, copy_js=False)
generate_from_filename(
"../src/pyhf/schemas/1.0.0/workspace.json", schema_doc, config=config
)
with fileinput.FileInput(schema_doc, inplace=True, backup='.bak') as f:
replace_dict = {
"schema_doc": "_static/schema_doc",
'class="collapse ': 'class="',
}
for line in f:
for find, replace in replace_dict.items():
line = line.replace(find, replace)
print(line, end='')

with open(Path("_static/schema_doc.css"), "a+") as f:
f.write(".btn:active { padding: .375rem .75rem; }")
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
babel
cli
api
schema
citations
governance/ROADMAP

Expand Down
5 changes: 5 additions & 0 deletions docs/schema.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
HistFactory JSON Schema
=======================

.. raw:: html
:file: _static/schema_doc.html
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
'ipywidgets',
'sphinx-issues',
'sphinx-copybutton>0.2.9',
'json-schema-for-humans',
]
)
)
Expand Down

0 comments on commit b615ea6

Please sign in to comment.