jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.61k stars 3.38k forks source link

MediaWiki parser and [[file:...] for an image (lower case f) #9424

Closed peterjc closed 9 months ago

peterjc commented 9 months ago

Example MediaWiki snippet tested on https://en.wikipedia.org/

These render the image in-line:

A: [[File:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]

B: [[file:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]

C: [[Image:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]

D: [[Image:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]

These render as links to the image (often used for PDF files):

E: [[Media:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]

F: [[media:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]

Explain the problem. Include the exact command line you used and all inputs necessary to reproduce the issue. Please create as minimal an example as possible, to help the maintainers isolate the problem. Explain the output you received and how it differs from what you expected.

$ echo "
> These render the image in-line:
> 
> A: [[File:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]
> 
> B: [[file:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]
> 
> C: [[Image:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]
> 
> D: [[Image:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]
> 
> These render as links to the image (often used for PDF files):
> 
> E: [[Media:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]
> 
> F: [[media:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png]]
> 
> 
> " | pandoc -f mediawiki -t gfm
These render the image in-line:

A:
![](Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png "Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png")

B:
<file:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png>

C:
![](Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png "Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png")

D:
![](Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png "Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png")

These render as links to the image (often used for PDF files):

E:
[Media:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png](Media:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png "wikilink")

F:
[media:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png](media:Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png "wikilink")

Example B, with file in lower case, failed to be interpreted as an embedded image.

The examples on https://www.mediawiki.org/wiki/Help:Images only use the title-case version, so usage ought to be rarer?

See also #3052

Pandoc version?

Testing on macOS, now using:

$ pandoc --version
pandoc 3.1.3
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /Users/pc40583/.local/share/pandoc
Copyright (C) 2006-2023 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

Was using:

$ pandoc --version
pandoc 2.19.2
Compiled with pandoc-types 1.22.2.1, texmath 0.12.5.2, skylighting 0.13,
citeproc 0.8.0.1, ipynb 0.2, hslua 2.2.1
Scripting engine: Lua 5.4
User data directory: /Users/pc40583/.local/share/pandoc
Copyright (C) 2006-2022 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

(same behaviour)

peterjc commented 9 months ago

Super fast - I did try to work out where the fix would be, but couldn't see how the case was handled. Thank you!