git.iko.soy/typeable/pandoc
on master help sign in
rebase_relative_paths: leave empty paths unchanged.
commit4b16d181e7219ed161a0e03c0c5ee9dec4b526b4 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 27 May 2021, 14:16 (5 years ago) parent0661ce6
4 files changed+8−3
MANUAL.txt+2−2 src/Text/Pandoc/Readers/Markdown.hs+1−1 test/command/3752.md+3 test/command/chap1/text.md+2
MANUAL.txt+2−2
@@ -5081,8 +5081,8 @@ Without this extension, you would have to use
50815081`![image](chap2/spider.jpg)` in `chap2/text.md`. Links with
50825082relative paths will be rewritten in the same way as images.
50835083
5084−Absolute paths and URLs are not changed. Neither are paths
5085−consisting entirely of a fragment, e.g. `[section one](#foo)`.
5084+Absolute paths and URLs are not changed. Neither are empty
5085+paths or paths consisting entirely of a fragment, e.g., `#foo`.
50865086
50875087Note that relative paths in reference links and images will
50885088be rewritten relative to the file containing the link
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -1924,7 +1924,7 @@ rebasePath :: SourcePos -> Text -> Text
19241924rebasePath pos path = do
19251925 let fp = sourceName pos
19261926 isFragment = T.take 1 path == "#"
1927− in if isFragment || isAbsolute (T.unpack path) || isURI path
1927+ in if T.null path || isFragment || isAbsolute (T.unpack path) || isURI path
19281928 then path
19291929 else
19301930 case takeDirectory fp of
test/command/3752.md+3
@@ -20,6 +20,8 @@ Absolute path left alone: absolute.
2020
2121Link to fragment: chapter two.
2222
23+Empty path: empty.
24+
2325Chapter two
2426
2527A spider: [spider]
@@ -36,6 +38,7 @@ A spider: [spider]
3638<p>URL left alone: <a href="https://pandoc.org/MANUAL.html">manual</a>.</p>
3739<p>Absolute path left alone: <a href="/foo/bar/baz.png">absolute</a>.</p>
3840<p>Link to fragment: <a href="#chapter-two">chapter two</a>.</p>
41+<p>Empty path: <a href="">empty</a>.</p>
3942<h1 id="chapter-two">Chapter two</h1>
4043<p>A spider: <img src="command/chap2/spider.png" alt="spider" /></p>
4144```
test/command/chap1/text.md+2
@@ -13,3 +13,5 @@ URL left alone: [manual](https://pandoc.org/MANUAL.html).
1313Absolute path left alone: [absolute](/foo/bar/baz.png).
1414
1515Link to fragment: [chapter two](#chapter-two).
16+
17+Empty path: [empty]().