From: "T. Kurt Bond" <tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Changing output for Para in -ms output
Date: Sun, 23 May 2021 00:53:30 -0400 [thread overview]
Message-ID: <CAN1EhV-nEySsCE3hfDCGM5SFtmhauWpSfCFPjmABDfa8CDcOoA@mail.gmail.com> (raw)
In-Reply-To: <CAN1EhV8i70J8ncS2yFhz8fRO1f8-x7EvS3sdzT48Qipoj=cKuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2364 bytes --]
Annnd I figured it out about 15 minutes after I sent my original email.
For anybody else who has this sort of problem, here is my solution: First,
I have a function Div in my lua filter. Here's an excerpt:
function Div(element)
-- process other other kinds of divs...
elseif has_value(element.classes, 'character') then
local newelement = transform_character(element)
return newelement
end
return element
end
Here's the transform_character function:
local function transform_character (element)
local i = 0
local newcontent = {}
for index, value in ipairs(element.content) do
i = i + 1
if value.tag == 'Para' and i > 1 then
if FORMAT == 'ms' then
table.insert (newcontent, pandoc.RawBlock ('ms', '.XP'))
table.insert (newcontent, pandoc.Plain (value.content))
else
io.stderr:write ('Transforming character elements not supported
in '
.. FORMAT .. ' format, not transforming.\n')
table.insert (newcontent, value)
end
else
table.insert (newcontent, value)
end
end
local newDiv = pandoc.Div (newcontent)
return newDiv
end
My problem was that I wasn't using RawBlock. Sigh.
On Sat, May 22, 2021 at 11:11 PM T. Kurt Bond <tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I have Divs with a particular class that has a Header, then a normal Para,
> then a list of Para's that I want to have come out in the -ms output as .LP
> instead of .PP, or something equivalent. Can anyone suggest what I need to
> do to make this happen? I can find the right Divs easily, but I'm having
> trouble constructing replacements for the affected paragraphs.
>
> --
> T. Kurt Bond, tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, https://tkurtbond.github.io
>
--
T. Kurt Bond, tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, https://tkurtbond.github.io
--
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/CAN1EhV-nEySsCE3hfDCGM5SFtmhauWpSfCFPjmABDfa8CDcOoA%40mail.gmail.com.
[-- Attachment #2: Type: text/html, Size: 5096 bytes --]
prev parent reply other threads:[~2021-05-23 4:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-23 3:11 T. Kurt Bond
[not found] ` <CAN1EhV8i70J8ncS2yFhz8fRO1f8-x7EvS3sdzT48Qipoj=cKuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-05-23 4:53 ` T. Kurt Bond [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=CAN1EhV-nEySsCE3hfDCGM5SFtmhauWpSfCFPjmABDfa8CDcOoA@mail.gmail.com \
--to=tkurtbond-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).