# moreverb.perl by Peter Seiderer 2011-11-26 # # Extension to LaTeX2HTML to support the "moreverb" latex package # # Supported commands: # - \begin{verbatimwrite}{} ... \end{verbatimwrite} # - \begin{listinginput}{}{} ... \end{listinginput} # # Install: # Copy this file to your local 'latex2html/styles' directory, e.g. # for SuSE linux '/usr/share/latex2html/styles/moreverb.perl' # # Change Log: # =========== # 2011-11-26 Version 0.2, Peter Seiderer # * Update for LaTeX2HTML Version 2008 (1.71) (changed # subroutine names from do_env_.. to do_cmd_.. # 2005-11-30 Version 0.1, Peter Seiderer # * Initial version. Based on latex2html/styles/verbatim.perl # and latex2html/styles/verbatimfiles.perl. # package main; # ignore command sub do_cmd_verbatimwrite { "" } # emmit
file content with line number
sub do_cmd_listinginput { local($outer) = @_; local($_,$found,$counter,$file); $counter = &missing_braces unless ( ($outer =~ s/$next_pair_pr_rx/$counter=$2;''/eo) ||($outer =~ s/$next_pair_rx/$counter=$2;''/eo)); $file = &missing_braces unless ( ($outer =~ s/$next_pair_pr_rx/$file=$2;''/eo) ||($outer =~ s/$next_pair_rx/$file=$2;''/eo)); foreach $dir ("$texfilepath", split(/:/,$ENV{'TEXINPUTS'})) { if (-f ($_ = "$dir/$file") || -f ($_ = "$dir/$file2")) { $found=1; #overread $_ with file contents &slurp_input($_); last; } } &write_warnings("No file <$file> for verbatim input.") unless $found; local($closures,$reopens) = &preserve_open_tags; # pre_process file contents if (defined &replace_all_html_special_chars) { &replace_all_html_special_chars; } else { &replace_html_special_chars; } # last vertical space is contributed by already. s/\n$//; # add line numbers s/(^|\n)/$1.sprintf("%4d ",$counter++)/ge; # %verbatim not coupled to a dbm, will not work in subprocesses $verbatim{++$global{'verbatim_counter'}} = $_; my ($verb_pre, $verb_post) = ('
','
'); if ($USING_STYLES) { $env_id .= ' CLASS="verbatim"' unless ($env_id =~ /(^|\s)CLASS\s*\=/i); $verb_pre =~ s/>/ $env_id>/; } join('', $closures, "
\n", $verb_pre , $verbatim_mark, 'verbatim', $global{'verbatim_counter'} , '#', $verb_post, $reopens, $outer); } 1; # Must be last line