Thread: [Refdb-cvs] CVS: refdb/scripts refdbnd.in,1.8.2.3,1.8.2.4
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2005-06-22 20:15:11
|
Update of /cvsroot/refdb/refdb/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13451/scripts Modified Files: Tag: Release_0_9_5_stable refdbnd.in Log Message: use DocBook XML 4.3 as the default doctype;add support for DocBook XML 4.3;allow silent operation even if the cssfile argument is missing Index: refdbnd.in =================================================================== RCS file: /cvsroot/refdb/refdb/scripts/refdbnd.in,v retrieving revision 1.8.2.3 retrieving revision 1.8.2.4 diff -u -U2 -r1.8.2.3 -r1.8.2.4 --- refdbnd.in 17 Sep 2004 19:59:27 -0000 1.8.2.3 +++ refdbnd.in 22 Jun 2005 20:15:01 -0000 1.8.2.4 @@ -25,5 +25,5 @@ # user variable defaults defbasename="refdbtest" -defdoctype="db41" +defdoctype="db43x" defpubtype="book" defdatabase="refdbtest" @@ -34,4 +34,5 @@ encoding="" cssfile="" +silent="f" # Makefile-generated defaults @@ -65,8 +66,14 @@ encoding=`grep "^<?xml version=\"1.0\"" $basename | sed 's/^.*encoding=\"\(.*\)\".*/\1/'` else - if grep "^<!DOCTYPE.*TEI P4//DTD Main DTD Driver File//EN" $basename; then - doctype="teix" - pubtype=`grep "TEI P4//DTD Main DTD Driver File//EN" $basename | sed 's/^<!DOCTYPE \(.*\) PUBLIC.*/\1/'` + if grep "^<!DOCTYPE.*DTD DocBook XML V4.2//EN" $basename; then + doctype="db43x" + pubtype=`grep "DTD DocBook XML V4.3//EN" $basename | sed 's/^<!DOCTYPE \(.*\) PUBLIC.*/\1/'` encoding=`grep "^<?xml version=\"1.0\"" $basename | sed 's/^.*encoding=\"\(.*\)\".*/\1/'` + else + if grep "^<!DOCTYPE.*TEI P4//DTD Main DTD Driver File//EN" $basename; then + doctype="teix" + pubtype=`grep "TEI P4//DTD Main DTD Driver File//EN" $basename | sed 's/^<!DOCTYPE \(.*\) PUBLIC.*/\1/'` + encoding=`grep "^<?xml version=\"1.0\"" $basename | sed 's/^.*encoding=\"\(.*\)\".*/\1/'` + fi fi fi @@ -79,7 +86,7 @@ } -# if we have seven command line arguments, we'll use them. Otherwise -# ask interactively -if [ -z "$*" ] || [ "$#" -ne 7 ]; then +# if we have at least six command line arguments (cssfile is optional), we'll +# use them. Otherwise ask interactively +if [ -z "$*" ] || [ "$#" -lt 6 ]; then # get arguments interactively clear @@ -109,6 +116,6 @@ echo "Please enter the type of the document. Available types are 'db31'," echo "'db40', and 'db41' for DocBook SGML versions 3.1, 4.0, and 4.1," - echo "respectively, 'db41x' and 'db42x' for DocBook XML versions 4.1.2 and" - echo "4.2, respectively, and 'teix' for TEI XML P4" + echo "respectively, 'db41x', 'db42x', and 'db43x' for DocBook XML versions" + echo "4.1.2, 4.2, and 4.3, respectively, as well as 'teix' for TEI XML P4" echo "[$defdoctype]" read doctype @@ -177,4 +184,22 @@ fi + echo "You've selected the following values:" + echo "Basename: $basename" + echo "Document type: $doctype" + echo "Publication type: $pubtype" + echo "Database: $database" + echo "Bibliography style: $style" + echo "Encoding: $encoding" + echo "CSS file: $cssfile" + + echo "" + echo "Is this ok?" + echo "[y]" + read ok + + if [ -z "$ok" ]; then + ok="y" + fi + else # all arguments were specified on the command line @@ -187,30 +212,23 @@ encoding=$6 cssfile=$7 -fi -echo "You've selected the following values:" -echo "Basename: $basename" -echo "Document type: $doctype" -echo "Publication type: $pubtype" -echo "Database: $database" -echo "Bibliography style: $style" -echo "Encoding: $encoding" -echo "CSS file: $cssfile" - -echo "" -echo "Is this ok?" -echo "[y]" -read ok + # mangle stylename to generate the name of the CSS file + defcssfile=${style%.*}.css + if [ -z "$cssfile" ]; then + cssfile=$defcssfile + fi -if [ -z "$ok" ]; then ok="y" + silent="t" fi -if [ "$ok" = "y" ] || [ "$ok" = "Y" ]; then - echo "Fine, so then ..." - echo "" -else - echo "Please try again" - exit 1 +if [ "$silent" = "f" ]; then + if [ "$ok" = "y" ] || [ "$ok" = "Y" ]; then + echo "Fine, so then ..." + echo "" + else + echo "Please try again" + exit 1 + fi fi @@ -226,5 +244,5 @@ dist="dist: pdfdist psdist rtfdist htmldist" transformscript="refdbjade";; - db41x | db42x ) doctypeswitch="db31x" + db41x | db42x | db43x) doctypeswitch="db31x" extension="xml" htmlstylesheet=".html.xsl" @@ -247,6 +265,8 @@ sed "s%<doctypeswitch>%$doctypeswitch%" < $maketemplate | sed "s%<pubtype>%$pubtype%" | sed "s%<basename>%$basename%" | sed "s%<extension>%$extension%" | sed "s%<style>%$style%" | sed "s%<htmlstylesheet>%$htmlstylesheet%" | sed "s%<xhtmlstylesheet>%$xhtmlstylesheet%" | sed "s%<printstylesheet>%$printstylesheet%" | sed "s%<database>%$database%" | sed "s%all: pdf rtf html%$makeall%" | sed "s%dist: pdfdist rtfdist htmldist%$dist%" | sed "s%<transformscript>%$transformscript%" | sed "s%<encoding>%$encoding%" | sed "s%<cssfile>%$cssfile%" > Makefile -echo "Makefile created." -echo "" +if [ "$silent" = "f" ]; then + echo "Makefile created." + echo "" +fi encodingstring=" encoding=\"$encoding\"" @@ -255,32 +275,38 @@ if [ -z $xfile ]; then case "$doctype" in - db31 ) echo -e "<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook V3.1//EN\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; - db40 ) echo -e "<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook V4.0//EN\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; - db41 ) echo -e "<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; - db41x) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook XML V4.1.2//EN\" \"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; - db42x) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\" \"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; - teix ) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE TEI.2 PUBLIC \"-//TEI P4//DTD Main DTD Driver File//EN\" \"http://www.tei-c.org/P4X/DTD/tei2.dtd\" [\n<!ENTITY % TEI.general 'INCLUDE'>\n<!ENTITY % TEI.names.dates 'INCLUDE'>\n<!ENTITY % TEI.linking 'INCLUDE'>\n<!ENTITY % TEI.XML 'INCLUDE'>\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>" > $basename.short.$extension;; + db31 ) echo -e "<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook V3.1//EN\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>\n<!-- include the bibliography at the chapter level by inserting the entity &bibliography; -->\n" > $basename.short.$extension;; + db40 ) echo -e "<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook V4.0//EN\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>\n<!-- include the bibliography at the chapter level by inserting the entity &bibliography; -->\n" > $basename.short.$extension;; + db41 ) echo -e "<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>\n<!-- include the bibliography at the chapter level by inserting the entity &bibliography; -->\n" > $basename.short.$extension;; + db41x) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook XML V4.1.2//EN\" \"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>\n<!-- include the bibliography at the chapter level by inserting the entity &bibliography; -->\n" > $basename.short.$extension;; + db42x) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\" \"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>\n<!-- include the bibliography at the chapter level by inserting the entity &bibliography; -->\n" > $basename.short.$extension;; + db43x) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE $pubtype PUBLIC \"-//OASIS//DTD DocBook XML V4.3//EN\" \"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd\" [\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>\n<!-- include the bibliography at the chapter level by inserting the entity &bibliography; -->\n" > $basename.short.$extension;; + teix ) echo -e "<?xml version=\"1.0\"$encodingstring?>\n<!DOCTYPE TEI.2 PUBLIC \"-//TEI P4//DTD Main DTD Driver File//EN\" \"http://www.tei-c.org/P4X/DTD/tei2.dtd\" [\n<!ENTITY % TEI.general 'INCLUDE'>\n<!ENTITY % TEI.names.dates 'INCLUDE'>\n<!ENTITY % TEI.linking 'INCLUDE'>\n<!ENTITY % TEI.XML 'INCLUDE'>\n<!ENTITY bibliography SYSTEM \"$basename.bib.$extension\">\n]>\n<!-- include the bibliography at the chapter level by inserting the entity &bibliography; -->\n" > $basename.short.$extension;; esac - echo "Document $basename.short.$extension created." + if [ "$silent" = "f" ]; then + echo "Document $basename.short.$extension created." + fi else - echo "Your existing document is called $xfile." + if [ "$silent" = "f" ]; then + echo "Your existing document is called $xfile." + fi fi - -echo "" -echo "After editing this file you can use the following commands to create" -echo "formatted output:" -echo "make pdf to create a Portable Document Format (PDF) file ($basename.pdf)" -if [ "$doctype" = "db41x" ] || [ "$doctype" = "db42x" ]; then - echo "make html to create HTML output ($basename.html)" - echo "make xhtml to create XHTML output ($basename.xhtml)" -else - echo "make html to create HTML output (${pubtype}1.html)" -fi -echo "make rtf to create a Rich Text Format (RTF) file ($basename.rtf)" -if [ "$extension" = "sgml" ]; then - echo "make ps to create a Postscript file ($basename.ps)" +if [ "$silent" = "f" ]; then + echo "" + echo "After editing this file you can use the following commands to create" + echo "formatted output:" + echo "make pdf to create a Portable Document Format (PDF) file ($basename.pdf)" + if [ "$doctype" = "db41x" ] || [ "$doctype" = "db42x" ]; then + echo "make html to create HTML output ($basename.html)" + echo "make xhtml to create XHTML output ($basename.xhtml)" + else + echo "make html to create HTML output (${pubtype}1.html)" + fi + echo "make rtf to create a Rich Text Format (RTF) file ($basename.rtf)" + if [ "$extension" = "sgml" ]; then + echo "make ps to create a Postscript file ($basename.ps)" + fi + echo "make all to create all available output formats" fi -echo "make all to create all available output formats" exit 0 |