1### File: htmllist.perl 2### Optional LaTeX2HTML style file 3### Written by Herbert W. Swan <dprhws@edp.Arco.com> 4### Version 0.1, December 22, 1995 5### This is part of the 96.1 release of LaTeX2HTML by Nikos Drakos 6 7## Copyright (C) 1995 by Herbert W. Swan 8## This program is free software; you can redistribute it and/or modify 9## it under the terms of the GNU General Public License as published by 10## the Free Software Foundation; either version 2 of the License, or 11## (at your option) any later version. 12 13## This program is distributed in the hope that it will be useful, 14## but WITHOUT ANY WARRANTY; without even the implied warranty of 15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16## GNU General Public License for more details. 17## You should have received a copy of the GNU General Public License 18## along with this program; if not, write to the Free Software 19## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 21package main; 22# 23# The left-hand entries in this table are mnemonic names that 24# users may place in \htmlitemmark{}. The right-hand entries 25# are the names of the corresponding .gif files, located in 26# the $ICONSERVER directory, which will be inserted for every 27# \item within the "htmllist" environment. 28# 29# This table may be customised at installation. 30# 31# 32%ImageMarks = ( 33 'BlueBall', 'blueball', 34 'RedBall', 'redball', 35 'OrangeBall', 'orangeball', 36 'GreenBall', 'greenball', 37 'PinkBall', 'pinkball', 38 'PurpleBall', 'purpleball', 39 'WhiteBall', 'whiteball', 40 'YellowBall', 'yellowball', 41 ); 42 43%ImageSizeMarks = ( 44 'BlueBall', 'WIDTH="14" HEIGHT="14"', 45 'RedBall', 'WIDTH="14" HEIGHT="14"', 46 'OrangeBall', 'WIDTH="14" HEIGHT="14"', 47 'GreenBall', 'WIDTH="14" HEIGHT="14"', 48 'PinkBall', 'WIDTH="14" HEIGHT="14"', 49 'PurpleBall', 'WIDTH="14" HEIGHT="14"', 50 'WhiteBall', 'WIDTH="14" HEIGHT="14"', 51 'YellowBall', 'WIDTH="14" HEIGHT="14"', 52 ); 53 54# 55# The htmllist environment is equivalent to the description 56# environment in the printed copy, but produces bold descriptions 57# with optional image marks in the HTML version. 58# 59# Example: 60# 61# \begin{htmllist}[WhiteBall] 62# \item[Item 1:] This will have a white ball 63# \item[Item 2:] This will also have a white ball 64# \htmlitemmark{RedBall} 65# \item[Item 3:] This will have a red ball 66# \end{htmllist} 67# 68sub do_env_htmlliststar{ 69 &do_env_htmllist(@_," COMPACT"); 70} 71 72sub set_htmllist_marker { 73 local($icon) = @_; 74 local($ICONSERVER) = ($LOCAL_ICONS ? '' : $ICONSERVER.$dd ); 75 if (!($ImageMarks{$icon})) { 76 print "\nUnknown icon '$icon' for htmllist marker"; 77 &write_warnings("Unknown icon '$icon' for htmllist marker"); 78 return(); 79 } 80 local($mark_size,$imagemark) = $ImageSizeMarks{$icon}; 81 $icon = "$ICONSERVER$ImageMarks{$icon}.$IMAGE_TYPE" if ($ImageMarks{$icon}); 82 $imagemark = '<IMG ' . $mark_size . ' SRC="' . $icon . '" ALT="*">'; 83 $imagemark =~ s/~/~/g; # Allow ~'s in $ICONSERVER 84 # mark as used, in case $LOCAL_ICONS: thanks, Roman E. Pavlov 85 $used_icons{$icon} = 1; 86 $imagemark; 87} 88 89sub do_env_htmllist{ 90 local($_, $compact) = @_; 91 local($bullet,$pat) = &get_next_optional_argument; 92 #RRM - catch nested lists 93 $_ = &translate_environments($_); 94 95 $compact = "" unless $compact; 96 local($imagemark,$mark,$item_len,$desc_len,$mark_len,$mark_size); 97 $imagemark = &set_htmllist_marker($bullet) if ($bullet); 98 99 local($Maxlength) = 99999; 100 local($i,@items_done); 101 print "["; 102 while (1) { 103 print "*"; 104 $item_len = $mark_len = $desc_len = $Maxlength; 105 $desc_len = length($`) if (/$item_description_rx/); 106 $mark_len = length($`) if (/\\htmlitemmark/); 107 $item_len = length($`) if (/\\item$delimiter_rx/); 108 # exit when none of them match 109 last if ($item_len == $Maxlength && $mark_len == $Maxlength 110 && $desc_len == $Maxlength); 111 if ($mark_len < $item_len && $mark_len < $desc_len) { 112 if (/\\htmlitemmark/) { 113 $_ = $&.$'; 114 push(@items_done,&translate_commands($`)); 115 $mark = &missing_braces unless ( 116 (s/\\htmlitemmark$any_next_pair_pr_rx/$mark=$2;''/eom) 117 ||(s/\\htmlitemmark$any_next_pair_rx/$mark=$2;''/eom)); 118 $imagemark = &set_htmllist_marker($mark) if ($mark); 119# $mark_size = $ImageSizeMarks{$mark}; 120# $mark = "$ICONSERVER/$ImageMarks{$2}.gif" if ($ImageMarks{$2}); 121# $imagemark = '<IMG ' . $mark_size . ' SRC="' . $mark . '" ALT="*">'; 122# $imagemark =~ s/~/~/g; # Allow ~'s in $ICONSERVER 123 } 124 } elsif ($item_len < $desc_len) { 125 /\\item$delimiter_rx/; 126 push(@items_done,&translate_commands($`), 127 "<DT>$imagemark\n<DD>$1"); 128 $_=$'; 129 } else { 130 /$item_description_rx\s*($labels_rx8)?\s*/; 131 push(@items_done,&translate_commands($`), 132 "<DT>$imagemark" 133 . (($9)? "<A NAME=\"$9\">\n<B>$1<\/B><\/A>" : "\n<B>$1<\/B>" ) 134 ."\n<DD>"); 135 $_=$'; 136 } 137 } 138 $_ = join('',@items_done, $_); undef @items_done; 139 140 #RRM: cannot have anything before the first <LI> 141 local($savedRS) = $/; $/=''; 142 $_ =~ /<D(T|D)>/s; 143 local($preitems); 144 if ($`) { 145 local($preitems) = $`; $_ = $&.$'; 146 $preitems =~ s/<P( [^>]*)?>//g; 147 $preitems = "\n".$preitems if $preitems; 148 } 149 $/ = $savedRS; 150 151 $_ = '<DT>'.$_ unless (/^\s*<D(D|T)/); 152 print "]"; 153 join('',$preitems,"<DL$compact>", $_, '</DL>'); 154} 155 1561; # This must be the last line 157 158 159 160 161 162 163 164 165 166 167 168