summaryrefslogtreecommitdiff
path: root/make-doc.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-08-07 21:03:18 +0200
committerDieter Plaetinck <dieter@plaetinck.be>2009-08-07 21:03:18 +0200
commit34efc504b790834e80158f9b6a384ae947ac1b87 (patch)
tree09c7f0641154fdf883d7f276c9580d0a77237908 /make-doc.sh
parente3356452586b0d526f06d661d445c5abf06bb0aa (diff)
correctly handle related articles and summary
Diffstat (limited to 'make-doc.sh')
-rwxr-xr-xmake-doc.sh23
1 files changed, 20 insertions, 3 deletions
diff --git a/make-doc.sh b/make-doc.sh
index c74ab81..c5a3b80 100755
--- a/make-doc.sh
+++ b/make-doc.sh
@@ -19,11 +19,28 @@ echo "adding special wiki thingies..."
i=doc/official_installation_guide_en
echo $i
-summary=`sed -n '/<p><strong>Article summary<\/strong><\/p>/, /<p><strong>Related articles<\/strong><\/p>/ p' $i.html | grep -v 'strong'` #TODO strip html tags from summary? (maybe parse from markdown instead). this does not render on the wiki!
+
+
+summary_begin='<p><strong>Article summary<\/strong><\/p>'
+summary_end_plus_one='<p><strong>Related articles<\/strong><\/p>'
+related_begin='<p><strong>Related articles<\/strong><\/p>'
+related_end_plus_one='<h1>Introduction<\/h1>'
+
+summary=`sed -n "/$summary_begin/, /$summary_end_plus_one/p;" $i.html | sed "/$summary_begin/d; /$summary_end_plus_one/d"` #TODO strip html tags from summary? (maybe parse from markdown instead). this does not render on the wiki!
+related=`sed -n "/$related_begin/, /$related_end_plus_one/p;" $i.html | sed "/$related_begin/d; /$related_end_plus_one/d"`
+
+# prepare for wikiing.
+# note that like this we always keep the absulolute url's even if they are on the same subdomain eg: {{Article summary wiki|http://foo/bar bar}} (note).
+# wiki renders absolute url a bit uglier. always having absolute url's is not needed if the page can be looked up on the same wiki, but like this it was simplest to implement..
+related=`echo "$related"| sed -e 's#<p>\[\(.*\)\] \(.*\)<\/p>#{{Article summary wiki|\1}} \2#'`
echo -e "[[Category:Getting and installing Arch (English)]]\n[[Category:HOWTOs (English)]]\n
{{Article summary start}}\n{{Article summary text| 1=$summary}}\n{{Article summary heading|Available Languages}}\n
{{i18n_entry|English|Official Arch Linux Install Guide}}\n
-{{Article summary heading|Related articles}}\n
-{{Article summary wiki|Beginners Guide}} (If you are new to Arch)\n
+{{Article summary heading|Related articles}}
+$related
{{Article summary end}}" | cat - $i.html > $i.html.tmp && mv $i.html.tmp $i.html
+
+# remove summary and related articles from actual content
+sed "/$summary_end_plus_one/p; /$summary_begin/, /$summary_end_plus_one/d" $i.html > $i.html.tmp && mv $i.html.tmp $i.html
+sed "/$related_end_plus_one/p; /$related_begin/, /$related_end_plus_one/d" $i.html > $i.html.tmp && mv $i.html.tmp $i.html