public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Help with a filter converting citations to sidenotes
Date: Fri, 20 Aug 2021 17:44:22 +0100	[thread overview]
Message-ID: <CAEe_xxjm-+zWrAMoUB5sQdWFW-=UZKHXe_qRh3jFwz=00cukkg@mail.gmail.com> (raw)
In-Reply-To: <7b758cdd-70d7-4c86-b08a-de891ff10ca2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

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

Do you have a really simple example that shows the problem? Do you have
other filters?

On Fri, 20 Aug 2021 at 17:41, Leena Murgai <leenamurgai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Yes, thanks for taking a look :). I should have said that I tried also
> returning pandoc.Span(el.citations[1]) in my list of inlines but it seems
> like an empty string. I also tried running it before and after citeproc but
> as you said, the only thing that changed was the content.
>
> Any other ideas?
>
> On Friday, 20 August 2021 at 09:37:55 UTC-7 William Lupton wrote:
>
>> Not sure if this helps, but here's a simple example showing a somewhat
>> readable dump of the AST before and after citeproc. I think only
>> cite.content has changed. I suspect that your problem is something else.
>>
>> *% *cat cite.md
>>
>> @RFC1149
>>
>>
>> *% *LUA_PATH=../?.lua pandoc -L rep.lua --citeproc -L rep.lua cite.md
>>
>> (#) meta {}
>>
>> (#) blocks {
>>
>>   [1] content: Para {
>>
>>     [1] Cite {
>>
>>       citations: {
>>
>>         [1] {
>>
>>           hash: 0
>>
>>           id: "RFC1149"
>>
>>           mode: "AuthorInText"
>>
>>           note_num: 1
>>
>>           prefix: {}
>>
>>           suffix: {}
>>
>>         }
>>
>>       }
>>
>>       content: {
>>
>>         [1] Str text: "@RFC1149"
>>
>>       }
>>
>>     }
>>
>>   }
>>
>> }
>>
>> [WARNING] Citeproc: citation RFC1149 not found
>>
>> (#) meta {}
>>
>> (#) blocks {
>>
>>   [1] content: Para {
>>
>>     [1] Cite {
>>
>>       citations: {
>>
>>         [1] {
>>
>>           hash: 0
>>
>>           id: "RFC1149"
>>
>>           mode: "AuthorInText"
>>
>>           note_num: 1
>>
>>           prefix: {}
>>
>>           suffix: {}
>>
>>         }
>>
>>       }
>>
>>       content: {
>>
>>         [1] Str text: "("
>>
>>         [2] content: Strong {
>>
>>           [1] Str text: "RFC1149?"
>>
>>         }
>>
>>         [3] Str text: ")"
>>
>>       }
>>
>>     }
>>
>>   }
>>
>> }
>>
>> <p><span class="citation"
>> data-cites="RFC1149">(<strong>RFC1149?</strong>)</span></p>
>>
>> On Fri, 20 Aug 2021 at 17:14, Leena Murgai <leena...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>>> I'm running it after citeproc since I need the citation values.
>>>
>>> On Friday, 20 August 2021 at 09:12:06 UTC-7 Leena Murgai wrote:
>>>
>>>> Maybe the order I run the filters in matters?
>>>>
>>>> On Friday, 20 August 2021 at 09:07:24 UTC-7 Leena Murgai wrote:
>>>>
>>>>> Yeah, I tried looking there, I couldn't find what I wanted. I'm sure
>>>>> I'm missing something.
>>>>>
>>>>> The question is how to access it? As in what's the code? For example,
>>>>> each citation (https://pandoc.org/lua-filters.html#type-citation) has
>>>>> the fields id, mode, prefix, suffix, note_num, hash. Which one
>>>>> contains the text I want? What's the code to get the list of inlines I want
>>>>> (corresponding to the text in the citation)?
>>>>> On Friday, 20 August 2021 at 08:59:52 UTC-7 William Lupton wrote:
>>>>>
>>>>>> Do you mean the citations themselves? These are in el.citations. See
>>>>>> https://pandoc.org/lua-filters.html#type-cite and
>>>>>> https://pandoc.org/lua-filters.html#type-citation.
>>>>>>
>>>>>> On Fri, 20 Aug 2021 at 16:36, Leena Murgai <leena...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>>>>> wrote:
>>>>>>
>>>>>>> So far I have the following, which puts the [linked_item_number] in
>>>>>>> the passage and in the marginnote but I'm missing the rest of the
>>>>>>> text_that_goes_in_the_bibliography.
>>>>>>>
>>>>>>> function Cite(el)
>>>>>>>   return {
>>>>>>>     pandoc.Span(el.content),
>>>>>>>     pandoc.RawInline('html5', ' <span class = "marginnote">'),
>>>>>>>     pandoc.Span(el.content),
>>>>>>>     pandoc.RawInline('html5', ' </span>')
>>>>>>>     }
>>>>>>> end
>>>>>>>
>>>>>>> On Thursday, 19 August 2021 at 20:32:11 UTC-7 Leena Murgai wrote:
>>>>>>>
>>>>>>>> Hi there,
>>>>>>>>
>>>>>>>> I'm converting from LaTeX to HTML5. I'd like to put my citations in
>>>>>>>> 'sidenote's rather than at the end of the doc. In practice, this just means
>>>>>>>> I want the output html: to look like
>>>>>>>>
>>>>>>>> [linked_item_number] <span class=marginnote>
>>>>>>>> text_that_goes_in_the_bibliography</span>
>>>>>>>>
>>>>>>>> How do I access the element that goes into the citation, i.e.
>>>>>>>> text_that_goes_in_the_bibliography?
>>>>>>>>
>>>>>>>> Any advice appreciated.
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>> 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/eda3d7b4-befd-4f42-9455-8a37373d33a6n%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/eda3d7b4-befd-4f42-9455-8a37373d33a6n%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/3106cf1d-5ae3-411f-b92a-c14153d58e49n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/3106cf1d-5ae3-411f-b92a-c14153d58e49n%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/7b758cdd-70d7-4c86-b08a-de891ff10ca2n%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/7b758cdd-70d7-4c86-b08a-de891ff10ca2n%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_xxjm-%2BzWrAMoUB5sQdWFW-%3DUZKHXe_qRh3jFwz%3D00cukkg%40mail.gmail.com.

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

  parent reply	other threads:[~2021-08-20 16:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20  3:32 Leena Murgai
     [not found] ` <0f2d14e3-a86e-4fa1-b98c-52f540fe82b9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 15:36   ` Leena Murgai
     [not found]     ` <eda3d7b4-befd-4f42-9455-8a37373d33a6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 15:59       ` William Lupton
     [not found]         ` <CAEe_xxgvt+VaEQHA52ARktgU5LtDc5CvSwGpGEmi7iB61r-KFQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-20 16:07           ` Leena Murgai
     [not found]             ` <a50c77e1-4112-43ba-bfb1-fc716a474be8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 16:12               ` Leena Murgai
     [not found]                 ` <93663960-bbfe-40a1-b3ba-25fefe58e7e0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 16:14                   ` Leena Murgai
     [not found]                     ` <3106cf1d-5ae3-411f-b92a-c14153d58e49n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 16:37                       ` William Lupton
     [not found]                         ` <CAEe_xxjcvzan-To3UUApcszFJS1tAj2TC7NH2bTW38TykJstxg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-20 16:41                           ` Leena Murgai
     [not found]                             ` <7b758cdd-70d7-4c86-b08a-de891ff10ca2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 16:44                               ` William Lupton [this message]
2021-08-20 16:59                               ` Bastien DUMONT
2021-08-20 16:44                           ` Pedro P. Palazzo
     [not found]                             ` <0fd903f3-e52d-44bd-a1b2-50bccfc9b66cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 17:00                               ` Leena Murgai
     [not found]                                 ` <206b26c5-32b2-408d-80f6-cf851c9c8cb9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 17:06                                   ` Leena Murgai
     [not found]                                     ` <7df79e6f-cb35-4ca5-8bc3-f089e3bc9199n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 17:25                                       ` Leena Murgai
     [not found]                                         ` <eb59834b-d3e8-4dc4-9a66-0eb8c0f3e225n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 17:31                                           ` William Lupton
     [not found]                                             ` <CAEe_xxjLevSn7YgLpg4LTdmjD_duxwm+Z3qXEGM+zSuwHUT3fg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-20 17:38                                               ` William Lupton
2021-08-20 17:41                                               ` Leena Murgai
     [not found]                                                 ` <b548772c-269e-45c7-9ff6-9aec6014f024n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 17:49                                                   ` William Lupton
     [not found]                                                     ` <CAEe_xxggM6-5=pTkMVxFFZSht75Sr=R_iQ8kXpq9nX+2kfKh8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-20 18:06                                                       ` Leena Murgai
     [not found]                                                         ` <8d4c4320-4a85-4363-8789-8bebcd21d329n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 18:37                                                           ` William Lupton
2021-08-20 18:08                                                   ` Bastien DUMONT
2021-08-20 18:34                                                     ` Leena Murgai
     [not found]                                                       ` <5866a845-e0bd-48b1-835d-189e40ef94f5n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-20 18:53                                                         ` Leena Murgai
     [not found]                                                           ` <4c177bdf-f369-4e9b-bdc6-36e0e38cf496n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-21  8:33                                                             ` William Lupton
2021-08-21 17:00   ` John MacFarlane
     [not found]     ` <m2sfz2n36m.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2021-08-24  3:07       ` Leena Murgai

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_xxjm-+zWrAMoUB5sQdWFW-=UZKHXe_qRh3jFwz=00cukkg@mail.gmail.com' \
    --to=wlupton-qst+ys/numyeuisrzh9sikb+6bgklq7r@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).