1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
--- a/wiki.pl
+++ b/wiki.pl
@@ -9,6 +9,7 @@
# and The Original WikiWikiWeb (C) Ward Cunningham
# <ward@c2.com> (code reused with permission)
# Email and ThinLine options by Jim Mahoney <mahoney@marlboro.edu>
+# BodyOnly option by Christoph Berg <cb@df7cb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,7 +54,7 @@ use vars qw(@RcDays @HtmlPairs @HtmlSing
@IsbnNames @IsbnPre @IsbnPost $EmailFile $FavIcon $RssDays $UserHeader
$UserBody $StartUID $ParseParas $AuthorFooter $UseUpload $AllUpload
$UploadDir $UploadUrl $LimitFileUrl $MaintTrimRc $SearchButton
- $EditNameLink $UseMetaWiki @ImageSites $BracketImg );
+ $EditNameLink $UseMetaWiki @ImageSites $BracketImg $BodyOnly );
# Note: $NotifyDefault is kept because it was a config variable in 0.90
# Other global variables:
use vars qw(%Page %Section %Text %InterSite %SaveUrl %SaveNumUrl
@@ -175,6 +176,7 @@ $SearchButton = 0; # 1 = search but
$EditNameLink = 0; # 1 = edit links use name (CSS), 0 = '?' links
$UseMetaWiki = 0; # 1 = add MetaWiki search links, 0 = no MW links
$BracketImg = 1; # 1 = [url url.gif] becomes image link, 0 = no img
+$BodyOnly = 0; # 1 = output body for template 0 = full HTML output
# Names of sites. (The first entry is used for the number link.)
@IsbnNames = ('bn.com', 'amazon.com', 'search');
@@ -1338,6 +1340,8 @@ sub GetHttpHeader {
my ($type) = @_;
my $cookie;
+ return "" if $BodyOnly;
+
$type = 'text/html' if ($type eq '');
if (defined($SetCookie{'id'})) {
$cookie = "$CookieName="
@@ -1361,6 +1365,8 @@ sub GetHtmlHeader {
my ($title, $id) = @_;
my ($dtd, $html, $bodyExtra, $stylesheet);
+ return "" if $BodyOnly; # omit header
+
$html = '';
$dtd = '-//IETF//DTD HTML//EN';
$html = qq(<!DOCTYPE HTML PUBLIC "$dtd">\n);
@@ -1483,11 +1489,13 @@ sub GetCommonFooter {
if ($FooterNote ne '') {
$html .= T($FooterNote);
}
- $html .= '</div>' . $q->end_html;
+ $html .= '</div>';
+ $html .= $q->end_html unless $BodyOnly;
return $html;
}
sub GetMinimumFooter {
+ return "" if $BodyOnly;
return $q->end_html;
}
--- a/config
+++ b/config
@@ -63,6 +63,7 @@ $ReplaceFile = 'ReplaceFile'; # 0 = di
$TableSyntax = 1; # 1 = wiki syntax tables, 0 = no table syntax
$NewFS = 0; # 1 = new multibyte $FS, 0 = old $FS
$UseUpload = 0; # 1 = allow uploads, 0 = no uploads
+$BodyOnly = 0; # 1 = output body for template 0 = full HTML output
# Minor options:
$LogoLeft = 0; # 1 = logo on left, 0 = logo on right
|