Browse Source

Markdown.pl: isolate the archaic tab default

If running as a plug in for either of the two original systems
that this was designed to "plug in" to, continue to use the
archaic, non-standard default for expansion width of physical
tabs.  This setting does not affect the "indent level" width.

Otherwise, force the physical tab width expansion to default
to the expected and standard value.

This has been the behavior for some time already, except that
when "use"ing Markdown.pm and calling the API directly this
was being bypassed in favor of the old, archaic default.

With this change, the old, archaic default becomes isolated
to those two originally supported systems.

The setting can still, of course, be changed by using an option
to whatever is desired.  The default though will now be more
sane for more clients.

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

9
Markdown.pl

@ -61,13 +61,12 @@ BEGIN {
# #
# Global default settings: # Global default settings:
# #
my ($g_style_prefix, $g_empty_element_suffix, $g_indent_width, $g_tab_width, my ($g_style_prefix, $g_empty_element_suffix, $g_indent_width,
$g_start_p, $g_close_p); $g_start_p, $g_close_p);
BEGIN { BEGIN {
$g_style_prefix = "_markdown-"; # Prefix for markdown css class styles $g_style_prefix = "_markdown-"; # Prefix for markdown css class styles
$g_empty_element_suffix = " />"; # Change to ">" for HTML output $g_empty_element_suffix = " />"; # Change to ">" for HTML output
$g_indent_width = 4; # Number of spaces considered new level $g_indent_width = 4; # Number of spaces considered new level
$g_tab_width = 4; # Legacy even though it's wrong
$g_start_p = "<p>"; # _FormParagraphs open paragraph tag $g_start_p = "<p>"; # _FormParagraphs open paragraph tag
$g_close_p = "</p>"; # _FormParagraphs close paragraph tag $g_close_p = "</p>"; # _FormParagraphs close paragraph tag
} }
@ -280,6 +279,10 @@ if ($_haveMT) {
} }
} }
sub _tabDefault {
return $_haveBX || $_haveMT ? 4 : 8;
}
sub _strip { sub _strip {
my $str = shift; my $str = shift;
defined($str) or return undef; defined($str) or return undef;
@ -1005,7 +1008,7 @@ sub Markdown {
# set initial defaults # set initial defaults
style_prefix => $g_style_prefix, style_prefix => $g_style_prefix,
empty_element_suffix => $g_empty_element_suffix, empty_element_suffix => $g_empty_element_suffix,
tab_width => $g_tab_width, tab_width => _tabDefault,
indent_width => $g_indent_width, indent_width => $g_indent_width,
abs_prefix => "", # Prefixed to absolute path URLs abs_prefix => "", # Prefixed to absolute path URLs
url_prefix => "", # Prefixed to non-absolute URLs url_prefix => "", # Prefixed to non-absolute URLs

Loading…
Cancel
Save