mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-30 17:59:17 +08:00
Dokuwiki writer: remove automatic ':' prefix before internal image links (#5183)
* FIX #5183 : remove automatic ':' prefix before internal image links `` should be converted to `{{foo.png}}` (relative path) ` Therefore the ':' prefix is useless and must be removed. It blocks users from making relative image links. Update tests for DokuWiki Writer : external images
This commit is contained in:
committed by
John MacFarlane
parent
2f92261d87
commit
814e97df92
@@ -130,9 +130,7 @@ blockToDokuWiki opts (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
|
||||
let opt = if null txt
|
||||
then ""
|
||||
else "|" ++ if null tit then capt else tit ++ capt
|
||||
-- Relative links fail isURI and receive a colon
|
||||
prefix = if isURI src then "" else ":"
|
||||
return $ "{{" ++ prefix ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
|
||||
return $ "{{" ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
|
||||
|
||||
blockToDokuWiki opts (Para inlines) = do
|
||||
indent <- asks stIndent
|
||||
@@ -516,9 +514,7 @@ inlineToDokuWiki opts (Image attr alt (source, tit)) = do
|
||||
("", []) -> ""
|
||||
("", _ ) -> "|" ++ alt'
|
||||
(_ , _ ) -> "|" ++ tit
|
||||
-- Relative links fail isURI and receive a colon
|
||||
prefix = if isURI source then "" else ":"
|
||||
return $ "{{" ++ prefix ++ source ++ imageDims opts attr ++ txt ++ "}}"
|
||||
return $ "{{" ++ source ++ imageDims opts attr ++ txt ++ "}}"
|
||||
|
||||
inlineToDokuWiki opts (Note contents) = do
|
||||
contents' <- blockListToDokuWiki opts contents
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{https://cooluri.com/image.png|HTTPS image}} {{http://cooluri.com/image.png|HTTP image}} {{ftp://ftp.cooluri.com/image.png|FTP image}} {{file:///tmp/coolimage.png|Filesystem image}} {{:/image.jpg|Relative image 1}} {{:image.jpg|Relative image 2}}
|
||||
{{https://cooluri.com/image.png|HTTPS image}} {{http://cooluri.com/image.png|HTTP image}} {{ftp://ftp.cooluri.com/image.png|FTP image}} {{file:///tmp/coolimage.png|Filesystem image}} {{/image.jpg|Relative image 1}} {{image.jpg|Relative image 2}}
|
||||
|
||||
@@ -609,9 +609,9 @@ or here: <http://example.com/>
|
||||
|
||||
From “Voyage dans la Lune” by Georges Melies (1902):
|
||||
|
||||
{{:lalune.jpg|Voyage dans la Lune lalune}}
|
||||
{{lalune.jpg|Voyage dans la Lune lalune}}
|
||||
|
||||
Here is a movie {{:movie.jpg|movie}} icon.
|
||||
Here is a movie {{movie.jpg|movie}} icon.
|
||||
|
||||
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user