[debian-edu-commits] debian-edu/ 01/02: Update import scripts to DocBook-related changes
David Prévot
taffit at moszumanska.debian.org
Fri Sep 19 23:03:00 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository debian-edu-doc.
commit 4d17e4c177b97114742ab4ba76e2c9e7f5855201
Author: David Prévot <taffit at debian.org>
Date: Fri Sep 19 17:33:26 2014 -0400
Update import scripts to DocBook-related changes
The DocBook generation changed on wiki.d.o side.
Closes: #762025
---
documentation/scripts/get_images | 6 +++---
documentation/scripts/get_manual | 26 +++++++++++++-------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/documentation/scripts/get_images b/documentation/scripts/get_images
index 739c106..6e0f838 100755
--- a/documentation/scripts/get_images
+++ b/documentation/scripts/get_images
@@ -64,10 +64,10 @@ sub replace () {
my $local = <FILE>;
close(FILE);
# look for images...
- if ( $local =~ "m#<imagedata( width='\\d+')\? fileref='/".$path."/\\w+\?action=AttachFile&do=get&target=([^']+)'/>#"
- or $local =~ "m#<imagedata( width='\\d+')\? fileref='([^']+)'( depth='\\d+')\?/>#") {
+ if ( $local =~ "m#<imagedata( width='\\d+')\? fileref=\"/".$path."/\\w+\?action=AttachFile&do=get&target=([^']+)\"( width=\"\\d+\")\?/>#"
+ or $local =~ "m#<imagedata( depth=\"\\d+\")\? fileref=\"([^\"]+)\"( width=\"\\d+\")\?/>#") {
# ..and replace the paths
- $local =~ s#<imagedata( width='\d+')? fileref='([^'"<>]+)'( depth='\d+')?/>#create($2)#eg;
+ $local =~ s#<imagedata( depth="\d+")? fileref="([^'"<>]+)"( width="\d+")?/>#create($2)#eg;
open(FILE, "> $file") or die "Can't open $file for writing";
print FILE $local;
close(FILE);
diff --git a/documentation/scripts/get_manual b/documentation/scripts/get_manual
index 5930f1a..82015a6 100755
--- a/documentation/scripts/get_manual
+++ b/documentation/scripts/get_manual
@@ -87,24 +87,24 @@ 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
+ # - delete the first lines containing the XML declaration
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" |
- # remove final tag:
- sed "s%</article>%%" |
+ # remove initial and final tags:
+ perl -pe "s%</?article>%%g" |
# remove tags and enclosed content:
sed "s#<articleinfo>\(.*\)</articleinfo>##g" |
# 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='https://wiki.debian.org/${path1}${i}/%<ulink url='https://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='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/CategoryPermalink#'>CategoryPermalink</ulink> </para>%%" |
+ sed "s%<link linkend=\"%<link linkend=\"${ASCIINAME}--%g" |
+ 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" |
+ perl -000 -pe "s%<para><ulink url=\"https://wiki.debian.org/CategoryPermalink#\">CategoryPermalink</ulink>\s*</para>%%" |
unique_section_ids |
# introduce line breaks:
sed "s%<title>%\n<title>%g" |
@@ -116,8 +116,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 lines:
+ sed '1,4d' > $TARGET
if [ "$(grep -v FIXMEs $TARGET |grep FIXME |grep -v 'status ignore')" != "" ] ; then
echo "----------------------------------" >> $TMPFILE
echo ${url}${i} >> $TMPFILE
@@ -151,14 +151,14 @@ 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
# 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 the first empty lines
+sed -i "1,2d" $xmlfile
# clean it further
TMPFILE2=$(mktemp)
--
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