public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: "'William Lupton' via pandoc-discuss" <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Multiple HTML file (chunked) output with template
Date: Fri, 11 Nov 2022 14:30:01 +0000	[thread overview]
Message-ID: <CAEe_xxjk4tfW2iyU1=rikSnmTWN6kDGYneGcqYc2_1WdReSqUw@mail.gmail.com> (raw)
In-Reply-To: <5e290d88-1c47-407d-819b-34a094d8b48fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 14396 bytes --]

Inline...

On Fri, 11 Nov 2022 at 14:01, Luís de Sousa <luis.a.de.sousa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:

> Alright, it is working now, many thanks. The output HTML looks pretty
> solid and well linked. Two questions:


Great!

1. What is the purpose of the /dev/null bit in the second compile command?
>

That's what this remark in the README is referring to (rather obliquely):

> Including the HTML via --include-in-header was a workaround I think, and
might no longer be necessary.

I think there was a problem with parsing HTML at one point, and this was a
way of injecting HTML without passing it through pandoc.


> 2. Could you share an HTML template? It would greatly facilitate the
> design work.
>

I've added github-template.html
<https://gist.github.com/wlupton/2fc23fc1c4e4b4899121bfafc0fea4bf#file-github-template-html>
(somewhat
anonymised) to the gist.

Next I will give it a try with a more elaborate document including
> cross-references, citations, etc. Will report back on that.
>

You'll probably have noted that the writer attempts to fix cross-references
so they reference the correct output file.

Regards.
>
> On Friday, 11 November 2022 at 13:58:28 UTC+1 wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org
> wrote:
>
>> Oh, I'm so sorry! I hadn't tested exactly what I gave you (I'd put the
>> contents of utils.lua into the writer for testing, but then put it into a
>> new file to share with you, so the writer didn't need to change), but I
>> forgot to put 'return utils' at the bottom.
>>
>> I've now added this line:
>> https://gist.github.com/wlupton/2fc23fc1c4e4b4899121bfafc0fea4bf#file-utils-lua-L51
>> and this time I've tested it locally. Please try again.
>>
>> On Fri, 11 Nov 2022 at 12:33, Luís de Sousa <luis.a....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>>> Hello again. I confirm those are the contents in line 38. I assume
>>> utils.lua is being found, line 21 is now being  parsed without error.
>>> Anything else I can try?
>>>
>>> Thank you.
>>>
>>> On Thursday, 10 November 2022 at 18:06:06 UTC+1
>>> wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org wrote:
>>>
>>>> can you confirm what's in line 38 of the writer? if you haven't edited
>>>> the file then it's this
>>>> <https://gist.github.com/wlupton/2fc23fc1c4e4b4899121bfafc0fea4bf#file-html-multi-writer-lua-L38>
>>>> :
>>>>
>>>> local output_file_dir, output_file_base = utils.path.split(output_file)
>>>>
>>>> can you confirm that you've also copied utils.lua and that it's being
>>>> found? it should be calling the function at this line:
>>>> https://gist.github.com/wlupton/2fc23fc1c4e4b4899121bfafc0fea4bf#file-utils-lua-L31
>>>>
>>>>
>>>> On Thu, 10 Nov 2022 at 16:36, Luís de Sousa <luis.a....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>>> wrote:
>>>>
>>>>> 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....@gmail.com>
>>>>>>>>> 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....@gmail.com>
>>>>>>>>>>> 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.
>>>>>>>>>>>>
>>>>>>>>>>>> [0] https://github.com/jgm/pandoc/issues/6122
>>>>>>>>>>>>
>>>>>>>>>>>> [1]
>>>>>>>>>>>> https://github.com/jgm/pandoc/issues/6122#issuecomment-583593340
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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
>>>>>>>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/264eeee0-68c8-4389-a5c5-12563c6926f6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>>>> .
>>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>> 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>>>>>>>>>
>>>>>>>>> To view this discussion on the web visit
>>>>>>>>>> https://groups.google.com/d/msgid/pandoc-discuss/cb3753d7-e845-4a72-a1aa-e93086a32f11n%40googlegroups.com
>>>>>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/cb3753d7-e845-4a72-a1aa-e93086a32f11n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>> .
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>> 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/pandoc-discuss/1ef6858a-0a37-4f5f-a88b-eff2479a8130n%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/1ef6858a-0a37-4f5f-a88b-eff2479a8130n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>> 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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
>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/539db8b9-47f4-43b8-83d1-4b4c99dc3b3fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/pandoc-discuss/7f4b28ec-1e91-4228-ab03-fe58a2e5cf18n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/7f4b28ec-1e91-4228-ab03-fe58a2e5cf18n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/5e290d88-1c47-407d-819b-34a094d8b48fn%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/5e290d88-1c47-407d-819b-34a094d8b48fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjk4tfW2iyU1%3DrikSnmTWN6kDGYneGcqYc2_1WdReSqUw%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 20365 bytes --]

  parent reply	other threads:[~2022-11-11 14:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 12:45 Luís de Sousa
     [not found] ` <264eeee0-68c8-4389-a5c5-12563c6926f6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-04 16:51   ` 'William Lupton' via pandoc-discuss
     [not found]     ` <CAEe_xxhS3ePa-k7boYMGzHnOsaNPCi4=nH-N8j7yLP8PAE6RCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-07  9:22       ` Luís de Sousa
     [not found]         ` <cb3753d7-e845-4a72-a1aa-e93086a32f11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-07 14:46           ` 'William Lupton' via pandoc-discuss
     [not found]             ` <CAEe_xxj6Bht_r9A9ngmpYyseaOjeifv-ONFgZ8quUd6rONTC_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-09 16:03               ` Luís de Sousa
     [not found]                 ` <1ef6858a-0a37-4f5f-a88b-eff2479a8130n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-09 18:28                   ` 'William Lupton' via pandoc-discuss
     [not found]                     ` <CAEe_xxjtN8XAhYgOti=uKZ1Pk-h4YtM5xk96s5283oS0rgfD9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-10 12:47                       ` 'William Lupton' via pandoc-discuss
     [not found]                         ` <CAEe_xxiri0e6LHPZdxkjazM8nFU4cuA2FLL3UZ71-w4ro3WvYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-10 16:36                           ` Luís de Sousa
     [not found]                             ` <539db8b9-47f4-43b8-83d1-4b4c99dc3b3fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-10 17:05                               ` 'William Lupton' via pandoc-discuss
     [not found]                                 ` <CAEe_xxiUW_GbEf3_uEaW4wyOGG6Um-=Soukd-VonV9HdGCv30g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-11 12:33                                   ` Luís de Sousa
     [not found]                                     ` <7f4b28ec-1e91-4228-ab03-fe58a2e5cf18n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-11 12:58                                       ` 'William Lupton' via pandoc-discuss
     [not found]                                         ` <CAEe_xxh--=VrfpuU75HDuSe1uLJ1ZmFbdhBpX4VcTysmCVoyhQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-11 14:01                                           ` Luís de Sousa
     [not found]                                             ` <5e290d88-1c47-407d-819b-34a094d8b48fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-11 14:30                                               ` 'William Lupton' via pandoc-discuss [this message]
     [not found]                                                 ` <CAEe_xxjk4tfW2iyU1=rikSnmTWN6kDGYneGcqYc2_1WdReSqUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-15 15:54                                                   ` Luís de Sousa
     [not found]                                                     ` <20b2a20b-69ad-4b93-863a-c70db01d45een-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-15 18:28                                                       ` 'William Lupton' via pandoc-discuss
     [not found]                                                         ` <CAEe_xxg7Gy3Ag3gzwFO8855d=7JE=XqOw4C4HivpJkuB109y0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-16  8:32                                                           ` Luís de Sousa
     [not found]                                                             ` <fbe785d6-57dc-45a5-a4da-cc275638cd6dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-16  9:25                                                               ` 'William Lupton' via pandoc-discuss
     [not found]                                                                 ` <CAEe_xxj5JCnvbH6AbsTnV-cS79HCZ+PLksQ3Tm8RUjcHmyV+DQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-17 14:36                                                                   ` Luís de Sousa
     [not found]                                                                     ` <0a29b118-ae0f-448f-8e3e-39cc96ef5d8an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-17 14:42                                                                       ` 'William Lupton' via pandoc-discuss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEe_xxjk4tfW2iyU1=rikSnmTWN6kDGYneGcqYc2_1WdReSqUw@mail.gmail.com' \
    --to=pandoc-discuss-/jypxa39uh5tlh3mbocffw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).