Thank you once more for keeping this going. I made some progress but now there is an error with html-multi-writer.lua itself (log below). I never worked with Lua before, apologies if I am making something dumb.

$ wget https://raw.githubusercontent.com/wlupton/pandoc-lua-logging/main/logging.lua
--2022-11-10 17:28:08--  https://raw.githubusercontent.com/wlupton/pandoc-lua-logging/main/logging.lua
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8173 (8,0K) [text/plain]
Saving to: ‘logging.lua’

logging.lua             100%[==============================>]   7,98K  --.-KB/s    in 0s

2022-11-10 17:28:08 (42,0 MB/s) - ‘logging.lua’ saved [8173/8173]

$ mkdir -p $HOME/.local/share/pandoc/filters
$ mv logging.lua $HOME/.local/share/pandoc/filters
$ export LUA_PATH="$HOME/.local/share/pandoc/filters/?.lua;;"
$ pandoc multi-test.md -t html-multi-writer.lua -o output/multi-test.html
Error running Lua:
html-multi-writer.lua:38: attempt to index a boolean value (local 'utils')
stack traceback:


On Thursday, 10 November 2022 at 13:47:52 UTC+1 wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org wrote:
I've updated the gist by adding utils.lua and updating the README. This should be sufficient for the writer to run without error (please let me know if not).

Note that you'll also need to get logging.lua as described, and also note that any generated YAML files will be empty (I didn't want to share my brain-dead YAML writer but there appear to be lua YAML writers out there that might work... anyway you might decide that you don't need the generated YAML... this depends on how you set up the make rules).

I don't really want to create a repo for this (well... a gist _is_ a repo!) because I don't want (at this point) to provide any support for it (questions are OK though). I'm providing the gist just as a demo of the approach. Maybe later...

On Wed, 9 Nov 2022 at 18:28, William Lupton <wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> wrote:
Oh sorry, yes, utils is one of mine! I'll look into this tomorrow...

On Wed, 9 Nov 2022, 16:03 Luís de Sousa, <luis.a....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Thank you very much for sharing, that looks very promising.

Pandoc can't run the script though, says it can't find the utils package. I installed luarocks and with it lua-utils but the error prevails:

$ pandoc multi-test.md -t html-multi-writer.lua -o output/multi-test.html
Error running Lua:
html-multi-writer.lua:21: module 'utils' not found:
    no field package.preload['utils']
    no file '/usr/local/share/lua/5.4/utils.lua'
    no file '/usr/local/share/lua/5.4/utils/init.lua'
    no file '/usr/local/lib/lua/5.4/utils.lua'
    no file '/usr/local/lib/lua/5.4/utils/init.lua'
    no file './utils.lua'
    no file './utils/init.lua'
    no file '/usr/local/lib/lua/5.4/utils.so'
    no file '/usr/local/lib/lua/5.4/loadall.so'
    no file './utils.so'
stack traceback:
    html-multi-writer.lua:21: in main chunk

P.S.: would you consider creating a repository for this work? I would like to automate the second stage with bash, shouldn't be too hard.

On Monday, 7 November 2022 at 15:46:58 UTC+1 wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org wrote:
I've created this gist: https://gist.github.com/wlupton/2fc23fc1c4e4b4899121bfafc0fea4bf

I added a README.md and hope that there's enough info to get going. Please let me know if not.

(Please note that this writer does some other things too, which might need to be stripped out. Also, it's an old-style writer... I haven't got around to updating it yet,)

On Mon, 7 Nov 2022 at 09:22, Luís de Sousa <luis.a....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi there. That is precisely the kind of output I would like to have. Similar to what tools like mdBook produce. I would be glad if you could share more details on that custom writer.

Thank you and regards.

On Friday, 4 November 2022 at 17:51:24 UTC+1 wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org wrote:
See https://usp.technology/specification for an example of how the Broadband Forum has recently been publishing some specs. This output is generated via an html-multi-writer.lua custom writer that contains the logic for splitting the output into multiple files (based on header level and/or specific classes). The writer also takes care of generating the navigation bar that you see at the top and bottom of the pages. The multiple files are then passed through pandoc again (to add the overall sidebar ToC and the top/bottom navigation bars, and to generate multiple standalone docs).

Please let me know if you'd like more details (the overall setup is not very easily shareable, because it's heavily dependent on rather complicated make rules, but I could probably share the custom writer and give some example command lines.)

On Fri, 4 Nov 2022 at 12:45, Luís de Sousa <luis.a....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Dear all,

I am currently working on a long document that must served as a web page. The single file output is becoming too slow and cumbersome for readers. I am aware this functionality is not available, but a Feature Request is open [0]. 

In that issue there are some hints to this issue being addressable with a template [1]. I have tried many HTML templates, but never seen one that would split a long document in a set of small files. Would there be an example somewhere I could follow? Otherwise, could someone provide a general idea of how such template would function?

Thank you.


--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/264eeee0-68c8-4389-a5c5-12563c6926f6n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1ef6858a-0a37-4f5f-a88b-eff2479a8130n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/539db8b9-47f4-43b8-83d1-4b4c99dc3b3fn%40googlegroups.com.