summaryrefslogtreecommitdiff
path: root/help3xsl/get_hid2file.sh
blob: 480572ed66df29a26775b06bc1e369c6f42cfd3f (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
#/bin/bash

# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# $1 is Product Version
# $2 is location of $(WORKDIR)

###########################################
#
# Create the hid2file map that mapd HIDs into
# HTML pages. Language independent.
# will be put in $WORKDIR/HelpTargetHTML/$productversion/
#
###########################################

workDir=$(realpath $2)
productversion=$1

helpFiles=$(realpath $workDir/../helpcontent2/source/text)

mkdir -p $workDir/HelpTargetHTML/$productversion
outDir=$(realpath $workDir/HelpTargetHTML/$productversion)

bookmarkFile=$outDir'/hid2file.js'

tempFile=$(mktemp)
rm -f $bookmarkFile
touch $bookmarkFile

find $helpFiles -type f -name "*.xhp" -exec xsltproc get_url.xsl {} + > $tempFile

echo 'var map={' >> $bookmarkFile
awk 'NF' $tempFile >> $bookmarkFile
echo '};' >> $bookmarkFile
rm -f $tempFile
exit