From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32203 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: docx -> gfm with custom styles Date: Sat, 18 Feb 2023 19:39:33 +0000 Message-ID: References: <3909f520-e8db-4cf9-900d-6a5a858c1a18n@googlegroups.com> <52ada5c3-e26e-4c8c-8b3f-b55bb8ce8e1en@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28181"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRB6GSYSPQMGQE44F6N7Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Feb 18 20:39:41 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wr1-f63.google.com ([209.85.221.63]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pTT3c-0007D3-NM for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 18 Feb 2023 20:39:40 +0100 Original-Received: by mail-wr1-f63.google.com with SMTP id ba19-20020a0560001c1300b002c557db0e0fsf70365wrb.11 for ; Sat, 18 Feb 2023 11:39:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676749179; cv=pass; d=google.com; s=arc-20160816; b=tGv6bNaLP+8gMspf82m5/4YT1w9KC8wTqTz4fydc8bPekzSGbrMuYsOwTMSwf1mUuB czpimBf1HOX1s8479+5S5dAqWJ9hUjGXbILua1f3lL5oquDI6B8bUhWa3KTtsVoROgeK V1YcMYX8FVotfA9Y/XkjW1v91TmYCXn2bCS30Rie4uPc31YSVSLpEkHM3xalWENmdvgf Obx/br6CwoaJalCNL8W3+mrPLpRSnyjoqyOQeD1Krl3yFMq+vGk3+enb68kbwDqgCLQu UqTtstLiGpb3z5cdi3n0uUMRpQJBzOvMUTSrQ42Q+4mMWuIxTSbxZ2K8q9Bd+idbmKDZ S+1A== 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:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=CqTLIFTzdymVFXVGxDDF2W2UFaxjXpBxpVWr292WJQM=; b=IN0qblQHXeI/sFqLgCIWv0KL6dIZLYHXE+FlV/Wo0lxCIcM8p3pNXgyj0Y4RkA87zL abSsACurnyeqBiwdR/UWIHLks1yTqWLmSQqdlReBj/BlW4OcWSRWrnsgDxLumL7aXq5w rzRAKgwMGCVZdXU7/89sIrDnGPvg1d8/z2sxjcap208pdsttauPNwCg9yMxzefEfk5+6 myNUFSoOlUstP6fCsa1Mh5TfgedSbaS4rq5uCeUN0cn6qyxMNXCLaDwCQRQMVyMWR0HV lxZyFQnWUt4jqqOBSsHCFXk4aeQhSsrU79/KCIQ+sJYY1Qj5UWoD9UNoPrpI+49LgzY9 /Jwg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=WoJTVexe; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=CqTLIFTzdymVFXVGxDDF2W2UFaxjXpBxpVWr292WJQM=; b=dB++Oa38rA3nf/gMLq++q9mHlFi2ecZIxMtUgfIar2KTZwebwBMhgKg4aJgi9G9F+J 0M2MTBGT/SV7LVN5lklu1fqIBHvBBxrZtLRzrDl8+qJVklziS+tqPWJQALqQHlj27k0E 7g5IMM05PvpZ7uPWfH5GHAFKxexIJPSMFWnOT1bUq9UgjO2bGfzrj0ZD9tH+YTpawrh0 +dMZ7g6CVKWY+JIr6gBqMcgR7GuCOvDzpjYHJkLQw7ETgxET7Rsy7em+QudwyquLhz7B BeJAh+iUcIIdTX+f4XhKUxilxeY6oFFMVntV0lntvMRbE X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=CqTLIFTzdymVFXVGxDDF2W2UFaxjXpBxpVWr292WJQM=; b=n0fUSVD8IfOlKzKBtyCNnWd3uBdRb556bhR2mxlmPe/KhyOhUNyF5oY+7qGGuZS5ad xAr5zJJQZzPT58JqRyyuPjYrrkF2Er46d8vQTwL0tDaj46Rf/qTs/iRlq+tINYKWe3DC tKwtnYOIKAwR+S7yYbBFuGuFlIoIU8GN1i7z1tTOJF9x1zztrbcYCa+Z7H4f23hCZ6Iq R4E8QfUfr3REX/7zL8S6MCUyQTR7b5qomOuoQD3jOLq323CMsKZv7EJzkNysVN56goB2 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKUkb7LzPWyBNRLJPHmL5qdCnv1/lCnQIgWTXLtUCwDqSauBZuxj Ax5Ln/W5PFNOlkfYxsGyrhQ= X-Google-Smtp-Source: AK7set+35GQm24yjaTBNwduP0equRQFbrXREOcEYZeZv2e3WpZTJkz844s2Sc3Bbogiir4rhD08Qow== X-Received: by 2002:adf:e9cc:0:b0:2c5:3fcb:682b with SMTP id l12-20020adfe9cc000000b002c53fcb682bmr80710wrn.2.1676749179391; Sat, 18 Feb 2023 11:39:39 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a5d:64a9:0:b0:2c5:5262:2e24 with SMTP id m9-20020a5d64a9000000b002c552622e24ls1312270wrp.2.-pod-prod-gmail; Sat, 18 Feb 2023 11:39:35 -0800 (PST) X-Received: by 2002:a05:6000:41:b0:242:1809:7e17 with SMTP id k1-20020a056000004100b0024218097e17mr756768wrx.6.1676749175636; Sat, 18 Feb 2023 11:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676749175; cv=none; d=google.com; s=arc-20160816; b=mhOruLMTmlrPUwLKemx5vDZiDKm9NdkhwK99GmRKOnAhL1jW3dzRvzZNfZT1LOQczf qgZYPdnTGzEnU3sTeGZKPh3zWzO/o9WUPcDnbZmw6+y/ZmbTkgP/VaHJmTHR+5VxfbIT pamGainpO1pF1/n4uba1DcCxmsiTyIaOy2NXWQGubv7Ie5aPFDQ/ZQSFCfSxqanydi43 DMaTGHdRjbJVlgTDM1+Ygn6LXK4uPW9Tpy7Fft/WagS9U7aXd0Rp/Gx0tYlyMRJ/4gb5 1+Bq7WAZAampfDV8N1KA5fOjRLFwJsUihI8S6jab/LpM5wnPAabUJOCMubi5ETbCUgMk qRXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=INxUi+6o/HnLQvLhrBfGVcgaPx+j5BdJQCqUBj61f+U=; b=WJdILhV1hENYv8cMXpz/s3rwbNjLoBfe9HD1tLw6V3s9dzgubEMGi2JDnrNevYTZlb cCHkC8lnUMXS05pZbLK8NJj2LvnWlaPe9OR9FUL4J1xIS3rGYPIEjJXBtMwnfgLTRrAo fERrPtD/ER2D1T1bg6wMwlhqoMf9pz/RK6DrahuucTgWIrOXB8sJ2aEJsMfNFdYo+3cA ELycjLc9Yj7FELMx1DoO2DFjvxIWEv6v5IbMBk/Dtq9r4y5vzNB0uaxTPXASnh/xoptk qLPbxWiMG0yRIp98X9zFebyAUHQtQ9BbKmUM2CTqrXwU9fViDAsQJ5td7fsLDOZlS50h 4v2Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=WoJTVexe; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout01.posteo.de (mout01.posteo.de. [185.67.36.65]) by gmr-mx.google.com with ESMTPS id ay4-20020a05600c1e0400b003e21fa67323si171598wmb.0.2023.02.18.11.39.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 11:39:35 -0800 (PST) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) client-ip=185.67.36.65; Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 3CC7824021C for ; Sat, 18 Feb 2023 20:39:35 +0100 (CET) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PJzXQ5YL1z9rxD for ; Sat, 18 Feb 2023 20:39:34 +0100 (CET) Content-Disposition: inline In-Reply-To: X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=WoJTVexe; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net 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:32203 Archived-At: Inline formatting should be preserved without any problem. The cause of the= trouble here is is that you have a block quote inside what should be your = header, which IMO does not make sense. Le Saturday 18 February 2023 =C3=A0 11:26:01AM, Ben Menashe a =C3=A9crit : > Hmm, yea, I see -- it's part of large original docx, so it was failing on > another element styled as Example & had italics applied. > I printed the div in Lua filter, when it works I see this: >=20 > ``` >=20 > Div ("",[],[("custom-style","Example")]) [Para [Str "Test",Space,Str > "example"]] >=20 > ``` >=20 > and when fails this: > ``` >=20 > Div ("",[],[("custom-style","Example")]) [BlockQuote [Para [Emph [Str > "Example:"]]]] >=20 > ``` >=20 >=20 > is there any clean way to approach this so it will work in a generic way = and > preserve any other formatting applied? >=20 > On Saturday, February 18, 2023 at 1:19:46 AM UTC-7 Bastien DUMONT wrote: >=20 > With your examples, I get: >=20 > ## Scope >=20 >
>=20 > Test body >=20 >
>=20 > ## Test nested >=20 > Le Friday 17 February 2023 =C3=A0 07:00:47AM, Ben Menashe a =C3=A9cri= t : > > Thank you so much...that worked - I was missing the [1].content. > > But let's say I have another 'Example' custom style under it... w/o= Lua > filter > > it renders this structure: > > > > ``` > >
> > > > Scope > > > >
> > > >
> > > > Test body > > > >
> > > >
> > > > Test nested > > > >
> > ``` > > > > And with filter below it fails on line 8 w/ this error "Inline, lis= t of > > Inlines, or string expected, got Blocks"... any idea on how to > troubleshoot > > such issues?: > > > > ``` > > return { > > { > > Div =3D function (div) > > if (div.attributes['custom-style'] =3D=3D 'Internal Heading') then > > return pandoc.Header(2, div.content[1].content) > > end > > if (div.attributes['custom-style'] =3D=3D 'Example') then > > return pandoc.Header(2, div.content[1].content) > > end > > > > return div > > end, > > } > > } > > ``` > > On Friday, February 17, 2023 at 1:10:11 AM UTC-7 Bastien DUMONT wro= te: > > > > In this case, it would be preferable to turn the div into a Header > element > > and let Pandoc format it itself: > > > > ``` > > function Div(div) > > if div.attributes['custom-style'] =3D=3D 'Internal Heading' then > > return pandoc.Header(2, div.content[1].content) > > end > > end > > ``` > > > > Le Thursday 16 February 2023 =C3=A0 08:00:08PM, Ben Menashe a =C3= =A9crit : > > > Hi, > > > We have a need to convert docx to gfm. > > > Since docx has some user defined styles we use this "+styles" > extension: > > > > > > > > > pandoc --to=3Dgfm -f docx+styles --output=3Drtb.md --extract-medi= a=3D. --wrap > =3D > > none > > > 'rtb.docx' > > > > > > > > > So now we have html div that wraps our content. =C2=A0Let's say I= want to > > transform > > > this: > > > > > >
> > > > > > Scope > > > > > >
> > > > > > Into: > > > > > > ## Scope > > > > > > How can it be done? I tried to setup a Lua filter but not having > success > > to > > > have it output "##" along with the div content. > > > > > > > > > -- > > > You received this message because you are subscribed to the Googl= e > Groups > > > "pandoc-discuss" group. > > > To unsubscribe from this group and stop receiving emails from it,= send > an > > email > > > to [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [2][1][1]https:// > groups.google.com/ > > d/msgid/ > > > pandoc-discuss/3909f520-e8db-4cf9-900d-6a5a858c1a18n%[2] > > [2]40googlegroups.com. > > > > > > References: > > > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [2] [3][3]https://groups.google.com/d/msgid/pandoc-discuss/ > > 3909f520-e8db-4cf9-900d-6a5a858c1a18n%[4]40googlegroups.com?utm_med= ium=3D > email& > > utm_source=3Dfooter > > > > > > -- > > 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, s= end an > email > > to [4]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [5][5]https://groups.googl= e.com/ > d/msgid/ > > pandoc-discuss/52ada5c3-e26e-4c8c-8b3f-b55bb8ce8e1en%[6] > 40googlegroups.com. > > > > References: > > > > [1] [7]https://groups.google.com/d/msgid/ > > [2] [8]http://40googlegroups.com/ > > [3] [9]https://groups.google.com/d/msgid/pandoc-discuss/ > 3909f520-e8db-4cf9-900d-6a5a858c1a18n%40googlegroups.com?utm_medium= =3Demail& > utm_source=3Dfooter > > [4] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [5] [10]https://groups.google.com/d/msgid/pandoc-discuss/ > 52ada5c3-e26e-4c8c-8b3f-b55bb8ce8e1en%40googlegroups.com?utm_medium= =3Demail& > utm_source=3Dfooter >=20 >=20 > -- > 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 [11]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [12]https://groups.google.com/d/= msgid/ > pandoc-discuss/ef5a0088-1df4-4540-98d5-a0120df8f3cen%40googlegroups.com. >=20 > References: >=20 > [1] https://groups.google.com/ > [2] http://40googlegroups.com/ > [3] https://groups.google.com/d/msgid/pandoc-discuss/ > [4] http://40googlegroups.com/?utm_medium=3Demail& > [5] https://groups.google.com/d/msgid/ > [6] http://40googlegroups.com/ > [7] https://groups.google.com/d/msgid/ > [8] http://40googlegroups.com/ > [9] https://groups.google.com/d/msgid/pandoc-discuss/3909f520-e8db-4cf9-9= 00d-6a5a858c1a18n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter > [10] https://groups.google.com/d/msgid/pandoc-discuss/52ada5c3-e26e-4c8c-= 8b3f-b55bb8ce8e1en%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfoote= r > [11] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [12] https://groups.google.com/d/msgid/pandoc-discuss/ef5a0088-1df4-4540-= 98d5-a0120df8f3cen%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfoote= r --=20 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 e= mail 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/Y/EpdXKr25so/9fM%40localhost.