[debian-edu-commits] debian-edu/ 05/05: New script roundtrip-test.

Petter Reinholdtsen pere at moszumanska.debian.org
Fri Oct 2 18:55:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

pere pushed a commit to branch master
in repository debian-edu-itil-doc-nb.

commit 9bdce1daf37a719ccbf36ca179e6077c3fc21f07
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Fri Oct 2 20:54:15 2015 +0200

    New script roundtrip-test.
    
    Add script to do round trip test moin -> po -> moin with an empty
    translation, to compare the generated moin files with the originals.
---
 documentation/itil/dotranslation  | 16 +++++++++++++---
 documentation/itil/roundtrip-test | 18 ++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/documentation/itil/dotranslation b/documentation/itil/dotranslation
index c9ae94b..2836267 100755
--- a/documentation/itil/dotranslation
+++ b/documentation/itil/dotranslation
@@ -1,7 +1,17 @@
 #!/bin/sh
 
-TARGETLANG=en
- 
+if [ "$1" ] ; then
+    TARGETLANG="$1"
+else
+    TARGETLANG=en
+fi
+
+if [ "$2" ] ; then
+    limit="$2"
+else
+    limit=5
+fi
+
 if [ -z "`ls *.po`" ]; then
         echo "Found no translations (po files)." >&2
         exit 1
@@ -12,7 +22,7 @@ cat <<EOF >tmp.cfg
 
 [type: docbook] tmp.xml \\
         \$lang:\$lang.xml \\
-        opt:"-o nodefault='<inlinemediaobject> <imagedata>' -o untranslated='<listitem> <inlinemediaobject> <imagedata>' -M UTF-8 -k 5"
+        opt:"-o nodefault='<inlinemediaobject> <imagedata>' -o untranslated='<listitem> <inlinemediaobject> <imagedata>' -M UTF-8 -k $limit"
 EOF
  
 for f in *.xml ; do
diff --git a/documentation/itil/roundtrip-test b/documentation/itil/roundtrip-test
new file mode 100755
index 0000000..17618d9
--- /dev/null
+++ b/documentation/itil/roundtrip-test
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+xmltomoin() {
+	xml="$1"
+	moin=$(basename $xml .xml).moin
+	tmpfile=$(mktemp)
+	pandoc -f docbook -t mediawiki -o $tmpfile $xml
+	./convert.pl $tmpfile > $moin
+	rm $tmpfile
+}
+
+./dotranslation nb 0
+
+for id in $(cat id); do
+    curl -s https://wiki.debian.org/DebianEdu/Documentation/nb/ITIL/${id}?action=raw > ${id}.orig.moin
+    xmltomoin ${id}.nb.xml
+    diff -uw ${id}.orig.moin ${id}.nb.moin
+done > roundtrip-test.diff

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/upstream/debian-edu-itil-doc-nb.git



More information about the debian-edu-commits mailing list