From 1ecc6a0fe502fd2888a25da301b1f241b037702a Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 12 Feb 2021 20:30:32 -0700 Subject: [PATCH] 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 --- Markdown.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Markdown.pl b/Markdown.pl index 6e7bc15..ac90e1c 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -61,13 +61,12 @@ BEGIN { # # 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); BEGIN { $g_style_prefix = "_markdown-"; # Prefix for markdown css class styles $g_empty_element_suffix = " />"; # Change to ">" for HTML output $g_indent_width = 4; # Number of spaces considered new level - $g_tab_width = 4; # Legacy even though it's wrong $g_start_p = "

"; # _FormParagraphs open paragraph tag $g_close_p = "

"; # _FormParagraphs close paragraph tag } @@ -280,6 +279,10 @@ if ($_haveMT) { } } +sub _tabDefault { + return $_haveBX || $_haveMT ? 4 : 8; +} + sub _strip { my $str = shift; defined($str) or return undef; @@ -1005,7 +1008,7 @@ sub Markdown { # set initial defaults style_prefix => $g_style_prefix, empty_element_suffix => $g_empty_element_suffix, - tab_width => $g_tab_width, + tab_width => _tabDefault, indent_width => $g_indent_width, abs_prefix => "", # Prefixed to absolute path URLs url_prefix => "", # Prefixed to non-absolute URLs