[debian-edu-commits] debian-edu/ 01/01: Adjusted script to cope with wiki changes.

Wolfgang Schweer schweer-guest at moszumanska.debian.org
Wed Sep 17 08:03:09 UTC 2014


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

schweer-guest pushed a commit to branch jessie
in repository debian-edu-doc.

commit f46a3927d6a6427c23e446ae37ca138996ec95cb
Author: Wolfgang Schweer <wschweer at arcor.de>
Date:   Wed Sep 17 10:01:07 2014 +0200

    Adjusted script to cope with wiki changes.
---
 documentation/scripts/get_manual | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/documentation/scripts/get_manual b/documentation/scripts/get_manual
index ab73dfe..1d58a2e 100755
--- a/documentation/scripts/get_manual
+++ b/documentation/scripts/get_manual
@@ -72,12 +72,14 @@ unique_section_ids() {
 # the last but one sed "preserves" the 2nd matched regex
 # the last sed does the same as dos2unix
 # head at the end chops of the last two lines with the Category:Permalink entry
-GET -H User-Agent: "${url}AllInOne?action=raw"|sed "s%<<Include(%%g" | sed "s%)>>%%g" | sed "s%$path1%%g" |sed 's/.$//'|head -n -2> id
+# the id0/id thingy manages the TableOfContents problem
+PERL_LWP_SSL_VERIFY_HOSTNAME=0 GET -H User-Agent: "${url}AllInOne?action=raw" | sed "s%<<TableOfContents(1%%g" | sed "s%<<Include(%%g" | sed "s%)>>%%g" | sed "s%$path1%%g" |sed 's/.$//'|head -n -2|tail -n +3> id
 
 for i in `cat id` ; do
 	NAME=`echo "${i}" |sed "s/\(.*\)\/\(.*\)/\2/" `
 	# The ø -> oe conversion is a workaround for bug #657511.
  	ASCIINAME=$(echo $NAME  | tr "ø" "oe" | iconv -t ASCII//TRANSLIT)
+	# replace "" with "index" for the TableOfContents.
 	TARGET=${NAME}.xml
 	echo "$TARGET		${url}${i}?action=show&mimetype=text/docbook"
 	# download the docbook version of the manual from the wiki and pipe it through sed to
@@ -87,8 +89,8 @@ for i in `cat id` ; do
 	#   - remove the revision history
 	#   - remove the Category:Permalink line
 	#   - add some linebreaks
-	#   - delete the first line containing the XML declaration
-	GET "${url}${i}?action=show&mimetype=text/docbook" | 
+	#   - delete the first lines containing the XML declaration and the article tag
+	PERL_LWP_SSL_VERIFY_HOSTNAME=0 GET "${url}${i}?action=show&mimetype=text/docbook" |
 	# replace tags:
 	sed "s%code>%computeroutput>%g" |
 	sed "s%/htdocs/rightsidebar/img/%./images/%g" |
@@ -99,12 +101,12 @@ for i in `cat id` ; do
 	# Comment useless remarks from XML: they just show an ugly drawing in XML
 	perl -pe "s%<remark>.*?</remark>%<!-- $& -->%g" |
 	# Broken URL: workaround to #656945
-	sed "s%<ulink url='http://wiki.debian.org/${path1}${i}/%<ulink url='http://wiki.debian.org/%g" |
+	sed "s%<ulink url='https://wiki.debian.org/${path1}${i}/%<ulink url='https://wiki.debian.org/%g" |
 	# Make wiki self links actually local
 	sed "s%<link linkend='%<link linkend='${ASCIINAME}--%g" |
-	perl -pe "s%<ulink url='http://wiki.debian.org/${path1}/(HowTo/)?(\w+)#'>(.*?)</ulink>%<link linkend='\2'>\3</link>%g" |
-	perl -pe "s%<ulink url='http://wiki.debian.org/${path1}/(HowTo/)?(\w+)#(.*?)'>(.*?)</ulink>%<link linkend='\2--\3'>\4</link>%g" |
-	sed "s%<para><ulink url='http://wiki.debian.org/CategoryPermalink#'>CategoryPermalink</ulink> </para>%%" |
+	perl -pe "s%<ulink url='https://wiki.debian.org/${path1}/(HowTo/)?(\w+)#'>(.*?)</ulink>%<link linkend='\2'>\3</link>%g" |
+	perl -pe "s%<ulink url='https://wiki.debian.org/${path1}/(HowTo/)?(\w+)#(.*?)'>(.*?)</ulink>%<link linkend='\2--\3'>\4</link>%g" |
+	sed 's%<para><ulink url="https://wiki.debian.org/${path1}//CategoryPermalink#">CategoryPermalink</ulink> </para>%%' |
 	unique_section_ids |
 	# introduce line breaks:
 	sed "s%<title>%\n<title>%g" |
@@ -116,8 +118,8 @@ for i in `cat id` ; do
 	sed "s%FIXME%\nFIXME%g" |
 	sed "s%<itemizedlist>%\n<itemizedlist>%" |
 	sed "s%<listitem>%\n<listitem>%" |
-	# cut off first line:
-	sed '1d' > $TARGET
+	# cut off first 6 lines containing docbook info
+	tail -n +7 > $TARGET
 	if [ "$(grep -v FIXMEs $TARGET |grep FIXME |grep -v 'status ignore')" != "" ] ; then
 		echo "----------------------------------" >> $TMPFILE
 		echo ${url}${i} >> $TMPFILE
@@ -139,7 +141,7 @@ done
 rm -f $xmlfile
 for i in `cat id` ; do
 	cat ${i}.xml >> $xmlfile
-	rm ${i}.xml
+#	rm ${i}.xml
 done
 rm id
 
@@ -151,24 +153,24 @@ echo "calling ../scripts/get_images $xmlfile $path1"
 # this needs to run after ./get_images
 #
 #  -0\777  read multiple lines
-perl -0\777 -pi -e "s/<ulink url='$path2(.*)\/(.*)'>(.*)\n<\/ulink>/<link linkend=\"\2\">\3<\/link>/g" $xmlfile
-
+perl -0\777 -pi -e "s/<ulink url='$path2(.*)\/\/(.*)'>(.*)\n<\/ulink>/<link linkend=\"\2\">\3<\/link>/g" $xmlfile
+cp $xmlfile nachlink.xml
 # make it a docbook article again
 sed -i "1,/</ s#<#<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook XML V4.4//EN\" \"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd\"><article lang=\"en\"><articleinfo><title>$DEBIAN_EDU_DOC_TITLE <?dbtimestamp?></title></articleinfo>\n<#" $xmlfile
 sed -i "$ s#>#>\n</article>#" $xmlfile
 
-# remove the first empty line
-sed -i "1d" $xmlfile
-
+# remove third line containing docbook info
+sed -i "3d" $xmlfile
+cp $xmlfile vor_xmllint.xml
 # clean it further
 TMPFILE2=$(mktemp)
 xmllint $xmlfile > $TMPFILE2
 mv $TMPFILE2 $xmlfile
 
 # motivate
-if [ "$(grep -v FIXMEs $xmlfile |grep FIXME|uniq)" != "" ] ; then
+if [ "$(grep -v FIXMEs $xmlfile |grep FIXME|grep -v 'status ignore'|uniq)" != "" ] ; then
 	echo "====================" >> $TMPFILE
-	echo `grep -v FIXMEs $xmlfile |grep FIXME|uniq|wc -l` FIXMEs left to fix >> $TMPFILE
+	echo `grep -v FIXMEs $xmlfile |grep FIXME|grep -v 'status ignore'|uniq|wc -l` FIXMEs left to fix >> $TMPFILE
 	echo "====================" >> $TMPFILE
 fi
 mv $TMPFILE fixme-status.txt

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



More information about the debian-edu-commits mailing list