mirror of https://github.com/KLayout/klayout.git
Added Jenkinsfile for doc generation step.
This commit is contained in:
parent
d2341cd408
commit
8ebf4a0f79
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
@Library("osconfig") _
|
||||
|
||||
node("master") {
|
||||
|
||||
stage("Checkout sources") {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage("Producing doc") {
|
||||
sh "./scripts/extract_user_doc.sh"
|
||||
}
|
||||
|
||||
stage("Publish doc") {
|
||||
//publish_doc(BRANCH_NAME)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
# Produces the documentation text from within KLayout
|
||||
|
||||
def xml2html(t)
|
||||
|
||||
# strip XML processing instructions and DTD
|
||||
t = t.sub(/^.*<body>/m, "")
|
||||
t = t.sub(/<\/body>.*$/m, "")
|
||||
|
||||
# insert title in front of navigator
|
||||
t = t.sub(/<p class="navigator">/, "<p class=\"navigator\"><b>KLayout Documentation (Qt #{$qt}): </b>")
|
||||
|
||||
# replace .xml references in hrefs
|
||||
t = t.gsub(/href=\"(.*?)\.xml\"/) { "href=\"#{$1}.html\""; }
|
||||
t = t.gsub(/href=\"(.*?)\.xml#(.*?)\"/) { "href=\"#{$1}.html##{$2}\""; }
|
||||
|
||||
# replace simplified XML tags with an opening/closing tag
|
||||
t = t.gsub(/<(\w+)([^<>]*?)\/>/) { "<#{$1}#{$2}></#{$1}>" }
|
||||
|
||||
# replace some closing tags which are not allowed
|
||||
t = t.gsub(/<\/br>/, "").gsub(/<\/img>/, "")
|
||||
|
||||
t
|
||||
|
||||
end
|
||||
|
||||
|
||||
hs = RBA::HelpSource.new
|
||||
|
||||
hs.urls.each do |url|
|
||||
|
||||
begin
|
||||
|
||||
fn = ($target_doc + url).sub(/\.xml$/, ".html")
|
||||
|
||||
t = hs.get(url)
|
||||
t = xml2html(t)
|
||||
|
||||
tt = nil
|
||||
if File.exists?(fn)
|
||||
File.open(fn, "rb") { |f| tt = f.read }
|
||||
end
|
||||
|
||||
if t != tt
|
||||
puts "Writing #{fn} .."
|
||||
File.open(fn, "wb") do |f|
|
||||
f.write(t)
|
||||
end
|
||||
else
|
||||
puts "Retained #{fn}."
|
||||
end
|
||||
|
||||
rescue => ex
|
||||
puts "*** ERROR: #{ex.to_s}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
bin=""
|
||||
src=""
|
||||
|
||||
self=$(realpath $(which $0))
|
||||
inst_dir=$(dirname $self)
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
a="$1"
|
||||
shift
|
||||
if [ "$a" = "-h" ]; then
|
||||
echo "extract_user_doc.sh"
|
||||
echo " ./scripts/extract_user_doc"
|
||||
exit 1
|
||||
else
|
||||
echo "invalid option $a"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
doc_src=./src/lay/lay/doc
|
||||
|
||||
for qt in 5 4; do
|
||||
|
||||
target_doc=./doc-qt$qt
|
||||
|
||||
export QT_SELECT=$qt
|
||||
./build.sh -qmake qmake -j4 -bin bin-release-qt$qt -build build-release-qt$qt
|
||||
|
||||
for d in programming manual about images; do
|
||||
mkdir -p $target_doc/$d
|
||||
for f in $doc_src/$d/*.png; do
|
||||
fn=$(basename $f)
|
||||
if [ ! -e $target_doc/$d/$fn ] || [ $doc_src/$d/$fn -nt $target_doc/$d/$fn ]; then
|
||||
echo "cp $doc_src/$d/$fn $target_doc/$d"
|
||||
cp $doc_src/$d/$fn $target_doc/$d
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
mkdir -p $target_doc/code
|
||||
|
||||
cd bin-release-qt$qt
|
||||
export LD_LIBRARY_PATH=.
|
||||
export KLAYOUT_PATH=.
|
||||
export KLAYOUT_HOME=.
|
||||
|
||||
rm -f ./help-index.xml
|
||||
./klayout -rx -z -rd "target_doc=$target_doc" -rd "qt=$qt" -r $inst_dir/extract_user_doc.rb
|
||||
|
||||
mv ./help-index.xml $target_doc/help-index.data
|
||||
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue