Browse Source

Markdown.pl: add --wiki "b" sub-option

Allow spaces to be retained when generating wiki file names
by using the new "b" wiki sub-option.

Sinces spaces are always trimmed (leading and trailing removed
and runs of multiple replaced with a single) before processing
wiki links, multiple consecutive white space characters are
always collapsed to a single space in the final URL.

Since the retained spaces are subject to URL encoding, they
become "%20" in the final URL.

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

19
Markdown.pl

@ -1260,6 +1260,7 @@ sub _wxform {
$w = uc($w) if $o->{u};
$w = lc($w) if $o->{l};
$w =~ s{/+}{%252F}gos if $o->{"%"};
$w =~ s/ +/%20/gos if $o->{b};
$w =~ tr{/}{ } if $o->{f};
$w =~ s{/+}{/}gos if !$o->{f} && !$o->{v};
if ($o->{d}) {
@ -3805,16 +3806,24 @@ I<wikipat> where the default I<wikipat> if none is given is C<%{s(:md)}.html>.
If the given I<wikipat> does not contain a C<%{...}> placeholder sequence
then it will automatically have C<%{s(:md)}.html> suffixed to it.
The C<...> part of the C<%{...}> sequence specifies zero or more case-insensitive
single-letter options with the following effects:
The C<...> part of the C<%{...}> sequence specifies zero or more
case-insensitive single-letter options with the following effects:
=over
=item B<b>
Retain blanks (aka spaces) in the output. They will become C<%20>
in the final URL. Because spaces are always trimmed before processing
wiki links, runs of multiple spaces will be collapsed into a single
space and any leading or trailing spaces will be removed.
=item B<d>
Convert spaces to dashes (ASCII 0x2D) instead of underscore (ASCII 0x5F). Note
that if this option is given then runs of multiple dashes will be converted to
a single dash I<instead> but runs of multiple underscores will be left untouched.
Convert spaces to dashes (ASCII 0x2D) instead of underscore (ASCII
0x5F). Note that if this option is given then runs of multiple
dashes will be converted to a single dash I<instead> but runs of
multiple underscores will be left untouched.
=item B<f>

Loading…
Cancel
Save