From 34efc504b790834e80158f9b6a384ae947ac1b87 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Fri, 7 Aug 2009 21:03:18 +0200 Subject: correctly handle related articles and summary --- make-doc.sh | 23 ++++++++++++++++++++--- 1 file 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 '/

Article summary<\/strong><\/p>/, /

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='

Article summary<\/strong><\/p>' +summary_end_plus_one='

Related articles<\/strong><\/p>' +related_begin='

Related articles<\/strong><\/p>' +related_end_plus_one='

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>#{{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 -- cgit v1.2.3-54-g00ecf