Commit ec249364 authored by Benjamin Koch's avatar Benjamin Koch
Browse files

clean up

parent 135851f9
......@@ -12,16 +12,18 @@ Ich denke, es versteht sich von selbst, dass wir nicht eigenmächtig Komponenten
EOF
# 1. convert syntax for bold text
# 2. convert external links: [http://blub abc] -> [[http://blub|abc]]
# 3. remove <font> tags
# 1. convert image links and make them absolute; the 'HASH' part will be replaced later
# 2a. remove some markup in headings
# 2b. convert syntax for bold text
# 2c. convert external links: [http://blub abc] -> [[http://blub|abc]]
# 2d. remove <font> tags
# 3. convert tables
# 4. replace 'HASH' part of image urls
# 5a. change all '==' headings to level 1 headings in DokuWiki
# (We don't have any other headings in this document.)
# 5b. Add a space after the download link.
sed -e 's/\[\[image:\([^|]*\)\(|[^|]*\?\)\?\]\]/{{http:\/\/www.seeedstudio.com\/wiki\/images\/HASH\/\1}}/g' | \
sed -e "s/\(=\+\s*\)'''\(.*\?\)'''\(\s*=\+\)/\1\2\3/g" -e "s/'''\(.*\?\)'''/**\1**/g" -e "s/\[\([^\[]\S*\)\s\+\(.*\?\)\]/[[\1|\2]]/g" -e "s/<\/\?font[^>]*>//g" | \
sed -e '/^{|/,/^|}/ { /^{|/ s/.*// ; s/^!/^ / ; /^[|^]\([^-}]\|$\)/ { s/^|[^[]*|/|/ ; H ; d } ; /^|-\|^|}/ { x ; s/\n/ /g ; s/\s*\^/^/ ; s/^|.\s*// ; s/^\s*\([|^]\).*$/\0 \1/ } }' |\
awk '{ if (match($0, /HASH\/([^}]+)/, a)) { printf "%s", substr($0, 0, RSTART-1) ; system("echo -n \"" a[1] "\" | md5sum | awk \"{printf \\\"%s/%s/\\\", substr(\\$0, 0, 1), substr(\\$0, 0, 2)}\"") ; print a[1] substr($0, RSTART+RLENGTH) } else {print $0}}' | \
sed -e 's/==\s*[^=]\+\s*==/====\0====/' -e 's/\*\*for download/** for download/'
#awk '{ if (match($0, /HASH\/([^}]+)/, a)) { print substr($0, 0, RSTART-1) "abc" a[1] "xxx" substr($0, RSTART+RLENGTH) } else {print $0}}'
#http://www.seeedstudio.com/wiki/images/0/0f/0100020P1.jpg
#echo -n "0100020P1.jpg"|md5sum|awk '{print substr($0, 0, 1) "/" substr($0, 0, 2) "/"}'
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment