Browse Source

Markdown.pl: refactor style sheet generation

Create a new "GenerateStyleSheet" function that returns
a copy of the internal fancy style sheet using the given
prefix as a prefix of all the CSS style names.

Use the new "GenerateStyleSheet" function to create the
style sheet as needed.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
master
Kyle J. McKay 4 years ago
parent
commit
5a5deeca72
  1. 19
      Markdown.pl

19
Markdown.pl

@ -437,11 +437,7 @@ HTML4
$out .= "<title>$title</title>\n";
}
}
if ($options{show_styles}) {
my $stylesheet = $g_style_sheet;
$stylesheet =~ s/%\(base\)/$g_style_prefix/g;
$out .= $stylesheet;
}
$out .= GenerateStyleSheet($g_style_prefix) if $options{show_styles};
if ($stub) {
$out .= "</head>\n<body style=\"text-align:center\">\n" .
"<div style=\"display:inline-block;text-align:left;max-width:42pc\">\n";
@ -489,6 +485,19 @@ HTML4
}
# Return a copy of the fancy CSS style sheet that uses the
# passed in prefix as a prefix for the CSS style names.
# If no argument is passed in, use $g_style_prefix
# as the CSS style name prefix.
sub GenerateStyleSheet {
my $prefix = shift;
defined($prefix) or $prefix = $g_style_prefix;
my $stylesheet = $g_style_sheet;
$stylesheet =~ s/%\(base\)/$g_style_prefix/g;
return $stylesheet;
}
sub _xmlcheck {
my $text = shift;
my ($good, $errs);

Loading…
Cancel
Save