]> granicus.if.org Git - python/commitdiff
Add corresponding support for the alltt environment to the HTML generator.
authorFred Drake <fdrake@acm.org>
Tue, 10 Apr 2001 17:13:39 +0000 (17:13 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 10 Apr 2001 17:13:39 +0000 (17:13 +0000)
Doc/perl/howto.perl
Doc/perl/manual.perl
Doc/perl/python.perl

index 42f722fb08630c112f4969d9be1c7523f5c0d627..76791ebb232962abecf88f9983b3670c7b9bc081 100644 (file)
@@ -6,7 +6,7 @@
 package main;
 
 do_require_package("article");
-#do_require_package("verbatim");
+do_require_package("alltt");
 do_require_package("python");
 
 1;                             # sheesh....
index b1de916de59ba6779a391d09daeb999b0853e0fd..ea65b36e748b6b81d9aac6b6752ba045045c66b1 100644 (file)
@@ -9,7 +9,7 @@
 package main;
 
 do_require_package("report");
-#do_require_package("verbatim");
+do_require_package("alltt");
 do_require_package("python");
 
 1;                             # sheesh....
index a0cd5075d6c3f020d2922f20f0cc57140a9cc274..98a1dcf499ba331fb8500cb665c5d08d1d41b013 100644 (file)
@@ -1593,4 +1593,50 @@ withsubitem # {} # {}
 _RAW_ARG_DEFERRED_CMDS_
 
 
+$alltt_start = '<dl><dd><pre class="verbatim">';
+$alltt_end = '</pre></dl>';
+
+sub do_env_alltt {
+    local ($_) = @_;
+    local($closures,$reopens,@open_block_tags);
+
+    # get the tag-strings for all open tags
+    local(@keep_open_tags) = @$open_tags_R;
+    ($closures,$reopens) = &preserve_open_tags() if (@$open_tags_R);
+
+    # get the tags for text-level tags only
+    $open_tags_R = [ @keep_open_tags ];
+    local($local_closures, $local_reopens);
+    ($local_closures, $local_reopens,@open_block_tags)
+      = &preserve_open_block_tags
+       if (@$open_tags_R);
+
+    $open_tags_R = [ @open_block_tags ];
+
+    do {
+       local($open_tags_R) = [ @open_block_tags ];
+       local(@save_open_tags) = ();
+
+       local($cnt) = ++$global{'max_id'};
+       $_ = join('',"$O$cnt$C\\tt$O", ++$global{'max_id'}, $C
+               , $_ , $O, $global{'max_id'}, "$C$O$cnt$C");
+
+       $_ = &translate_environments($_);
+       $_ = &translate_commands($_) if (/\\/);
+
+       # preserve space-runs, using &nbsp;
+       while (s/(\S) ( +)/$1$2;SPMnbsp;/g){};
+       s/(<BR>) /$1;SPMnbsp;/g;
+
+       $_ = join('', $closures, $alltt_start, $local_reopens
+               , $_
+               , &balance_tags() #, $local_closures
+               , $alltt_end, $reopens);
+       undef $open_tags_R; undef @save_open_tags;
+    };
+    $open_tags_R = [ @keep_open_tags ];
+    $_;
+}
+
+
 1;                             # This must be the last line