From f9fe6a07833b08a8b76ac9740bd6aa4142725913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Wed, 20 Jan 2016 23:31:10 +0100 Subject: [PATCH] Fixed MathJax links on gh-pages. --- .travis.yml | 7 ++-- graph-lib/make/make-indexes.sh | 2 +- graph-lib/make/make.rkt | 69 ++++++++++++++++++++-------------- 3 files changed, 45 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1d865b3e..9787d825 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,12 +54,11 @@ after_script: - git config --global user.name "Travis CI" - git config --global user.email "travis@nobody.com" - if test -e ~/gh-pages; then rm -rf ~/gh-pages; fi -#- mv -i coverage docs - mv -i docs ~/gh-pages - git init ~/gh-pages -#- mv -i make/index.html.root ~/gh-pages/index.html -- mkdir -p ~/gh-pages/lib/doc/MathJax -- echo 'document.write("");' > ~/gh-pages/lib/doc/MathJax/MathJax.js +- rm -f ~/gh-pages/MathJax +- mkdir ~/gh-pages/MathJax +- echo 'document.write("");' > ~/gh-pages/MathJax/MathJax.js - touch ~/gh-pages/.nojekyll - (cd ~/gh-pages && git add -A . && git commit -m "Auto-publish to gh-pages") - (cd ~/gh-pages; git push --force --quiet "https://${GH_TOKEN}@github.com/jsmaniac/phc.git" master:gh-pages >/dev/null 2>&1 || true) # redirect to /dev/null to avoid showing credentials. diff --git a/graph-lib/make/make-indexes.sh b/graph-lib/make/make-indexes.sh index aa28eb64..2da13056 100644 --- a/graph-lib/make/make-indexes.sh +++ b/graph-lib/make/make-indexes.sh @@ -1,2 +1,2 @@ #!/bin/bash -find "$@" -type d -print0 | xargs -n 1 -r0 bash -c '(shopt -s nullglob; cd "$0"; if (! test -e index.html) || test -e .make-index-html; then touch .make-index-html; echo "" >> index.html; fi)' +find "$@" -type d -print0 | xargs -n 1 -r0 bash -c '(shopt -s nullglob; cd "$0"; if (! test -e index.html) || test -e .make-index-html; then touch .make-index-html; echo "" >> index.html; fi)' diff --git a/graph-lib/make/make.rkt b/graph-lib/make/make.rkt index de38c077..b5d8f509 100644 --- a/graph-lib/make/make.rkt +++ b/graph-lib/make/make.rkt @@ -140,9 +140,15 @@ "-j" "8" ,@rkt-files)) +;; Create root MathJax link, must be done before the others +;; Otherwise make/proc thinks the (broken) link hasn't been created. +(make-directory* "docs/") ;; docs/ must be created before Depencency graph too +(make-file-or-directory-link (build-path 'up "lib" "doc" "MathJax") + (build-path "docs" "MathJax")) + + ;; Dependency graph, must be done before docs. (begin - (make-directory* "docs/") (run! (list (find-executable-path-or-fail "racket") "make/dependency-graph.rkt" "graph/__DEBUG_graph__.rkt" @@ -166,33 +172,40 @@ "-o" "docs/deps.pdf"))) (make/proc - (rules (list "zo" (append html-files - pdf-files - mathjax-links)) - (for/rules ([scrbl-or-lp2 doc-sources] - [html html-files]) - (html) - (scrbl-or-lp2) - #;(scribble (list scrbl-or-lp2) doc-sources "--html") - (scribble-all doc-sources html-files "--html")) - (for/rules ([scrbl-or-lp2 doc-sources] - [pdf pdf-files]) - (pdf) - (scrbl-or-lp2) - #;(scribble (list scrbl-or-lp2) doc-sources "--pdf") - (scribble-all doc-sources pdf-files "--pdf")) - (for/rules ([mathjax-link mathjax-links]) - (mathjax-link) - () - (let ([mathjax-dir - (simplify-path - (apply build-path - `(same - ,@(map (λ (x) 'up) - (explode-path (dirname mathjax-link))) - "lib" "doc" "MathJax")) - #f)]) - (make-file-or-directory-link mathjax-dir mathjax-link)))) + (rules + (list "zo" (append html-files + pdf-files + mathjax-links)) + (for/rules ([scrbl-or-lp2 doc-sources] + [html html-files]) + (html) + (scrbl-or-lp2) + #;(scribble (list scrbl-or-lp2) doc-sources "--html") + (scribble-all doc-sources html-files "--html")) + (for/rules ([scrbl-or-lp2 doc-sources] + [pdf pdf-files]) + (pdf) + (scrbl-or-lp2) + #;(scribble (list scrbl-or-lp2) doc-sources "--pdf") + (scribble-all doc-sources pdf-files "--pdf")) + (for/rules ([mathjax-link mathjax-links]) + (mathjax-link) + () + (let* ([docs-mathjax-dir + (simplify-path + (apply build-path + `(same + ,@(build-list (sub1 (length (explode-path + (dirname mathjax-link)))) + (const 'up)) + "MathJax")) + #f)] + [docs-or-lib-mathjax-dir + (if (equal? (build-path "docs" "MathJax") mathjax-link) + (build-path 'up "lib" "doc" "MathJax") + docs-mathjax-dir)]) + (make-file-or-directory-link docs-or-lib-mathjax-dir + mathjax-link)))) (argv)) (run! `(,(find-executable-path-or-fail "raco")