public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Benct Philip Jonsson <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: anna ecke
	<0x616e6e6165636b65-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Footnotes in revealjs slides
Date: Thu, 17 Sep 2020 09:58:29 +0200	[thread overview]
Message-ID: <2e985ea9-c2c8-99fb-5515-6775c181e920@gmail.com> (raw)
In-Reply-To: <565a2869-820c-4919-89b9-4f3aa8c5dd31n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

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

On 2020-09-17 00:36, anna ecke wrote:
> Okay, that was rude of me - not looking into the zip but only at your
> inline example - I'm sorry. Now, I see where the misunderstanding on my end
> was coming from, at least, I hope. As a workaround, you are using the `:::
> notes` block to define the footnote content. Unfortunately, that wont work
> in my case, since I'm actually making use of speaker notes, too. Which are
> defined in exactly that block - al least for revealjs.

My turn to apologize: since I don't usually use revealjs as slide format 
I didn't realize that the class `notes` on a div is "magical". If you 
instead use a class `footnotes` (or anything else but `notes` I guess) 
around the footnote list it works immediately, without any need for a 
filter and with all the "magic" happening in the CSS. It should also be 
possible to combine with speaker notes. Although I don't know how to 
make the speaker notes actually appear in the notes window the HTML 
looks OK.  A new zip with updated files is attached to this message. It 
also contains an (example) defaults file, so all you need to type on the 
command line, if you have a recent version of pandoc is

````shell
pandoc -d footnotes.yaml presentation.md -o presentation.html

> 
> I probably have to take a deeper look into lua filtering to get a hold on
> all the footnotes in a section and put them in a footer (or into some other
> markup) within the section. And I need to prevent the html/revealjs writer
> to create the endnotes section. Looking at the native output, the endnote
> section does not even exist in the AST. From the beginning, this was the
> reason, why I thought making the html/revealjs writer to respect the
> reference-location
> <https://pandoc.org/MANUAL.html#option--reference-location> option would be
> preferable compared to a filter-based workaround.
> 
> BPJ schrieb am Mittwoch, 16. September 2020 um 16:34:19 UTC+2:
> 
>> Den tis 15 sep. 2020 23:50anna ecke <0x616e6e6...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>>
>>> Thank you BP for your input. But I think, we have a small
>>> misunderstanding here. I was referring to footnotes
>>> <https://pandoc.org/MANUAL.html#footnotes>, which is a special type of
>>> references, I think, not speaker notes.
>>>
>>
>> I too was about *foot*notes, albeit "faked" ones not using Pandoc's native
>> footnotes. If you test my setup filter and all and look at my example HTML
>> you will see that. By having the filter replace native Pandoc divs with the
>> class `notes` with raw HTML for div tags I managed to get an actual div,
>> rather than an aside/speaker notes, so that I could style the list inside.
>> Did you perhaps not get the zip archive?
>>
>> It may be possible to write a Lua filter so that native notes within each
>> slide/section can be converted to my "faked" format, but I'm afraid that a
>> Lua filter would not visit the native note elements in say a section
>> container as created by `make_sections()` in linear order, so they might
>> end up in the wrong order in a generated list. Albert can probably answer
>> whether that problem is still there, or if there is a workaround. Anyway I
>> tried to convert footnote markers in a paragraph to empty spans with a
>> `note` class and a sequence of reference footnotes into an ordered list
>> with Vim `s///` commands and it worked well, so it shouldn't be too hard to
>> convert existing native notes to my "faked" version with a decent editor or
>> a text filter script.
>>
>>
>>
>>> BP schrieb am Montag, 14. September 2020 um 14:17:49 UTC+2:
>>>
>>>> On 2020-09-14 00:00, anna ecke wrote:
>>>>> At the moment, the location where footnotes are rendered into can be
>>>>> configured with the option reference-location
>>>>> <https://pandoc.org/MANUAL.html#option--reference-location>.
>>>> Unfortunately,
>>>>> it only takes effect when rendering markdown. I'd like to get my
>>>> footnotes
>>>>> rendered into the same slide it was mentioned/written in.
>>>>>
>>>>> My question is now, would it make sense to propose this on github as a
>>>>> feature request, or should I just go ahead and write a filter for
>>>> this? I'm
>>>>> not an Haskell expert and I haven't checked out the code base to look
>>>> what
>>>>> needs to be changed to make that kind of behaviour work or what amount
>>>> of
>>>>> effort it might take.
>>>>>
>>>>> Happy to hear any opinion or even receive links the code responsible
>>>> for
>>>>> this or to projects that have solved this already.
>>>>>
>>>>> cheers,
>>>>> ae
>>>>>
>>>>
>>>> Nothing prevents you from constructing your notes manually, placing note
>>>> references as sequential numbers in the text and a list with each note
>>>> text at the appropriate list number at the bottom of each slide.
>>>> Presumably no links between note markers and notes would be needed in a
>>>> slide show, which makes things easier, although you might want to wrap
>>>> the note numbers in the text in spans with a class and the lists with
>>>> notes in divs with another class for styling.
>>>>
>>>> Using a little CSS magic and a Lua filter you can both get note
>>>> references and note list numbers styled and colored appropriately, *and*
>>>> reveal yourself of the need to insert note numbers manually, although
>>>> you still need to insert divs with an appropriate class where you want a
>>>> note reference to appear, and need to make sure that the notes in the
>>>> list come in the right order relative to the note references in the text
>>>> of each slide.
>>>>
>>>> Something like this:
>>>>
>>>> ``````markdown
>>>> ## Slide heading
>>>>
>>>> The text [mentioning]{.note} some [thing]{.note} or [other]{.note} goes
>>>> here.
>>>>
>>>> :::notes
>>>>
>>>> 1. Text for note.
>>>> 2. Text for note.
>>>> 3. Text for note.
>>>>
>>>> :::
>>>> ``````
>>>>
>>>> and then in some appropriate place some custom CSS:
>>>>
>>>> ``````css
>>>> span.note:after {
>>>> content: counter(note-ref-counter);
>>>> vertical-align: super;
>>>> color: blue;
>>>> font-size: 50%;
>>>> }
>>>>
>>>> div.notes ol {
>>>> list-style: none;
>>>> font-size: 50%;
>>>> }
>>>>
>>>> section.slide, section.title-slide {
>>>> counter-reset: note-ref-counter note-counter;
>>>> }
>>>>
>>>> div.notes ol li:before {
>>>> content: counter(note-counter);
>>>> vertical-align: super;
>>>> color: blue;
>>>> display: inline-block;
>>>> width: 1em;
>>>> margin-left: -1em;
>>>> }
>>>>
>>>> span.note {
>>>> counter-increment: note-ref-counter;
>>>> }
>>>>
>>>> div.notes ol li {
>>>> counter-increment: note-counter;
>>>> }
>>>> ``````
>>>>
>>>> This should give you blue superscript note markers and blue superscript
>>>> list markers without any trailing dot, automatically numbered
>>>> sequentially for each slide.
>>>> I tried to make the count be for the whole file rather than for each
>>>> slide, but Chrome insists on resetting the counters to 1 when they have
>>>> reached 9. Perhaps someone who understands CSS counters better than I do
>>>> knows how to fix that.
>>>>
>>>> Finally you need to apply the following Lua filter when running Pandoc,
>>>> so that the `<div>` elements wrapping the note lists really are divs and
>>>> not `<aside>` elements, or else the notes will not be visible.
>>>>
>>>> ``````lua
>>>> local insert = table.insert
>>>> local begin_notes = pandoc.RawBlock('html', '<div class="notes">')
>>>> local end_notes = pandoc.RawBlock('html', '</div>')
>>>>
>>>> function Div(div)
>>>> if not div.classes:includes('notes') then return nil end
>>>> local content = div.content
>>>> insert(content, 1, begin_notes)
>>>> insert(content, end_notes)
>>>> return content
>>>> end
>>>> ``````
>>>>
>>>> The command for running pandoc should then look something like this
>>>> (adjusted for the version of reveal.js your version of Pandoc needs):
>>>>
>>>> ``````shell
>>>> pandoc notes.md -L notes.lua -t revealjs -so notes.html --css notes.css
>>>> -V revealjs-url=https://unpkg.com/reve...@3.9.2/
>>>> <https://unpkg.com/reveal.js@3.9.2/>
>>>> ``````
>>>>
>>>> Archive with files attached!
>>>>
>>>>
>>>> -- 
>>> 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/7c5ae003-b078-442f-b7ac-584614ccdee7n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/7c5ae003-b078-442f-b7ac-584614ccdee7n%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/2e985ea9-c2c8-99fb-5515-6775c181e920%40gmail.com.

[-- Attachment #2: footnotes.zip --]
[-- Type: application/zip, Size: 2702 bytes --]

      parent reply	other threads:[~2020-09-17  7:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 22:00 anna ecke
     [not found] ` <fb3c3c10-e5bb-4a2b-9d26-0a9f358805edo-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-14 12:17   ` Benct Philip Jonsson
     [not found]     ` <47eee52e-3d47-7830-97bf-68d21c6c2bf8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-09-15 21:49       ` anna ecke
     [not found]         ` <7c5ae003-b078-442f-b7ac-584614ccdee7n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-16  8:32           ` anna ecke
2020-09-16 14:34           ` BPJ
     [not found]             ` <CADAJKhA9m84ZVXUqVjt1Z9CS-6xm6AqjMob0sjg7Z+_rMeD8cw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-09-16 22:36               ` anna ecke
     [not found]                 ` <565a2869-820c-4919-89b9-4f3aa8c5dd31n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-17  7:58                   ` Benct Philip Jonsson [this message]

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=2e985ea9-c2c8-99fb-5515-6775c181e920@gmail.com \
    --to=melroch-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=0x616e6e6165636b65-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=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).