summaryrefslogtreecommitdiffstats
path: root/documentation/olinkdb/make-master-olinkdb-from-template.sh
blob: 18405953905640500e6e21be14ff4063398d1240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
VER="R1.10"

OLINKDB_BASEDIR=`dirname $0`

MASTER=${OLINKDB_BASEDIR}/olink-targetdb-master
MASTERTEMPLATE=${MASTER}-template.xml
echo "Outgoing from template: $MASTERTEMPLATE"

#---------------------------
FORMAT=pdf
MASTERFILE=${MASTER}-${FORMAT}.db
echo "Create $MASTERFILE"
cat ${MASTERTEMPLATE} | sed 's/MASTERVAR_BOOKFORMAT/pdf/;s/MASTERVAR_BOOKNAME/pdf/' >${MASTERFILE}

#---------------------------
FORMAT=eclipse
MASTERFILE=${MASTER}-${FORMAT}.db
echo "Create $MASTERFILE"
cat ${MASTERTEMPLATE} | sed 's/MASTERVAR_BOOKFORMAT/eclipse/' | \
    sed '/<dir name="eclipse">/a\
          <dir name="plugins">' | \
    sed 's/<document baseuri="\(book[a-zA-Z\_\-]*[0-9a-zA-Z\_\-]*\)\.MASTERVAR_BOOKNAME"/  <dir name="com.enea.doc.\1">\n              <document/' | \
    sed 's/<\/document>/    <\/document>\n            <\/dir>/' |\
    sed 's/<\/sitemap>/<\/dir>\n<\/sitemap>/' | \
    sed 's/<div href="#[^"]*"/<div href="index.html"/' >${MASTERFILE}

#---------------------------
FORMAT=html
MASTERFILE=${MASTER}-${FORMAT}.db
echo "Create $MASTERFILE"
cat ${MASTERTEMPLATE} | sed 's/MASTERVAR_BOOKFORMAT/html/' | \
    sed 's/<document baseuri="\(book[a-zA-Z\_\-]*[0-9a-zA-Z\_\-]*\)\.MASTERVAR_BOOKNAME"/  <dir name="\1">\n              <document baseuri="index.html" /' | \
    sed 's/<\/document>/    <\/document>\n            <\/dir>/'  >${MASTERFILE}
#---------------------------

echo "   Now: a) Should test if all databases referred to from these files exist."
echo "           Easiest way is to use XMLmind to open the created .db files"
echo "           XMLmind shall be able to open the file, and will show the contents"
echo "           of all database files."
echo "           Do not add ENTITY lines to new book until the databases are created"
echo "           It is still OK that XMLmind says that it is invalid, because it does"
echo "           not understand the xreftext contents!"
echo "           It is also OK with the comments which XMLmind shows in yellow."
echo "               (Keep xreftext anyhow. Actually I think we even could remove"
echo "                all xreftext fields, which I don't think we ever use, because we"
echo "                always provide the display string in olink elements)"
echo ""
echo "        b) Merge the .db files"