r6673 - in branches/cross-lfs/BOOK: . editor-tools

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Sat Aug 13 03:58:32 PDT 2005


Author: manuel
Date: 2005-08-13 04:58:30 -0600 (Sat, 13 Aug 2005)
New Revision: 6673

Added:
   branches/cross-lfs/BOOK/editor-tools/
   branches/cross-lfs/BOOK/editor-tools/Clean-spaces.sh
   branches/cross-lfs/BOOK/editor-tools/Find-files.sh
   branches/cross-lfs/BOOK/editor-tools/Xinclude-resolver.sh
Log:
Added some small scripts usefuls for editorial tasks.

Added: branches/cross-lfs/BOOK/editor-tools/Clean-spaces.sh
===================================================================
--- branches/cross-lfs/BOOK/editor-tools/Clean-spaces.sh	2005-08-12 21:12:42 UTC (rev 6672)
+++ branches/cross-lfs/BOOK/editor-tools/Clean-spaces.sh	2005-08-13 10:58:30 UTC (rev 6673)
@@ -0,0 +1,43 @@
+#!/bin/bash -e
+
+# This script will clean the trailing spaces on the given file
+# or in all XML files under the given directory.
+
+NAME=`basename $0`
+
+if [ -z "$1" ]; then
+  echo "USAGE: $NAME -d directory"
+  echo "       $NAME -f file"
+  exit;
+fi
+
+case "$1" in
+  -d )
+
+    if [ -z "$2" ]; then
+      echo "A directory is needed"
+      exit
+    fi;
+
+    for filename in `find $2 -name "*.xml"`; do
+      sed  -i -e "s/[[:space:]]\+$//" "${filename}"
+    done;
+    exit;;
+
+  -f )
+
+    if [ -z "$2" ]; then
+      echo "A filename is needed"
+      exit
+    fi
+
+    sed  -i -e "s/[[:space:]]\+$//" $2
+    exit;;
+
+  * )
+
+    echo "USAGE: $NAME -d directory"
+    echo "       $NAME -f file"
+    exit;;
+
+esac
\ No newline at end of file


Property changes on: branches/cross-lfs/BOOK/editor-tools/Clean-spaces.sh
___________________________________________________________________
Name: svn:keywords
   + "Author Date Revision Id"

Added: branches/cross-lfs/BOOK/editor-tools/Find-files.sh
===================================================================
--- branches/cross-lfs/BOOK/editor-tools/Find-files.sh	2005-08-12 21:12:42 UTC (rev 6672)
+++ branches/cross-lfs/BOOK/editor-tools/Find-files.sh	2005-08-13 10:58:30 UTC (rev 6673)
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# This script will find all XML files in the book that contains
+# the same string in their name.
+
+# To be executed from the top-level directory.
+
+# Useful to find the files related with a same package in all
+# directories and architectures.
+
+NAME=`basename $0`
+
+if [ -z "$1" ]; then
+  echo "USAGE: $NAME string"
+  exit
+fi
+
+find . -name "*$1*.xml"
\ No newline at end of file


Property changes on: branches/cross-lfs/BOOK/editor-tools/Find-files.sh
___________________________________________________________________
Name: svn:keywords
   + "Author Date Revision Id"

Added: branches/cross-lfs/BOOK/editor-tools/Xinclude-resolver.sh
===================================================================
--- branches/cross-lfs/BOOK/editor-tools/Xinclude-resolver.sh	2005-08-12 21:12:42 UTC (rev 6672)
+++ branches/cross-lfs/BOOK/editor-tools/Xinclude-resolver.sh	2005-08-13 10:58:30 UTC (rev 6673)
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# This script will create a copy of the given XML file
+# with the Xinclude tags resolved.
+
+# Must be executed from the same dir where the XML file
+# to be resolved is found.
+
+# The DTD declaration is removed from the output due that
+# xmllint add also the full set of entities.
+
+# Useful to see the actual text and commands and to know
+# in what files the Xincluded blocks are actually placed.
+
+# Remember to remove the full-*xml files after finished
+# your review of that files. They don't be commited to the
+# SVN repository.
+
+NAME=`basename $0`
+
+if [ -z "$1" ]; then
+  echo "USAGE: $NAME filename.xml"
+  exit
+fi
+
+xmllint -xinclude -output /tmp/temp.xml $1
+
+xmllint -dropdtd -output full-$1 /tmp/temp.xml
\ No newline at end of file


Property changes on: branches/cross-lfs/BOOK/editor-tools/Xinclude-resolver.sh
___________________________________________________________________
Name: svn:keywords
   + "Author Date Revision Id"




More information about the lfs-book mailing list