Skip to content

Commit

Permalink
- Also look for pdf's, report duplicate resources
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10760 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Dec 18, 2011
1 parent 9f9faf7 commit 0f3330b
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions Examples/GenerateDoc.mos
Expand Up @@ -166,33 +166,45 @@ for f in *.html.tmp ; do
F=`echo $f | sed s/\\.tmp\\$//`
echo Checking file $F >> tidy.log
cp \"$f\" \"$F\"
# Image sources (filenames)
sed -i 's/src=\"modelica:\\/\\/[A-Za-z0-9/'\\''()._-]*\\/\\([A-Za-z0-9'\\''()._-]*\\.png\"\\)/src=\"\\1/g' \"$F\"
# Image sources (filenames) and links
# Links to classnames
sed -i 's/href=\"modelica:\\/\\/\\([A-Za-z0-9'\\''()._]*\\)/href=\"\\1.html/g' \"$F\"
# Make quoted identifiers pretty
sed -i 's/\\(href=\"[^\"'\\'']*\\)'\\''\\([^\"'\\'']*\\)'\\''/\\1\\2/g' \"$F\"
sed -i -e 's&=\"modelica://[A-Za-z0-9/'\\''()._-]*/\\([A-Za-z0-9'\\''()._-]*\\.png\"\\)&=\"\\1&g' \\
-e 's&href=\"modelica://\\([A-Za-z0-9'\\''()._]*\\)&href=\"\\1.html&g' \\
-e 's&\\(href=\"[^\"'\\'']*\\)'\\''\\([^\"'\\'']*\\)'\\''&\\1\\2&g' \"$F\"
tidy -modify -quiet \"$F\" 2>> tidy.log
done
mkdir -p old-html-tmp
mv *.html.tmp old-html-tmp
");

writeFile("FindFiles.sh","#!/bin/bash
egrep -o \"[A-Za-z_0-9.-]*\\.(png|jpg)\" *.html | cut -d: -f2- | sort -u | tr -d \\\" > tmp
for f in `cat tmp`; do
if test -f \"$f\"; then
writeFile("CopyReport.sh","#!/bin/bash
if test -f \"$2\"; then
if cmp --quiet \"$1\" \"$2\"; then
# echo Found identical duplicate: $1
true
else
find " + searchPaths + " -name \"$f\" -exec cp '{}' '.' ';'
test -f \"$f\" && echo Found: $f || echo Not found: $f
echo Found duplicate file: $1
fi
fi
cp -f \"$1\" \"$2\"
");

writeFile("FindFiles.sh","#!/bin/bash
grep -v http:// *.html | egrep -o \"[A-Za-z_0-9.-]*\\.(png|jpg|pdf)\" | cut -d: -f2- | sort -u | tr -d \\\" > tmp
for f in `cat tmp`; do
#if test -f \"$f\"; then
# true
#else
find " + searchPaths + " -name \"$f\" -exec sh 'CopyReport.sh' '{}' \"$f\" ';'
test -f \"$f\" || echo Not found: $f
#fi
done
");

system("bash Tidy.sh");
system("bash FindFiles.sh");
system("rm -f ModelicaDocumentation.tar.xz");
system("rm -f *.html.tmp");
system("tar cJf ModelicaDocumentation.tar.xz --dereference *.html *.png GenerateDoc.mos");
system("tar cJf ModelicaDocumentation.tar.xz --dereference *.html *.png *.pdf GenerateDoc.mos");
getErrorString();

0 comments on commit 0f3330b

Please sign in to comment.