public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Changing output for Para in -ms output
@ 2021-05-23  3:11 T. Kurt Bond
       [not found] ` <CAN1EhV8i70J8ncS2yFhz8fRO1f8-x7EvS3sdzT48Qipoj=cKuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: T. Kurt Bond @ 2021-05-23  3:11 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

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

-- 
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/CAN1EhV8i70J8ncS2yFhz8fRO1f8-x7EvS3sdzT48Qipoj%3DcKuQ%40mail.gmail.com.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Changing output for Para in -ms output
       [not found] ` <CAN1EhV8i70J8ncS2yFhz8fRO1f8-x7EvS3sdzT48Qipoj=cKuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2021-05-23  4:53   ` T. Kurt Bond
  0 siblings, 0 replies; 2+ messages in thread
From: T. Kurt Bond @ 2021-05-23  4:53 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-23  4:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23  3:11 Changing output for Para in -ms output T. Kurt Bond
     [not found] ` <CAN1EhV8i70J8ncS2yFhz8fRO1f8-x7EvS3sdzT48Qipoj=cKuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-05-23  4:53   ` T. Kurt Bond

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).