[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: patch for the kde-info2html perl script 2nd try
From: Dirk Jagdmann <doj () cubic ! org>
Date: 2004-04-26 13:08:36
Message-ID: 408D09D4.20903 () cubic ! org
[Download RAW message or body]
Hello Developers,
I just send to an old version. This attachment contains my latest patch...
Summary:
I have made two changes to the kde-info2html script.
1) I have improved the link attributes, concerning the displayed text
and the bullet character before the link
2) I have removed the <pre> tags and replaced them with <blockquote> so
the browser can render certain paragraphs better.
My patch is attached to this Email. It was made against the version in
the kdebase 3.2.2 archive.
--
---> doj / cubic
----> http://cubic.org/~doj
-----> http://llg.cubic.org
["kde-info2html.patch" (text/plain)]
--- kde-info2html.old Sun Nov 30 10:42:52 2003
+++ kde-info2html Mon Apr 26 15:01:12 2004
@@ -39,6 +39,9 @@
# March 9 2003 Add support for browsing by file. by Luis Pedro Coelho
# June 11 2003 Update the layout of the sides to the new infopageslayout.
# by Sven Leiber <s.leiber@web.de>
+# 2004-04-26 enhanced the output of links by using •
+# removed the need for text rendered with <pre> by
+# using <blockquote> - Dirk Jagdmann <doj@cubic.org>
#
#-------------------------------------------------------
@@ -402,7 +405,7 @@
if (!defined (@parse_results)) { return $Line; }
my ($MenuLinkTag, $MenuLinkFile, $MenuLinkRef, $MenuLinkText) = @parse_results;
#-- produce a HTML line
- return "<tr class=\"infomenutr\"><td class=\"infomenutd\" \
width=\"30%\"><ul><li><a \
href=\"info:/$MenuLinkFile/$MenuLinkTag\">$MenuLinkRef</a></ul></td><td \
class=\"infomenutd\">$MenuLinkText"; + return "<tr class=\"infomenutr\"><td \
class=\"infomenutd\" width=\"30%\">\• <a \
href=\"info:/$MenuLinkFile/$MenuLinkTag\">$MenuLinkRef</a></td><td \
class=\"infomenutd\">$MenuLinkText"; }
#-------------------------------------------------------------
@@ -522,7 +525,7 @@
}
if ($CrossRef =~ /^([^:]+)::/) { # -- a simple cross ref..
$CrossRefTag = $1;
- $CrossRefText = $';
+ $CrossRefText = $'; # '
$CrossRefRef = $CrossRefTag;
$CrossRefTag =~ s/-NEWLINE-/ /g;
$CrossRefTag =~ s/^\s+//;
@@ -530,8 +533,7 @@
$CrossRefRef =~ s/-NEWLINE-/\n/g;
$CrossRefTag = &Escape($CrossRefTag); # -- escape specials
$BaseInfoFile = &Escape($BaseInfoFile);
- $NewLine .= "<a href=\"info:/$BaseInfoFile/$CrossRefTag\">";
- $NewLine .= "$CrossRefRef</a>$CrossRefText";
+ $NewLine .= "\• <a \
href=\"info:/$BaseInfoFile/$CrossRefTag\">$CrossRefRef</a> $CrossRefText"; next; \
# -- .. take the next one }
if ($CrossRef !~ /$TE/) { # never mind if tag doesn't end on this line
@@ -541,12 +543,12 @@
#print "--- Com. CR : $CrossRef --- \n";
if ($CrossRef =~ /([^:]+):/) { #-- A more complicated one ..
$CrossRefRef = $1;
- $CrossRef = $';
+ $CrossRef = $'; # '
$CrossRefText = $CrossRef;
}
if ($CrossRef =~ /^(\s|\n|-NEWLINE-)*\(($FTAG)\)/) { #-- .. with another file ?
$CrossRefFile = $2;
- $CrossRef = $';
+ $CrossRef = $'; # '
}
$CrossRefTag = $2 if $CrossRef =~ /^(\s|\n|-NEWLINE-)*($TAG)?($TE)/; #-- \
... and a tag ? if ($CrossRefTag eq "" && $CrossRefFile eq "") {
@@ -565,8 +567,14 @@
$CrossRefTag = &Escape($CrossRefTag); #-- escape specials
$CrossRefFile = &Escape($CrossRefFile);
#-- append the HTML text
- $NewLine .= "<a href=\"info:/$CrossRefFile/$CrossRefTag\">";
- $NewLine .= "$CrossRefRef</a>$CrossRefText";
+ $CrossRefText="$CrossRefRef $CrossRefText";
+ my $addtext='';
+ if($CrossRefText =~ /([^\)]+)\)(.+)/)
+ {
+ $CrossRefText=$1;
+ $addtext=" ) $2";
+ }
+ $NewLine .= "\• <a \
href=\"info:/$CrossRefFile/$CrossRefTag\">$CrossRefText</a>$addtext"; }
if ($NewLine =~ /\*Note([^\t\,\.]*)$/i) {
return "$DONTPRINTYET$NewLine";
@@ -782,9 +790,7 @@
my $prev;
my $LineCount = 0;
my $Entries = 0;
- my $Par = 0;
my @ParLines = ();
- my $ParLine=0;
my $MayBeText=0;
my $MayBeTitle=0;
my $Line;
@@ -831,7 +837,7 @@
if (/^\* /) { #-- a menu entry ?
if ($Entries == 0) {
$Entries = 1;
- print "<table class=\"infomenutable\">";
+ print "<table class=\"infomenutable\" width=\"100\%\">";
}
print &MenuItem2HTML($_,$BaseInfoFile);
}
@@ -860,24 +866,24 @@
}
}
else {
- if (/^ *$/) {
- if ($MayBeText == 1) {
- print "<p>$Par</p>"
- } else {
- print "<pre>";
- foreach (@ParLines) {
- print $_;
- }
- print "\n";
- print "</pre>";
- }
+# if empty line
+ if (/^\s*$/) {
+# flush last paragraph
+ # is there something to flush ?
+ if($#ParLines >= 0)
+ {
+ if ($MayBeText == 1) {
+ print "<p>@ParLines</p>";
+ } else {
+ print "<p>", shift @ParLines;
+ print "<blockquote>@ParLines</blockquote></p>";
+ }
+ }
@ParLines = ();
- $ParLine = 1;
$MayBeText = 1;
$MayBeTitle = 1;
- $Par = "";
} else {
- if ($ParLine == 1) {
+ if ($#ParLines == -1) {
if (!/^ {1,4}[^ ]/ || /[^ ] [^ ]/) {
$MayBeText = 0;
}
@@ -899,9 +905,8 @@
$Line =~ s/`([^']*)'/`<span class="option">$1<\/span>'/g; #'
$Line =~ s/((news|ftp|http):\/\/[A-Za-z0-9\.\/\#\-_\~]*)/<a \
href="$1">$1<\/a>/g;
$Line =~ \
s/([A-Za-z0-9\.\/\#\-_\~]*\@[A-Za-z0-9\.\/\#\-_\~]*\.[A-Za-z]{2,3})/<a \
href="mailto:$1">$1<\/a>/g;
- $Par = $Par . $Line;
- $ParLines[$ParLine] = $Line;
- $ParLine++;
+ push(@ParLines, $Line);
+ #push(@ParLines, "<br/>") if $MayBeText==0;
}
}
}
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic