diff options
| author | John MacFarlane <[email protected]> | 2025-07-27 11:17:06 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2025-07-27 11:17:06 -0700 |
| commit | bfbf67ca5daad4d0f04315e5233c748e65082fae (patch) | |
| tree | 2f2aceb9bde2e252c4e7b71713da18103bfeb997 | |
| parent | 8735bc03d8b9da1663f696dc348342c0e424a141 (diff) | |
Org writer: don't wrap link descriptions.
Org doesn't reliable display these as links if they have hard breaks.
Closes #9000.
| -rw-r--r-- | src/Text/Pandoc/Writers/Org.hs | 2 | ||||
| -rw-r--r-- | test/command/9000.md | 14 | ||||
| -rw-r--r-- | test/writer.org | 4 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs index 50fd10cc9..0a1137744 100644 --- a/src/Text/Pandoc/Writers/Org.hs +++ b/src/Text/Pandoc/Writers/Org.hs @@ -547,7 +547,7 @@ inlineToOrg (Link _ txt (src, _)) = case txt of [Str x] | escapeURI x == src -> -- autolink return $ "[[" <> literal (orgPath x) <> "]]" - _ -> do contents <- inlineListToOrg txt + _ -> do contents <- nowrap <$> inlineListToOrg txt return $ "[[" <> literal (orgPath src) <> "][" <> contents <> "]]" inlineToOrg (Image _ _ (source, _)) = return $ "[[" <> literal (orgPath source) <> "]]" diff --git a/test/command/9000.md b/test/command/9000.md new file mode 100644 index 000000000..2c6336394 --- /dev/null +++ b/test/command/9000.md @@ -0,0 +1,14 @@ +``` +% pandoc -t org --wrap=auto --columns=20 +[This is a link with a long description that should not +wrap](http://example.com) and +some regular text after it so we can see how wrapping works. +^D +[[http://example.com][This is a link with a long description that should not wrap]] +and some regular +text after it so we +can see how wrapping +works. + +``` + diff --git a/test/writer.org b/test/writer.org index 48c2080ce..ee081d35d 100644 --- a/test/writer.org +++ b/test/writer.org @@ -571,8 +571,8 @@ a^b c^d, a~b c~d. 'He said, "I want to go."' Were you alive in the 70's? -Here is some quoted '=code=' and a "[[http://example.com/?foo=1&bar=2][quoted -link]]". +Here is some quoted '=code=' and a +"[[http://example.com/?foo=1&bar=2][quoted link]]". Some dashes: one---two --- three---four --- five. |
