about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xvienna38
1 files changed, 28 insertions, 10 deletions
diff --git a/vienna b/vienna index e192776..e1263ea 100755 --- a/vienna +++ b/vienna
@@ -53,6 +53,8 @@ configure() {
53 PAGE_TEMPLATE="${VIENNA_PAGE_TEMPLATE:-.page.tmpl.html}" 53 PAGE_TEMPLATE="${VIENNA_PAGE_TEMPLATE:-.page.tmpl.html}"
54 INDEX_TEMPLATE="${VIENNA_INDEX_TEMPLATE:-.index.tmpl.html}" 54 INDEX_TEMPLATE="${VIENNA_INDEX_TEMPLATE:-.index.tmpl.html}"
55 FEED_TEMPLATE="${VIENNA_FEED_TEMPLATE:-.feed.tmpl.xml}" 55 FEED_TEMPLATE="${VIENNA_FEED_TEMPLATE:-.feed.tmpl.xml}"
56 # Options
57 PHTML_OPTIONS="${VIENNA_PHTML_OPTIONS:-expand entities}"
56 # File extensions 58 # File extensions
57 PAGE_RAW_EXT="${VIENNA_PAGE_RAW_EXT:-htm}" 59 PAGE_RAW_EXT="${VIENNA_PAGE_RAW_EXT:-htm}"
58 # Logging 60 # Logging
@@ -237,6 +239,7 @@ PLUGINDIR="$PLUGINDIR"
237PAGE_TEMPLATE="$PAGE_TEMPLATE" 239PAGE_TEMPLATE="$PAGE_TEMPLATE"
238INDEX_TEMPLATE="$INDEX_TEMPLATE" 240INDEX_TEMPLATE="$INDEX_TEMPLATE"
239FEED_TEMPLATE="$FEED_TEMPLATE" 241FEED_TEMPLATE="$FEED_TEMPLATE"
242PHTML_OPTIONS="$PHTML_OPTIONS"
240 243
241# Edit this with your web server's file path 244# Edit this with your web server's file path
242WWW_ROOT= 245WWW_ROOT=
@@ -347,15 +350,26 @@ phtml() { # phtml < INPUT
347 # &, <, > will be escaped unless prepended with \. Paragraphs where the 350 # &, <, > will be escaped unless prepended with \. Paragraphs where the
348 # first character is < will be left as-is, excepting indentation on the 351 # first character is < will be left as-is, excepting indentation on the
349 # first line (an implementation detail). 352 # first line (an implementation detail).
350 sed -E \ 353 case "$PHTML_OPTIONS" in
351 '/./{H;1h;$!d;}; x; 354 *entities*)
352 s#^[ \n\t]+[^<].*#&#; 355 _entities='s#([^\\])&#\1\&amp;#g;
353 t par; b; 356 s#([^\\])<#\1\&lt;#g;
354 :par; 357 s#([^\\])>#\1\&gt;#g;
355 s#([^\\])&#\1\&amp;#g; s#\\&#\&#g; 358 s#\\([&<>])#\1#g;'
356 s#([^\\])<#\1\&lt;#g; s#\\<#<#g; 359 ;;
357 s#([^\\])>#\1\&gt;#g; s#\\>#>#g; 360 *) _entities=
358 s#.*#<p>&</p>#' 361 esac
362 sed -E '
363 /./ {H;$!d}; x
364 s#^[ \n\t]+([^<].*)#\1#
365 t par; b end
366 :par
367 '"$_entities"'
368 s#.*#<p>&</p>#
369 :end
370 s#^[ \n\t]+##
371 $!a
372'
359} 373}
360 374
361meta_init() { # meta_init FILE 375meta_init() { # meta_init FILE
@@ -394,7 +408,11 @@ meta() { # meta FIELD [FILE]
394filters() { # filters < INPUT 408filters() { # filters < INPUT
395 ## The filters to run input through. 409 ## The filters to run input through.
396 # This is a good candidate for customization in .vienna.sh. 410 # This is a good candidate for customization in .vienna.sh.
397 phtml 411 phtml |
412 case "$PHTML_OPTIONS" in
413 *expand*) expand ;;
414 *) cat ;;
415 esac
398} 416}
399 417
400### Site building 418### Site building