[luatex] Adding a callback before trailing spaces are removed from a line of input
Lloyd R. Prentice
lloyd at writersglen.com
Thu Dec 30 02:13:26 CET 2021
Hi Vit,
Many thanks for your insights and ideas. Much to think about.
My most immediate concern is bringing up a working environment on the Dell XPS 13 notebook and Intel NUC that I’m bringing to Mexico to continue work on the book. I’’ll have a few hours tomorrow to work on the Dell. Work on the NUC will have to wait until I’m settled in Mexico mid- or late-next week.
Docker may well be a viable solution. I’ll know better when I’ve had hands-on experience. My mantra is “If you ain’t done it, you don’t know it.”
One valuable outcome of my book, if nothing else, is that it should identify the minimal viable set of LaTeX packages need to serve the needs of book publishers. Would be great to have a tool that parses through book-related *.tex files and returns a list of all required packages.
The LaTeX ecosystem, in my view, is a world treasure. But adoption is hampered by it’s popularity and attempt to be all things to all people. By focusing on book publishing, we may be able to lift hundreds of thousands of indie publishers out of the confinement and limitations of proprietary silos.
Anyway, much to think about and discuss over coming weeks.
Enjoy your New Year festivities.
Lloyd
Sent from my iPad
> On Dec 29, 2021, at 7:12 PM, Vítek Novotný <witiko at mail.muni.cz> wrote:
>
> To give some closure to the thread, support for trailing spaces in
> ConTeXt MkIV and later has just been added to the Markdown package and
> will be published in the 2.12.0 release of the Markdown package:
>
> https://github.com/witiko/markdown/commit/b67ed50
>
> Best,
> Vitek
>
>> On Mon, Aug 30, 2021 at 08:25:25AM +0200, Hans Hagen wrote:
>>> On 8/30/2021 1:34 AM, Vítek Novotný wrote:
>>>
>>> thank you, I had no idea that ConTeXt MkIV funneled all input through
>>> its own line input handler, although I am not surprised. For now, I will
>>
>> it doesn't, all input goes via a file handler and this is just a plugin
>> mechanism into that; it has always been there so that we can deal with mixed
>> input encodings, but i think all users use utf now; these are the oldest bit
>> of code in mkiv (and optimized for low overhead)
>>
>>> apply this solution to the markdown module for ConTeXt in hope that we
>>> can have a format-agnostic solution in the future.
>> This basically uses the file callback so any other solution would be
>> similar. You cannot expect all formats to offer the ssamer interface to
>> callbacks. First of all, context was the first to support callbacks and no
>> other macro packages does it the same way. Then, there is order: macro
>> packagesd can assume actions to be applied in some order so context also
>> enforces that. Finally, most (and some day probably all) callback are
>> protected so one cannot even set one (in context) unless by using the given
>> interface.
>>
>> Anyway, it's not that many lines is it? Of course one could for for:
>>
>> \def\startmarkdown{}
>> \def\stopmarkdown {}
>>
>> \startluacode
>> local markingdown = false
>>
>> function document.markdownize(str)
>> if string.find(str,"\\startmarkdown") then
>> markingdown = true
>> elseif string.find(str,"\\stopmarkdown") then
>> markingdown = false
>> elseif markingdown then
>> str = string.gsub(str," $","\\par")
>> print(str)
>> end
>> return str
>> end
>>
>> resolvers.installinputlinehandler(document.markdownize)
>> \stopluacode
>>
>> \startmarkdown
>> test test
>> test test
>>
>> test test
>> test test
>> \stopmarkdown
>>
>> which in the end is more fragile. I saw the message on the luatex list about
>> the latex way but i'm not going to provide such mechanism (most latex 'ways'
>> don't apply to context I fear.)
>>
>> Thanks,
>>
>> Hans
>>
>> -----------------------------------------------------------------
>> Hans Hagen | PRAGMA ADE
>> Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>> -----------------------------------------------------------------
More information about the luatex
mailing list.