Build the spec as part of the build
This commit is contained in:
parent
0af06291fe
commit
8a66b1a68b
4 changed files with 43 additions and 28 deletions
|
@ -11,9 +11,9 @@ pip install \
|
|||
jsonschema \
|
||||
PyYAML
|
||||
|
||||
# do sanity checks on the examples and swagger
|
||||
(cd event-schemas/ && ./check_examples.py)
|
||||
(cd api && ./check_examples.py)
|
||||
(cd scripts && ./gendoc.py -v)
|
||||
(cd api && npm install && node validator.js -s "client-server")
|
||||
|
||||
: ${GOPATH:=${WORKSPACE}/.gopath}
|
||||
|
@ -26,8 +26,8 @@ go get gopkg.in/fsnotify.v1
|
|||
(cd scripts/continuserv && go build)
|
||||
(cd scripts/speculator && go build)
|
||||
|
||||
# update the jekyll site
|
||||
./scripts/generate-jekyll.sh
|
||||
# generate bits of the site
|
||||
./scripts/generate-site
|
||||
|
||||
# create a tarball of the generated site
|
||||
tar -czf site.tar.gz _site
|
||||
|
|
|
@ -8,16 +8,21 @@
|
|||
from sys import argv
|
||||
import re
|
||||
|
||||
script, filename = argv
|
||||
filename = argv[1]
|
||||
|
||||
textfile = open(filename, "r")
|
||||
regex = r'(<h\d id="(.*?)">)'
|
||||
regex2 = r'(<div class="section" id="(.*?)">)'
|
||||
|
||||
replacement = r'<p><a class="anchor" id="\2"></a></p>\n\1'
|
||||
|
||||
with open(filename, "r") as f:
|
||||
lines = list(f)
|
||||
|
||||
# check for <hX id="..." (used in the FAQ) and add anchors - and then check
|
||||
# for <div class="section" id="..." and add anchors (used in the spec)
|
||||
for line in textfile:
|
||||
line = re.sub(regex, replacement, line.rstrip())
|
||||
print(re.sub(regex2, replacement, line.rstrip()))
|
||||
|
||||
with open(filename, "w") as f:
|
||||
for line in lines:
|
||||
line = re.sub(regex, replacement, line)
|
||||
line = re.sub(regex2, replacement, line)
|
||||
f.write(line)
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# this script runs 'jekyll' to turn the 'supporting-docs' into HTML.
|
||||
#
|
||||
# jekyll requires the `docutils` and `pygments` python packages, so install
|
||||
# them or run from a virtualenv which includes them.
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
# tell jekyll to parse things as utf-8
|
||||
export LANG="en_GB.UTF-8"
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p _site
|
||||
jekyll build -s jekyll
|
||||
./scripts/add_anchors.py _site/guides/faq.html >tmp && mv tmp _site/guides/faq.html
|
||||
./scripts/add_anchors.py _site/projects/try-matrix-now.html >tmp && mv tmp _site/projects/try-matrix-now.html
|
||||
|
30
scripts/generate-site
Executable file
30
scripts/generate-site
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This script builds part of the matrix.org site, under '_site'.
|
||||
#
|
||||
# jekyll requires the `docutils` and `pygments` python packages, so install
|
||||
# them or run from a virtualenv which includes them.
|
||||
|
||||
set -ex
|
||||
|
||||
# tell jekyll to parse things as utf-8
|
||||
export LANG="en_GB.UTF-8"
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p _site
|
||||
|
||||
# generate the jekyll bits
|
||||
jekyll build -s jekyll
|
||||
|
||||
# add some anchors to some generated jekyll bits
|
||||
./scripts/add_anchors.py _site/guides/faq.html
|
||||
./scripts/add_anchors.py _site/projects/try-matrix-now.html
|
||||
|
||||
# generate the latest spec
|
||||
./scripts/gendoc.py -d _site/spec
|
||||
|
||||
# apply the matrix.org styling to the spec
|
||||
find _site/spec -name '*.html' |
|
||||
xargs ./scripts/add-matrix-org-stylings.pl jekyll/_includes
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue