From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28422 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "T. Kurt Bond" Newsgroups: gmane.text.pandoc Subject: Re: Changing output for Para in -ms output Date: Sun, 23 May 2021 00:53:30 -0400 Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ad8d3605c2f81315" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15466"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDJYFKFHUYHRBVV7U6CQMGQEPT5FUGI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun May 23 06:53:46 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ua1-f55.google.com ([209.85.222.55]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lkg7V-0003p6-39 for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 23 May 2021 06:53:45 +0200 Original-Received: by mail-ua1-f55.google.com with SMTP id m11-20020a9f3fcb0000b029021dec910e95sf2091750uaj.13 for ; Sat, 22 May 2021 21:53:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1621745623; cv=pass; d=google.com; s=arc-20160816; b=KRqTPuSN6LA8KPHsRo08L/w3rWmiDus9wT2GEiqBu4rIsgPAz/W4HMbM9MrN7kPS2f oTuaqJJi1uOl7JH0iWoUz8+AwUfJxMzz+ebvxY3iaJEk7O+c7coWqEUDHp13FHXSW1pS hyuc8AFp7Yx93uZa7zVjutnTGdU1C36S+l5Pf+N4HTouhIS9qacvmS0xK+89bWbgaz0I X/6lbMFeRp9yElVqG1ySoQshSCnn9xuPYP57OUf/pO4aX3a0t31u41HBBe2jynJ0jIel QpOz77PdyNxfR9yMD1vD+QEM92cSdQ/SLREoSUt6AOJHXQ4TvcguCc6u9S1vFnuxjyXn Xhwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date :from:in-reply-to:references:mime-version:sender:dkim-signature :dkim-signature; bh=E+0xVCc8EYlId5oK/EGNmgmlG+qIz46W1e6Iy2WG07I=; b=gPfBG7ddV2wP8RXsmTBdjx0coBJOU4DrNVUwQoHaoR5Jud1yJx9Hp6R4nhMZiFW3bl TdOpVqcqP4Gsu/T1C+OLLA+6jASZ+A1Y86bsdbcNiQA9IPyY6kDtTBp+TuH0wY9gCA8o JQkIbHb0oPu9O0aZBg6ZhA97FTEaz/uhAktfqNt/oK9ksS2VUFjZnYYEQ/ap+I7kCo2B pHiO6JOMvzeIggQVpSl990ZagUr9qKIcMSsF4FFl5BUFc3GIlAb+5Tfj2ZWueGq1OFcs zVE5EPwObZ1uzXxwZvhdKh1Zqt+eTEcbxPMsEZAkz3OstK0WtLfhQKKNDttwuhXS56zt I8Eg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oCKiY1V3; spf=pass (google.com: domain of tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::12d as permitted sender) smtp.mailfrom=tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:references:in-reply-to:from:date:message-id :subject:to:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=E+0xVCc8EYlId5oK/EGNmgmlG+qIz46W1e6Iy2WG07I=; b=ruOU7oF8Eulf10TaxfrNB1esFzaFwNw3CSqRu32GuZCHH8aV9vWuY9B+Dl+QQx82BI +zv5+kAlDqIpMM1/vO8UsNpNnw6u0sP/dDpuUpprVt2JAeIVSc17cJtNna/zH2PTlq9Y /lwCS13Z6p6jfrV+TC4+ArEW6bynk0J02LS7/X1ABaGgZtLTLVGX7ysyApL3+uzeZhrx vuCLW7VXCCGZSrjelQos/cHQWhTri4F7h4/vR2ewhiSsZvdTpSmY86vTGGDB0QnwZq1W 5gDw1j7PmCOsPGM+z5DGF365eLemUaJ0ArMvD8coQRhxu6ej9yFFo8bL9vQTYRN7gNkk Y+sw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=E+0xVCc8EYlId5oK/EGNmgmlG+qIz46W1e6Iy2WG07I=; b=Fb2SvcaoKqreY9fnOy43QNLzMDm7HeWVbnM6g4PAbhbdK+iLuhr81pJnpFs28dctYX jAyATGpnVD6dbZRpimD4z5JLBMgUYiZiFI9f1XPERjnO3pYFjZZLi04SOmePDTHYgiiZ weiBclriJP5m6X/HIJuNtkk7EGH628A4Z2nKSbEuyVCm8kEQw9Vql/d9OeHNnY73Bimv +kkFTxKbYQ4bNKw2EIkXjKENWGRuwu7rl3+psDy9xg4Smy3S/dJCO97U7eYp7SKFWiao w1KsaRI3dRIVezPA6zSO9ooNE2ypWjOa5yk5nDRFP1Z1GOBYrX/yrAgRQMZck1IiylQY FXRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:references:in-reply-to:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=E+0xVCc8EYlId5oK/EGNmgmlG+qIz46W1e6Iy2WG07I=; b=F5KTmDvudpS2TjuYQWWfQ9GKvepmvvB4lao4i9pj7AVZt/3PZk3Z5VkbZiFbf0He62 3bWFz2ZTk861QerjhYoSPnyG/BmhtqDS6ihb71+xQbiTkbQAF7Qa0jOmFdCQ2Kp8qjoH QYBS6Pt6GjUnqQX6EMbj11/bZnciAO7xEe5IzYtm8t7qgatrFMDgLRCJsNuj6iEiZtoh 53di1ucTDEZJREFNJEeb45DVGOzJPk2TBEfjzFN9T8QR/V1qDXgeaBqvHZhJvoyXyYEv /1cNMRzGWqRuEn9+o9Rkw7mPMM21J2AgbDPlFGcTRkDZSHX3vvxc3szRsPwq6wS3ZQhi 3NCg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533Pjf7GDQBQL0XxD6ajC5ea7+iv2mdnUPMTz1Pzz/ZsRSSbZYTp 21Nym35kV/TxRPtde9zIhG0= X-Google-Smtp-Source: ABdhPJyVsH5fRMhTqgE3/QzaNmEQlir2v8gxfj8syrrmdhbZ2frmGpxcZcKW9w4B4eJh7SEGYvSB6A== X-Received: by 2002:ab0:356f:: with SMTP id e15mr17974038uaa.52.1621745623689; Sat, 22 May 2021 21:53:43 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a67:c295:: with SMTP id k21ls2003749vsj.7.gmail; Sat, 22 May 2021 21:53:42 -0700 (PDT) X-Received: by 2002:a67:b919:: with SMTP id q25mr17486503vsn.17.1621745622111; Sat, 22 May 2021 21:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621745622; cv=none; d=google.com; s=arc-20160816; b=SrVvGJ9deQXi02DSvksxK0WDN2mkI6fhQLDdtD6mjOGmlsgbzUX1X2WWe9YFoo0Ou7 Rkj5IuxLSpJWMKHj5xgYMTFfvSSBBrmUzFkS9PLHBjOYcQOAoYYURXa4lT0sLVFGrUYq tkVCm0qDerUjJxZygBlESjexvUwnWtL/ISbp1/J4MQYXz4JD10JtH3X2a53popg7gMQE zjxWPQF5uFqlKo5TyYtGV3yqPHIbVNLHb0daNKsTVST6WgTbqt7WTJwitSO57x75iUrp yVWrmXsALfMrLp28wi6Aj7qNfjxcA3NLdo0t/X2fmHGNC7HC5D51g2aZsELNf8lpRAXJ H2qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KcVg1DQwKDfmuyeWIYPpMC2BE4JOWqXnXiKsT8roLKk=; b=wrp3gQVLtdAQVHzHIShJ8pctdYGA7hYiJxiR8DQayZr5RvM4Z6yflvXA99NdGIaTzC Vk6NUqyqyC6sPj86Ai4YHHfSTK3O1U6ElahDvbKKoGkHpyTrycOYi0RRwaepgGVCT2AH ZMKQ4LaFMZNczmOmA2xhQO7NFNpcamZMYEdNMy2iuNux/n4wkl1VNWQVV2xTfAvpEevg 0ylM6e5q8akl6pOWcENdZfNaNps1H6I3MKCQE8X3qwfsZ+LjDoFFtZoSHxanPr1w2ryQ ydo1FjO8/mf3OVvCI6VFqIiGGbfuhE6eAKj6qKGz5JROGqNOPMpYOMaJmnAZ3Zi0i/uP ruUw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oCKiY1V3; spf=pass (google.com: domain of tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::12d as permitted sender) smtp.mailfrom=tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com. [2607:f8b0:4864:20::12d]) by gmr-mx.google.com with ESMTPS id p6si622811vkm.2.2021.05.22.21.53.42 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 May 2021 21:53:42 -0700 (PDT) Received-SPF: pass (google.com: domain of tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::12d as permitted sender) client-ip=2607:f8b0:4864:20::12d; Original-Received: by mail-il1-x12d.google.com with SMTP id o10so20986552ilm.13 for ; Sat, 22 May 2021 21:53:42 -0700 (PDT) X-Received: by 2002:a05:6e02:490:: with SMTP id b16mr8872429ils.213.1621745621370; Sat, 22 May 2021 21:53:41 -0700 (PDT) In-Reply-To: X-Original-Sender: tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oCKiY1V3; spf=pass (google.com: domain of tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::12d as permitted sender) smtp.mailfrom=tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:28422 Archived-At: --000000000000ad8d3605c2f81315 Content-Type: text/plain; charset="UTF-8" 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 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. --000000000000ad8d3605c2f81315 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Annnd I figured it out about 15 minutes after I sent my or= iginal=C2=A0email.=C2=A0 For anybody else who has this sort of problem, her= e is my solution:=C2=A0 First, I have a function Div in my lua filter.=C2= =A0 Here's an excerpt:
function Div(element)
=C2=A0 =C2=A0-- process other other kinds= of divs...
=C2=A0 =C2=A0elseif h= as_value(element.classes, 'character') then
=C2=A0 =C2=A0 =C2=A0 local newelement =3D transform_char= acter(element)
=C2=A0 =C2=A0 =C2= =A0 return newelement
=C2=A0 =C2= =A0end
=C2=A0 =C2=A0return elemen= t
end

Here's the transform_character function:= =C2=A0
local function transform_character (element)=
=C2=A0 =C2=A0local i =3D 0
=C2=A0 =C2=A0local newcontent =3D {}
=C2=A0 =C2=A0for index, value in i= pairs(element.content) do
=C2=A0 = =C2=A0 =C2=A0 i =3D i + 1
=C2=A0 = =C2=A0 =C2=A0 if value.tag =3D=3D 'Para' and i > 1 then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if FORM= AT =3D=3D 'ms' then
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 table.insert (newcontent, pandoc.Raw= Block ('ms', '.XP'))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 table.insert (newcontent, pan= doc.Plain (value.content))
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0else
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 io.stderr:write ('Transformin= g character elements not supported in '
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.. FORMAT .. ' format, not tra= nsforming.\n')
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 table.insert (newcontent, value)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end
=C2=A0 =C2=A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0table.insert (n= ewcontent, value)
=C2=A0 =C2=A0 = =C2=A0 end
=C2=A0 =C2=A0end
=C2=A0 =C2=A0local newDiv =3D pandoc.D= iv (newcontent)
=C2=A0 =C2=A0retu= rn newDiv
end
My problem was that I wasn't usi= ng RawBlock.=C2=A0 Sigh.
On Sat, May 22, 2021 at 11:11 PM T. Kurt Bon= d <tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wr= ote:
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 out= put as .LP instead of .PP, or something equivalent.=C2=A0 Can anyone sugges= t what I need to do to make this happen?=C2=A0 I can find the right Divs ea= sily, but I'm having trouble constructing replacements for the affected= paragraphs.

--


--

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/CAN1EhV-nEySsCE3hfDCGM5SFtmhauWpSfCFPjmAB= Dfa8CDcOoA%40mail.gmail.com.
--000000000000ad8d3605c2f81315--