require 'text_tags.pl'; # Notes # # The hardest part of this library was getting the spacing right. # # # - Some tags have a "whitespace block" and some tags don't. For example, # ..,
..
, <[oud]l>..,

,


# has a blank line before and after the tags #
is replaced with a single blank line.. # .. .. .. have 0 or more spaces on either side.. # # Rules for HTML spacing... # 0. The following returns do not apply for anything inside a
 block.
# Excessive returns are allowed in 
 and other html tags are
# supported in 
...
# 1. At most, the largest "whitespace block" will be two returns (\n\n)
# 2. Multiple whitespace characters will be collapsed into a single space,
# unless it is the beginning of a line

require 'shellwords.pl' unless(defined &shellwords);
# I saw a nasty HTML deviation that shellwords won't parse.  it was:
#  ... no space between " and href

package w3bbc_html;

%html_tag_ignore = (
'head',1,
'html',1,
'body',1,
);

%html_tags_block = (
'a',       "'html_tag_a",
'b',       "'html_tag_em",
'i',       "'html_tag_em",
'em',      "'html_tag_em", # map to italic
'cite',    "'html_tag_em", # map to italic
'strong',  "'html_tag_em", # map to bold
'dfn',     "'html_tag_em", # map to bold
'h1',      "'html_tag_h",
'h2',      "'html_tag_h",
'h3',      "'html_tag_h",
'h4',      "'html_tag_h",
'h5',      "'html_tag_h",
'h6',      "'html_tag_h",
'pre',     "'html_tag_pre",
'title',   "'html_tag_title",
);

%html_tags_single = (
'img',     "'html_tag_img",
'isindex', "'html_tag_isindex",
);

%text_tag_ignore = (
'head',1,
'html',1,
'body',1,
);

%text_tags_block = (
'a',       'text_tag_a',
'b',       'text_tag_em',
'i',       'text_tag_em',
'em',      'text_tag_em', # map to italic
'cite',    'text_tag_em', # map to italic
'strong',  'text_tag_em', # map to bold
'dfn',     'text_tag_em', # map to bold
'ul',      'text_tag_list',
'ol',      'text_tag_list',
'dl',      'text_tag_list',
'menu',    'text_tag_list',
'dir',     'text_tag_list',
'address', 'text_tag_address',
'h1',      'text_tag_h',
'h2',      'text_tag_h',
'h3',      'text_tag_h',
'h4',      'text_tag_h',
'h5',      'text_tag_h',
'h6',      'text_tag_h',
'pre',     'text_tag_pre',
);

%text_tags_single = (
'img',     'text_tag_img',
'p',       'text_tag_p',
'br',      'text_tag_br',
'hr',      'text_tag_hr',
# These should be with