root/bin/redmine_synonyms @ 7438
1 |
#!/bin/sh
|
---|---|
2 |
# Translates a Redmine HTML page to a thesaurus
|
3 |
# Usage: self <page
|
4 |
|
5 |
sedEreFlag="$(test "$(uname)" = Darwin && echo E || echo r)" |
6 |
|
7 |
sed () { "$(which sed)" -"$sedEreFlag" "$@";} |
8 |
|
9 |
term= |
10 |
sed -n 's/^.*<h([1-3])[^>]*><a href="#[^>]+>([^<]+).*$/\1 \2/p'\ |
11 |
|while read -r line; do |
12 |
set -- $line # split using IFS |
13 |
level="$1" name="$2" |
14 |
if test "$level" = 3; then echo "$name $term" |
15 |
else term="$name" |
16 |
fi
|
17 |
done
|