diff Doc/perl/python.perl @ 17429:c2fb2d476bd3 legacy-trunk

When forming the <A> tag for a \seepep or \seerfc, make sure we strip HTML markup from the string used as the title in the TITLE attribute. This fixes formatting in the "What's New in Python 2.1" document.
author Fred Drake <fdrake@acm.org>
date Thu, 12 Apr 2001 04:03:22 +0000
parents 8a2dd97873f2
children 36232f543220
line wrap: on
line diff
--- a/Doc/perl/python.perl	Thu Apr 12 04:01:39 2001 +0000
+++ b/Doc/perl/python.perl	Thu Apr 12 04:03:22 2001 +0000
@@ -1497,6 +1497,14 @@
       . $_;
 }
 
+sub strip_html_markup($){
+    my $str = @_[0];
+    my $s = "$str";
+    $s =~ s/<[a-zA-Z0-9]+(\s+[a-zA-Z0-9]+(\s*=\s*(\'[^\']*\'|\"[^\"]*\"|[a-zA-Z0-9]+))?)*\s*>//g;
+    $s =~ s/<\/[a-zA-Z0-9]+>//g;
+    return $s;
+}
+
 sub handle_rfclike_reference{
     local($_, $what, $format) = @_;
     my $rfcnum = next_argument();
@@ -1504,9 +1512,10 @@
     my $text = next_argument();
     my $url = get_rfc_url($rfcnum, $format);
     my $icon = get_link_icon($url);
+    my $attrtitle = strip_html_markup($title);
     return '<dl compact class="seerfc">'
       . "\n    <dt><a href=\"$url\""
-      . "\n        title=\"$title\""
+      . "\n        title=\"$attrtitle\""
       . "\n        >$what $rfcnum, <em>$title</em>$icon</a>"
       . "\n    <dd>$text\n  </dl>"
       . $_;