[debian-edu-commits] debian-edu/ 01/01: Avoid hardcoding URLs in commands.

Petter Reinholdtsen pere at moszumanska.debian.org
Sat Mar 21 14:58:26 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 c42be7541a238c59705eb882b5450732cc4ec330
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Sat Mar 21 15:58:23 2015 +0100

    Avoid hardcoding URLs in commands.
---
 documentation/scripts/get_manual | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/documentation/scripts/get_manual b/documentation/scripts/get_manual
index 7b13b72..5c83088 100755
--- a/documentation/scripts/get_manual
+++ b/documentation/scripts/get_manual
@@ -1,4 +1,6 @@
 #!/bin/sh
+
+set -x
 #
 # download the AllInOne page of a manual on wiki.debian.org as docbook
 # and transform it into proper XML
@@ -33,6 +35,8 @@ fi
 TMPFILE=$(mktemp)
 xmlfile=$name.xml
 
+site=http://wiki.debian.org/
+
 # Make sure all section IDs are unique.  If file--subsection is not
 # unique, use file--section--subsection--subsubsection instead.
 unique_section_ids() {
@@ -109,12 +113,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='$site${path1}${i}/%<ulink url='$site%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='$site${path1}/(HowTo/)?(\w+)#'>(.*?)</ulink>%<link linkend='\2'>\3</link>%g" |
+	perl -pe "s%<ulink url='$site${path1}/(HowTo/)?(\w+)#(.*?)'>(.*?)</ulink>%<link linkend='\2--\3'>\4</link>%g" |
+	sed "s%<para><ulink url='${site}CategoryPermalink#'>CategoryPermalink</ulink> </para>%%" |
 	unique_section_ids |
 	# introduce line breaks:
 	sed "s%<title>%\n<title>%g" |

-- 
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