From d499358f0aae5e547de054b70786b726c5be65bb Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 23 Oct 2017 10:30:15 -0200 Subject: [doc] add script for copying doc to leap_se repo --- scripts/docs/copy-doc-to-leap_se.sh | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 scripts/docs/copy-doc-to-leap_se.sh (limited to 'scripts') diff --git a/scripts/docs/copy-doc-to-leap_se.sh b/scripts/docs/copy-doc-to-leap_se.sh new file mode 100755 index 00000000..86899943 --- /dev/null +++ b/scripts/docs/copy-doc-to-leap_se.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +# This script is intended to copy a single HTML documentation page generated +# using sphinx to the leap.se amber repository that builds the website. +# +# Because amber works differently than sphinx, the following modifications are +# made in the sphinx automatically generated single html page: +# +# - Remove everything from the start up to "". Amber will take care of +# adding the HTML template to the top of the file. +# +# - Remove everything from "" up to "". Amber will take care of +# adding the HTML template to the end of the file. +# +# - Remove the navigation div. Amber will take care of adding it's own TOC. +# +# - Remove the main

tag. Amber adds it automatically. +# +# - Remove all unicode paragraph characters. They are not hidden by amber and +# would make the page ugly. +# +# - Move h2, h3, h4 to one level up (i.e. h1, h2, h3), because amber expects +# this kind of page organization in order to render TOC and navigation +# correctly. +# +# - Turn h5-h7 to simple emphasized paragraphs, otherwise they would be +# rendered in a huge TOC. +# +# - Remove the indices and tables from the end of the file, as amber does it +# by itself. + +BASEDIR=$(dirname "$0") + +# The following directory structure works well in my filesystem, you might have +# to adapt to your structure/organization. +HEADER=${BASEDIR}/amber-header.txt +SOURCE=${BASEDIR}/../../docs/_build/singlehtml/index.html +TARGET=${BASEDIR}/../../../leap_se/pages/docs/design/soledad.html + +cat ${HEADER} > ${TARGET} +cat ${SOURCE} | sed \ + -e '//d' \ + -e '/role="navigation"/,+5d' \ + -e '/<\/body>/,/<\/html>/d' \ + -e '/

Soledad.*<\/h1>/d' \ + -e 's/ΒΆ//g' \ + -e 's/<\(\/\)\?h2>/<\1h1>/g' \ + -e 's/<\(\/\)\?h3>/<\1h2>/g' \ + -e 's/<\(\/\)\?h4>/<\1h3>/g' \ + -e 's/\(.*\)<\/h[5-7]>/

\1<\/b><\/p>/g' \ + -e '/indices-and-tables/,$d' \ + >> ${TARGET} -- cgit v1.2.3