[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#283949: allow generation of plain text



Package: debian-installer-manual
Severity: normal
Tags: patch

While investigating how to incorporate the install manual into
the websites I saw there is no plain text output yet. I've prepared
a little patch to allow this (xml->single html->text).

The method of using w3m -dump still has some drawbacks. The most
important one is that most of the URLs are invisible. None of the
textmode browers I tested seems to have an option to change this
behaviour, though (sadly enough, the text export of Firefox does this
one good, but has its errors, too. Beside the fact we can't use it
in batch mode ;) Still working on this.

Gruesse,
	Frank Lichtenheld

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-1-k7-smp
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8
Index: buildone.sh
===================================================================
--- buildone.sh	(revision 24138)
+++ buildone.sh	(working copy)
@@ -20,6 +20,7 @@
 stylesheet_dir="$build_path/stylesheets"
 stylesheet_profile="$stylesheet_dir/style-profile.xsl"
 stylesheet_html="$stylesheet_dir/style-html.xsl"
+stylesheet_html_single="$stylesheet_dir/style-html-single.xsl"
 stylesheet_fo="$stylesheet_dir/style-fo.xsl"
 stylesheet_dsssl="$stylesheet_dir/style-print.dsl"
 
@@ -101,6 +102,24 @@
     checkresult $?
 }
 
+create_text () {
+
+    create_profiled
+    
+    echo "Creating temporary .html file..."
+
+    /usr/bin/xsltproc \
+        --xinclude \
+	--output $tempdir/install.${language}.html \
+        $stylesheet_html_single \
+        $tempdir/install.${language}.profiled.xml
+    checkresult $?
+
+    echo "Creating .txt file..."
+    w3m -dump $tempdir/install.${language}.html \
+	>$destination/install.${language}.txt
+}
+
 create_dvi () {
     
     # Skip this step if the .dvi file already exists
@@ -179,6 +198,7 @@
         html)  create_html;;
         ps)    create_ps;;
         pdf)   create_pdf;;
+        txt)   create_text;;
         *) echo "Format $format unknown or not yet supported!";;
 
     esac
Index: build.sh
===================================================================
--- build.sh	(revision 24138)
+++ build.sh	(working copy)
@@ -16,6 +16,10 @@
 	destination="/tmp/manual"
 fi
 
+if [ -z "$format" ]; then
+        formats="html pdf ps txt"
+fi
+
 [ -e "$destination" ] || mkdir -p "$destination"
 
 if [ "$official_build" ]; then
@@ -32,9 +36,15 @@
 	else
 		destsuffix="${lang}.${arch}"
 	fi
-	./buildone.sh "$arch" "$lang" "html"
-	mkdir "$destination/$destsuffix"
-	mv build.out/html/*.html "$destination/$destsuffix"
+	./buildone.sh "$arch" "$lang" "$formats"
+	mkdir -p "$destination/$destsuffix"
+	for format in $formats; do
+	    if [ "$format" = html ]; then
+		mv build.out/html/*.html "$destination/$destsuffix"
+	    else
+		mv build.out/install.$lang.$format "$destination/$destsuffix"
+	    fi
+	done
 	./clear.sh
     done
 done

Reply to: