Index: Markdown.pl =================================================================== RCS file: /home/stj2/cvs/900/www/bin/Markdown.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Markdown.pl 30 Jul 2004 12:05:30 -0000 1.1 +++ Markdown.pl 3 Aug 2004 10:18:36 -0000 1.2 @@ -57,7 +57,7 @@ my %g_titles; my %g_html_blocks; - +my %g_acronyms; #### Blosxom plug-in interface ########################################## @@ -233,6 +233,7 @@ %g_urls = (); %g_titles = (); %g_html_blocks = (); + %g_acronyms = (); # Standardize line endings: @@ -443,6 +444,8 @@ $text = _DoImages($text); $text = _DoAnchors($text); + # Process acronyms - STJ + $text = _DoAcronyms($text); $text = _DoItalicsAndBold($text); @@ -452,6 +455,26 @@ return $text; } +sub handle_acronym { + my $a = shift || return ''; + my $b = shift || return ''; + + $g_acronyms{$a} = $b; + + return $a; +} + +sub _DoAcronyms { + my $text = shift || return ''; + my $k; + + $text =~ s/([A-Z]+)\((.+?)\)/handle_acronym($1, $2)/esg; + + foreach $k (keys %g_acronyms) { + $text =~ s/([^\w]|^)($k)([^\w]|$)/$1$k<\/acronym>$3/gs; + } + return $text; +} sub _EscapeSpecialChars { my $text = shift || return '';