jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.5k stars 3.37k forks source link

Org Mode export to Dokuwiki with R Source Code Block drops language name #6807

Closed RyanGreenup closed 3 years ago

RyanGreenup commented 3 years ago

When exporting org-mode with an R source code block, the output for for dokuwiki should be <code rsplus> but instead it's empty, this does however work for other languages. This should be changed to include the correct language.

Here's a minimum working example:

#+begin_src python
print(3)
#+end_src

#+begin_src R
print(3)
#+end_src

Then running pandoc -f org -t dokuwiki the output given is this:

<code python>
print(3)

</code>
<code>
print(3)

</code>

It would be better if the output was:

<code python>
print(3)
</code>

<code rsplus>
print(3)
</code>
Pandoc Version

pandoc 2.11
Compiled with pandoc-types 1.22, texmath 0.12.0.3, skylighting 0.10
Default user data directory: /home/ryan/.local/share/pandoc or /home/ryan/.pandoc
Copyright (C) 2006-2020 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.

jgm commented 3 years ago

On l. 149 of the dokuwiki writer there's a list of languages that dokuwiki accepts. This may need updating? rsplus isn't on it, and anyway we'd need some map of correspondences so that r would go to rsplus (if that's the right thing). A pointer to relevant R documentation would be helpful.

RyanGreenup commented 3 years ago

Dokuwiki implements GeSHi, which seems to be the only syntax highlighter that uses the name rsplus, I can see why but it took me a while to figure out.

jgm commented 3 years ago

So, what we need to improve the code is a map of correspondences between pandoc language names (--list-highlight-languages) and geshi names. If you can supply this map, I can insert it into the code.

RyanGreenup commented 3 years ago

I'm not very familiar with PHP, but this Dokuwiki page suggests to me that the approach taken by Dokuwiki is to simply use the script name from the Geshi Source here, can somebody check this seems right?

If that is indeed the case here is a list of corresponding values from pandoc --list-highlight-languages, to the values listed on this link here, again can somebody check that seems right?

Notes on Differences

- Pandoc only contains `bibtex` where as GeShi contains both `bibtex` and `biblatex`. - Dokuwiki will only Syntax highlight ******C\#****** if it uses the tag `csharp`, which is corresponds to `csharp.php` in the repository I linked to, where as pandoc uses `cs`, this is much like ******R****** and `rsplus`. - `coffee` is called `coffeescript` - Pandoc only has `commonlisp` where as `Geshi` has `lisp` and `newlisp` - Pandoc only has `html` whereas Dokuwiki has `html5` and `html4script` - There is no `json` in GeShi, consider just using `javascript` for convenience.? - Geshi only has `javascript` so consider mapping `javascriptreact` to `javascript`? - Geshi has `java` and `java5`, so probably just use `java`. - Typescript is not included in GesShi, Consider mapping from `typescript` to `javascript`? - Geshi Does not have `literatehaskell`, consider mapping to `haskell`? - Geshi has `make` and `cmake`, presumably the Pandoc `makefile` corresponds to the Dokuwiki `make`. - Pandoc has `r` but Geshi has `rsplus` - It's worth noting that even though MediaWiki has [moved on from GeShi to Pygments](https://www.mediawiki.org/wiki/Extension:SyntaxHighlight#Supported_languages) it also supports `r`, `R` or `rsplus` - sqlmysql -\> `mysql` - sqlpostgresql -\> postgresql - Zsh is not included in Geshi, consider mapping from `zsh` to `bash`? - Pandoc has `sci` but Geshi has `scilab`, I've assumed that there are identical but I'm not certain. - Pandoc has `xorg` but Geshi has `xorg_conf`, presumably Pandoc refers to the x config file.

Table of language Tags

The value in the Geshi Column is the basename of the corresponding `php` file from [the source here](https://github.com/GeSHi/geshi-1.0/tree/master/src/geshi), entries corresponding to notes have been emboldened | Pandoc | Geshi | |---------------------|---------------------| | abc | | | asn1 | | | asp | asp | | ats | | | awk | awk | | actionscript | actionscript | | ada | ada | | agda | | | alertindent | | | apache | apache | | bash | bash | | **bibtex** | bibtex | | boo | boo | | c | c | | **cs** | csharp | | cpp | cpp | | cmake | cmake | | css | css | | changelog | | | clojure | clojure | | **coffee** | cofeescript | | coldfusion | | | **commonlisp** | lisp | | curry | | | d | d | | dtd | | | default | | | diff | diff | | djangotemplate | | | dockerfile | | | doxygen | | | doxygenlua | | | eiffel | eiffel | | elixir | | | elm | | | email | email | | erlang | erlang | | fsharp | fsharp | | fortran | fortran | | gcc | | | glsl | glsl | | gnuassembler | | | m4 | | | go | go | | **html** | html5 | | hamlet | | | haskell | haskell | | haxe | haxe | | ini | ini | | isocpp | | | idris | | | fasm | | | nasm | | | j | j | | **json** | | | jsp | | | java | java | | **javascript** | javascript | | **javascriptreact** | | | javadoc | | | julia | julia | | kotlin | kotlin | | llvm | llvm | | latex | latex | | lex | | | lilypond | | | literatecurry | | | **literatehaskell** | | | lua | lua | | mips | | | **makefile** | make | | markdown | | | mathematica | mathematica | | matlab | matlab | | maxima | | | mediawiki | | | metafont | | | modelines | | | modula2 | modula2 | | modula3 | modula3 | | monobasic | | | mustache | | | ocaml | ocaml | | objectivec | objc | | objectivecpp | | | octave | octave | | opencl | | | php | php | | povray | povray | | pascal | pascal | | perl | perl | | pike | pike | | postscript | postscript | | powershell | powershell | | prolog | prolog | | protobuf | | | pure | | | purebasic | purebasic | | python | python | | qml | qml | | **r** | rsplus | | relaxng | | | relaxngcompact | | | roff | roff | | ruby | ruby | | rhtml | | | rust | rust | | sgml | | | sml | | | sql | sql | | **sqlmysql** | mysql | | sqlpostgresql | postgresql | | scala | scala | | scheme | scheme | | stata | | | tcl | tcl | | tcsh | | | texinfo | | | mandoc | | | **typescript** | | | vhdl | vhdl | | verilog | verilog | | xml | xml | | xul | | | yaml | yaml | | yacc | | | **zsh** | | | dot | dot | | noweb | | | rest | | | **sci** | scilab | | sed | | | **xorg** | xorgconf | | xslt | |