--- /usr/local/lib/perl5/site_perl/5.005/HTML/FromText.pm Wed Oct 6 04:53 :37 1999 +++ FromText.pm Sat Sep 7 16:26:57 2002 @@ -85,6 +85,24 @@ s|\b((?:$protocol):\S+[\w/])|$1|g; } + # PATCH + # NAMED URLS: mark up named URLs of the form [url name]. Do this only + # if urls isn't set. + # Matt Olson June 2nd 2002 + if ($options->{named_urls} and !$options->{urls}) { + s|\[((?: + (?:$protocol) # match a possible protocol + :// # followed by this thing + )? + \S+ # followed by the URL, until a space + ) + \s+ # ignore whitespace + ([^\]]+) # read description text until trailing ] + \] + |$2|xg; + } + # END PATCH + # BOLD: mark up words in *asterisks* as bold. if ($options->{bold}) { s#(^|\s)\*([^*]+)\*(?=\s|$)#$1$2#g; @@ -94,6 +112,31 @@ if ($options->{underline}) { s#(^|\s)_([^_]+?)_(?=\s|$)#$1$2#g; } + + # PATCH + # ITALICS: mark up words between /slashes/ as italicized. + # If underline isn't set, do the same for words in _underscores_. + # Matt Olson, June 1st 2002 + if ($options->{italics}) { + s#(^|\s)/([^/]+?)/(?=\s|$)#$1$2#g; + if (!$options->{underline}) { + s#(^|\s)_([^_]+?)_(?=\s|$)#$1$2#g; + } + } + + # FIXED-WIDTH: mark up words between +plusses+ as fixed-width. + # (Mnemonic: '+' looks like a 't' in + # Matt Olson, June 28th 2002 + if ($options->{fixed_width}) { + s#(^|\s)\+([^\+]+?)\+(?=\s|$)#$1$2#g; + } + + # STRIKE-THROUGH: mark up words between -hyphens- as struck through. + # Matt Olson, June 28th 2002 + if ($options->{strike_through}) { + s#(^|\s)\-([^\-]+?)\-(?=\s|$)#$1$2#g; + } + # END PATCH } return $_[0]; @@ -182,6 +225,17 @@ (?:\s*\n # Either 1 or more blank lines, or |(?=\s*(?:\d+)[.\)\]]?\s+)) # numbered item follows. /x; + # PATCH + # Headers + # Recognize leading #N as a level-N header, and markup *-led paras as + # H4s. + # Matt Olson, 2002 June 3 + } elsif ($options{headers}) { + @paras = split + /(?:\s*\n)+ # (0 or more blank lines, followed by LF) + (?:\s*\n # Either 1 or more blank lines, or + |(?=\s*(?:\#\d|[*-])\s+)) # headered item follows. + /x; } else { @paras = split /\s*\n(?:\s*\n)+ # 1 or more blank lines. @@ -213,6 +267,18 @@ s|^||; s|$||; } + + # PATCH + # HEADERS: mark up paragraphs starting with bullets or #N as headings. + # Matt Olson, 2002 June 3 + elsif ($options{headers} and /^\s*(\#\d|[*-])\s+/) { + my ($level) = ($1 =~ /(\d)/); + $level = 4 unless $level; + string2html($_,\%options); + s/^\s*(?:\#\d|[*-])\s+//; + s/$/<\/H$level>/; + } + # END PATCH # BULLETS: mark up paragraphs starting with bullets as items in an # unnumbered list.