diff options
-rw-r--r-- | Makefile | 25 | ||||
-rwxr-xr-x | concat.sh | 13 | ||||
-rw-r--r-- | convert.xsl | 2 | ||||
-rwxr-xr-x | download-books.sh | 15 | ||||
-rwxr-xr-x | download-chapters.sh | 14 | ||||
-rwxr-xr-x | download.sh | 4 |
6 files changed, 44 insertions, 29 deletions
@@ -1,18 +1,25 @@ -CHAPTERS=$(wildcard chapters/*/*.html) -CHAPTERS_XML=$(CHAPTERS:.html=.xml) +ELBERFELDER_CHAPTERS=$(wildcard elberfelder/chapters/*/*.html) +ELBERFELDER_CHAPTERS_XML=$(ELBERFELDER_CHAPTERS:.html=.xml) -all: book-list elberfelder2006.zip +MENGE_CHAPTERS=$(wildcard menge/chapters/*/*.html) +MENGE_CHAPTERS_XML=$(MENGE_CHAPTERS:.html=.xml) -chapters/%.xml: chapters/%.html convert.sed convert.xsl - ./convert.sed $< | xsltproc --encoding utf-8 --html convert.xsl - > $@ +all: elberfelder2006.zip menge.zip -elberfelder2006.xml: $(CHAPTERS_XML) - ./concat.sh > $@ +%.xml: %.html convert.sed convert.xsl + ./convert.sed "$<" | xsltproc --encoding utf-8 --html convert.xsl - > "$@" + +elberfelder2006.xml: $(ELBERFELDER_CHAPTERS_XML) + ./concat.sh elberfelder "Elberfelder 2006" > $@ xmllint --noout --schema zef2005.xsd $@ +menge.xml: $(MENGE_CHAPTERS_XML) + ./concat.sh menge "Menge-Bibel2" > $@ + xmllint --noout --schema zef2005.xsd $@ || (mv $@ $@.fail; exit 1) + %.zip: %.xml zip $@ $< clean: - rm -f $(CHAPTERS_XML) - rm -f elberfelder2006.{xml,zip} + rm -f $(ELBERFELDER_CHAPTERS_XML) $(MENGE_CHAPTERS_XML) + rm -f elberfelder2006.{xml,zip} menge.{xml,zip} @@ -1,21 +1,24 @@ #!/bin/sh +translation=$1 +title="$2" + echo '<?xml version="1.0" encoding="UTF-8"?>' -echo '<xmlbible type="x-bible" biblename="Elberfelder 2006" status="v">' +printf '<xmlbible type="x-bible" biblename="%s" status="v">\n' "$title" echo '<information>' -echo '<title>Elberfelder 2006</title>' +echo "<title>${title}</title>" echo '<format>Zefania XML Bible Markup Language</format>' echo '</information>' j=1 -cat book-list | while read buch +cat ${translation}/book-list | while read buch do echo "<biblebook bname=\"$buch\" bnumber=\"$j\">" buchdir=$(echo "$buch" | sed "y/äöü /aou_/") i=1 - while [ -e "chapters/$buchdir/$i.xml" ] + while [ -e "${translation}/chapters/$buchdir/$i.xml" ] do - cat "chapters/$buchdir/$i.xml" | sed 1d + cat "${translation}/chapters/$buchdir/$i.xml" | sed 1d i=$((i+1)) done diff --git a/convert.xsl b/convert.xsl index 3fe6be5..89f0d42 100644 --- a/convert.xsl +++ b/convert.xsl @@ -117,7 +117,7 @@ </xsl:template> <xsl:template match="/"> - <chapter cnumber="{//span[@class='chapter']}"> + <chapter cnumber="{//span[@class='chapter' and text()!='0']}"> <xsl:apply-templates select="//div[@class='markdown']/*" mode="conv"/> </chapter> </xsl:template> diff --git a/download-books.sh b/download-books.sh index 125c29c..f2bca06 100755 --- a/download-books.sh +++ b/download-books.sh @@ -1,17 +1,20 @@ #!/bin/sh -rm -rf books/ -mkdir books -echo -n > book-list +translation=$1 -curl -s http://www.die-bibel.de/online-bibeln/elberfelder-bibel/bibeltext/ | \ +mkdir -p ${translation}/ +rm -rf ${translation}/books/ +mkdir ${translation}/books +echo -n > ${translation}/book-list + +curl -s http://www.die-bibel.de/online-bibeln/${translation}-bibel/bibel/bibeltext/ | \ ./parse-book.sed | \ while read url do read book book=$(echo $book | sed s:/.*$:: ) echo $book - echo $book >> book-list - curl $url > "books/$book" + echo $book >> ${translation}/book-list + curl $url > "${translation}/books/$book" done diff --git a/download-chapters.sh b/download-chapters.sh index 208ceb6..b36039e 100755 --- a/download-chapters.sh +++ b/download-chapters.sh @@ -1,18 +1,20 @@ #!/bin/sh -mkdir -p chapters/ +translation=$1 +mkdir -p ${translation}/chapters/ -cat book-list | while read buch +cat ${translation}/book-list | while read buch do - mkdir -p "chapters/$buch" - ./parse-chapter.sed "books/$buch" | \ + mkdir -p "${translation}/chapters/$buch" + ./parse-chapter.sed "${translation}/books/$buch" | \ while read url do read number echo $url - echo "$buch $number" buchdir=$(echo "$buch" | sed "y/äöü /aou_/") - curl $url > "chapters/$buchdir/$number.html" + echo "$buch $number" + mkdir -p "${translation}/chapters/$buchdir/" + curl -s $url > "${translation}/chapters/$buchdir/$number.html" done done diff --git a/download.sh b/download.sh index 0e80054..57b4528 100755 --- a/download.sh +++ b/download.sh @@ -1,4 +1,4 @@ #!/bin/sh -./download-books.sh -./download-chapters.sh +./download-books.sh $1 +./download-chapters.sh $1 |