f27e75a7e3deec195c32ceb66300251a604d608d
[deliverable/titan.core.git] / help / chm_refact.sh
1 #!/bin/bash
2 ###############################################################################
3 # Copyright (c) 2000-2015 Ericsson Telecom AB
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Eclipse Public License v1.0
6 # which accompanies this distribution, and is available at
7 # http://www.eclipse.org/legal/epl-v10.html
8 ###############################################################################
9
10 cd chm
11
12 for i in info/*.html titan_index.html
13 do
14 echo Processing $i
15 if [[ $i = 'info/BNF.html' ]]
16 then
17 sed -e 's|<a href="http://www\.inet\.com/">|<a href="http://www.inet.com/" target="_blank">|g' $i >tmp
18 mv tmp $i
19 elif [[ $i = 'titan_index.html' ]]
20 then
21 sed -e '11,17d;20d' $i >tmp
22 mv tmp $i
23 else
24 line21=$(sed -n -e '21p' $i)
25 if [[ -n $(echo $line21 | grep -e 'ao\.jpg') ]]
26 then echo "$i is 1 (ao)"
27 sed \
28 -e '11,18d' \
29 -e '21d' \
30 $i >tmp
31 mv tmp $i
32 elif [[ -n $(echo $line21 | grep -e 'up\.jpg') ]]
33 then echo "$i is 2 (up)"
34 sed \
35 -e '11,17d' \
36 -e '20d' \
37 $i >tmp
38 mv tmp $i
39 elif [[ -n $(echo $line21 | grep -e '<table border="0" align="right" cellpadding="0" cellspacing="0">') ]]
40 then echo "$i is 3 (table)"
41 sed \
42 -e '11,20d' \
43 -e '23d' \
44 $i >tmp
45 mv tmp $i
46 else echo "$i is ? : $line21"
47 fi
48 fi
49
50 sed \
51 -e 's|\(<a href="\(\.\./info/\)\?BNF\.html[^"]*"\) *target="_blank">|\1>|gI' \
52 -e 's|\(<a href="[a-zA-Z0-9_]*\.html[^"]*"\) *target="_blank">|\1>|gI' \
53 -e '
54 :t
55 /<[aA] [^>]*\.\.\/docs\// {
56 /<\/[aA]>/!{
57 N;
58 bt
59 }
60 s/<[aA] [^>]*\.\.\/docs\/[^>]*>\([^<]*\)<\/[Aa]>/\1/g;
61 }
62 ' \
63 $i >tmp
64 mv tmp $i
65 done
This page took 0.045259 seconds and 5 git commands to generate.