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

--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAN1EhV-nEySsCE3hfDCGM5SFtmhauWpSfCFPjmABDfa8CDcOoA%40mail.gmail.com.