jgm / djot

A light markup language
https://djot.net
MIT License
1.71k stars 43 forks source link

Create djot-writer.lua #233

Closed jarnowic closed 1 year ago

jarnowic commented 1 year ago

restoring model custom writer example, with upgrading code snippet.

The current (06/01/2023) documentation link on pandoc's users' guide points to a broken link for an example of a custom writer; while the custom writers link provides a code snippet to upgrade old style custom writers (< v3.0) into new style ones without examples. This file restores the example of an old style custom writer with an incorporated code snippet to upgrade it.

clbarnes commented 1 year ago

How does this relate to the scripts in https://github.com/jgm/djot.lua ? The pandoc end may be what needs updating.

jgm commented 1 year ago

Thanks!

jarnowic commented 1 year ago

How does this relate to the scripts in https://github.com/jgm/djot.lua ? The pandoc end may be what needs updating.

Vaguely related: /djot describes the general aim of the project, and /djot.lua the original lua implementation, which has been superseded by /djot.js; here I simply proposed to restore the upgraded old style writer as the original example of a custom filter in lua. It might help to migrate older markdown files to the new djot format.

jgm commented 1 year ago

Oh, I missed that this was djot and not djot.lua. Well, I don't think this really belongs here. We could think about replacing djot-writer.lua in the jgm/djot.lua repository with this one (which just adds a few things). And then changing the link from the pandoc documentation to point to that repo...

jarnowic commented 1 year ago

Oh, I missed that this was djot and not djot.lua. Well, I don't think this really belongs here. We could think about replacing djot-writer.lua in the jgm/djot.lua repository with this one (which just adds a few things). And then changing the link from the pandoc documentation to point to that repo...

I for once think this is not a good idea: iiuc, djot is a moving target; maybe renaming it to oldjot-writer.lua and placing somewhere in either tree would be enough; but pointing to the right repo in manual.txt would be certainly welcome.

I could make the changes in the proposed places (pandoc/manual.txt and djot.lua/oldjot-writer.lua) when some time is available, and request a new pull when it looks ready. How about that?

jgm commented 1 year ago

Sorry, I don't follow. Which part of what I said isn't a good idea? And which trees do you mean by "either tree"?

jarnowic commented 1 year ago

I meant to say that merging this lua filter with the main djot-writer.lua in /djot.lua seemed to me like a bad idea, for I fear it may break something in the /djot.lua program, and it may continuously fall way behind the upgrades on /jdot.js, which you say is the main development branch.

So I thought renaming this filter (to oldjot-writer.lua for instance) and installing it in any other project (what I meant by "tree", as if each project/branch was a directory tree containing many files), such as /djot would avoid the versioning conflict. In any event, /pandoc/manual.txt needs updating.

My apologies.

jarnowic commented 1 year ago

In fact, I believe that the best place for [ol|sample]djot-writer.lua would be pandoc/data, (i.e. jgm/pandoc/tree/main/data), along with creole.lua, the sample custom reader.