From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32883 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: docx+styles to dokuwiki somehow ? Date: Tue, 27 Jun 2023 09:53:42 +0000 Message-ID: References: <16df0de5-a608-4e6e-9545-3fa338229d8fn@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="9583"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBKHD5KSAMGQEOHFQSTY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Jun 27 11:53:49 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wr1-f55.google.com ([209.85.221.55]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qE5OP-0002Jr-Eb for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 27 Jun 2023 11:53:49 +0200 Original-Received: by mail-wr1-f55.google.com with SMTP id ffacd0b85a97d-313e6020882sf1139000f8f.1 for ; Tue, 27 Jun 2023 02:53:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687859629; cv=pass; d=google.com; s=arc-20160816; b=D8s/1pJb5c919FwjcfzRfDvYtScG1NorClOBCCF9BQXK9YVxRDOjZRBspqbeG8M1h4 +ridspvH3y4ar5sEru3/cqUzWOkSt6vC3mEHC2muRysdOHEUDiCOJTTg8s6mQ/HqpTKm h4QjsG66KKp1qo4msYZAQEcmHXvWUIyeDxoWDf+Rr9eC7GS6cPbwhZiMHjTnEE4rr1NL AvDQB1ydJZ4l0mNSlVda3iuKbwWyoHU5ar8cfdjh/cfEjeze/SEOP+rS2vjn4wOQecwN 6VMvPns84x7NmmEZ1xZuDoifgnmXpJnqZBOEyU/e9gJoHPgXEjfUN+2hFkQ/CA55cdsF iexQ== 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=Se4x15m6tGXPYkIpN8lMxKnPYMoSrQUaDJZ97TqkTzE=; b=lQqkPNvo7fwIL4HMpdJIJtvWC0iSo5lZpxr1dZQXsE6g+yTQC7GNMQRc0fEKzyioqL fhoTBFgoY/4gu1y/Va4S+hiU7z4cgGazl52jDdTWaZDrbdJygiDUXBYjU6ZeuTRpBbv3 52ivWTTU10UFSAWdYFVmjtVHUdUGn+cbdpsBQL4vMsoO2OBBzpZA+By9lkGfhBBByOcP 1Uysbh/EPNMFLaivSa6Wk/SFNfoiggh+w/gdmL8BNo25pzht/5JRNvhq/Dq5aOVYrLRh n76ho9SUeC/6k/k36XeLsvomQeCDFkLk0OeeXrlHxGcmeo7cu4MX4uHdZ/RQkE1EoDE/ csmw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=imB6qWKF; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 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=20221208; t=1687859629; x=1690451629; 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=Se4x15m6tGXPYkIpN8lMxKnPYMoSrQUaDJZ97TqkTzE=; b=GZHUQIcGOYoWBxQXWET3xRYkDkANTSebTNGRCefe/Z6GSrHx+kTC0nIcLxwghZVSUl hQhNjeF4+g+Nbo06o1CMz3lMmPSMnwTb/OV7erp++AznKPxNWuBKDUkP4n0TyTb6nPro NijpO+iqakNn1oWjBQSumCrKIexNg+pNJz/IorMaX7wfX6bFz/iOE+NlK16x0g6i2vLp DOqrlmbh5nLmfdx/OikQ9YY4PgRB9P5EpUWUE99pYq+XdzpPVRTy24/m6c8Eq4AM2tnw k28zA0Vd1cV0MX/HW X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687859629; x=1690451629; 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-beenthere :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=Se4x15m6tGXPYkIpN8lMxKnPYMoSrQUaDJZ97TqkTzE=; b=WY4dFCspTJkqRgC3h6i1ur1bxM/tjzGAfFYcdm1x96fBiy16GGE3jrKurGaQJAzRrc bp+85Sf7WRLxzPILkJpCVG6zqTQgMlzKJTHvRFrdh/Qsj+3Lc+JmzqLeHJovXhzQpZcm Qi345rMYqpdARCDBVoxdrw7JwDQW7xGYkRYtadjdGozJsLqEWpPx2DMF4x/vr7LSj4k9 VTmSN16I7SZfoIrC6o+hq99eT0l7 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDz4hr5mkdPcGzAEO4q/RE7QBW/rAbewyhKtlRBqIU5rwTPCgaSR ay5FnfWZsrDH28i4rJSK0ro= X-Google-Smtp-Source: ACHHUZ4e02MDwKAN/dTovw0X09pqJVsWIqrYpHM0MLPSTfrd2AcR1L5JUsELQV5UuZkUd7vrr+KohA== X-Received: by 2002:adf:eb02:0:b0:310:faf6:1922 with SMTP id s2-20020adfeb02000000b00310faf61922mr33240541wrn.7.1687859628376; Tue, 27 Jun 2023 02:53:48 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:600c:1c26:b0:3fa:8cb0:57ef with SMTP id j38-20020a05600c1c2600b003fa8cb057efls551950wms.1.-pod-prod-00-eu-canary; Tue, 27 Jun 2023 02:53:43 -0700 (PDT) X-Received: by 2002:a5d:6692:0:b0:311:108c:1fe6 with SMTP id l18-20020a5d6692000000b00311108c1fe6mr36251630wru.33.1687859623696; Tue, 27 Jun 2023 02:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687859623; cv=none; d=google.com; s=arc-20160816; b=ao7fmvAwwokO+Oy2eqGB8ddy6yHA+c06T/YVrq+E4HpYb7+yWQELxpzX0rIqxEzzLZ znUR1iyYeLrYqG818gSwigwicqs7+5qBnU0ZyPTZIN0lYfC+VKmc+aZj9SFlMVN7wULq Zeh+4o3DxdMCvMWSyJECLlJyR+brFdr4Wd5zcDxn4GjydL4oEzmd2fllzCrcmdU2dXsF 0U1XNiwE49uj4zD7wHjRINLHdLCYjnTfsO/QIqVnPH6cHrdryLY/uZ1AI+0kKN/+ojQA 3EIx3jvbqY8GzmJ0v4ylNxKnPMZ6Nz4q2Fa6173FH1kOnrQS19y1GiUWeB79XmgkFRV8 +LUA== 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=fUwjuHbab+voUK4P+tj0Ti74LhknSc7mh/GFDCweQ7w=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=qvMksd+nvUhS5F9TOgq9vOcdEQKMF/rLr+AwhWEzGmgNBXJa7t/3CMI6udfpfZOTYD CZvaqJ/ZFDudpPJCUSAmyU20RdWdP0ByDGjHj9uMB5OAbBeesO0+7w7WUdi8tnGPgWaZ hz3LNnfpW8Si/jg8bchjIqWC98Jy5d3EwpvwUrIkytLWVLw0/059HkwE1W9O5EZGMHGs tStoUBbzr/6v4Z51W9HuZR8wHL0Rj3l5P7jaWMQwfHmhO3tulCNP3ObO4aDGv2dq3RsH FhZaVm/2t793UqKPhx7MrwutXImwZm/vAdBB+1YyGf2QlkJSt3l5tz2yohBXVfyBLEe/ UQOQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=imB6qWKF; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 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 mout02.posteo.de (mout02.posteo.de. [185.67.36.66]) by gmr-mx.google.com with ESMTPS id d18-20020a05600c34d200b003f9c0df6ab4si562333wmq.2.2023.06.27.02.53.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 02:53:43 -0700 (PDT) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) client-ip=185.67.36.66; Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 502B8240101 for ; Tue, 27 Jun 2023 11:53:43 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Qr0Qt6lxkz9rxB for ; Tue, 27 Jun 2023 11:53:42 +0200 (CEST) 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=imB6qWKF; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 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:32883 Archived-At: I think that it is worth a bug report if it has not been done yet. As a wor= karound, you can expand the filter to remove all divs with custom-style fro= m the bullet lists. ``` function Div (div) local custom_style =3D div.attributes['custom-style'] if custom_style then local pre =3D pandoc.RawBlock('dokuwiki', '') table.insert(div.content, post) table.insert(div.content, 1, pre) return div.content end end local remove_custom_styles =3D { Div =3D function(div) if div.attributes['custom-style'] then return div.content end end } function BulletList(list) -- Do the same for all types that are badly handled with docx+styles -- (e.g. OrderedList) return list:walk(remove_custom_styles) end return { -- We must process the bullet lists first to remove the divs -- before they are converted to raw code. { BulletList =3D BulletList }, { Div =3D Div } } ``` Le Tuesday 27 June 2023 =C3=A0 02:35:06AM, Sigismond a =C3=A9crit : > Well=E2=80=A6 it does work but, somehow, docx+styles messes with the list= s : > For a simple docx with just one list, unordered here is what I get with -= f > docx+styles -t dokuwiki : >
    >
  • Liste 1

    >
  • >
  • liste 2

    >
  • >
  • liste 3

    >=20 >
      >
    • liste 3a

      >
    • >
    • liste 3b

      >
    • >
    • liste 3c

      >
    >
  • >
  • liste 4

    >
>=20 > Which is not parsed by dokuwiki. >=20 >=20 > Without +styles : > =C2=A0 * Liste 1 > =C2=A0 * liste 2 > =C2=A0 * liste 3 > =C2=A0 =C2=A0 * liste 3a > =C2=A0 =C2=A0 * liste 3b > =C2=A0 =C2=A0 * liste 3c > =C2=A0 * liste 4 >=20 > Which is syntactically correct dokuwiki format. >=20 > If I understand it well, Pandoc seems to consider an ordered list badly > formatted only when +styles is applied and it spits out some raw html wit= h

> tags inside

  • s >=20 > So what is it ? Bad implementation in Dokuwiki writer ?=C2=A0 > How can I benefit from both +styles, with my lua filter, and lists ?=C2= =A0 >=20 > -- > =C2=A0 Pascal > Le lundi 26 juin 2023 =C3=A0 16:04:17 UTC+2, Sigismond a =C3=A9crit=C2=A0= : >=20 > Thanks a lot Bastien, it works perfectly well. >=20 > Le lundi 26 juin 2023 =C3=A0 15:47:00 UTC+2, Bastien DUMONT a =C3=A9c= rit=C2=A0: >=20 > With `-f docx+styles`, you can replace the divs with custom style= s with > this kind of filter: >=20 > ``` > function Div (div) > local custom_style =3D div.attributes['custom-style'] > if custom_style then > local pre =3D pandoc.RawBlock('dokuwiki', ' '">') > local post =3D pandoc.RawBlock('dokuwiki', '') > local content =3D div.content > table.insert(content, 1, pre) > table.insert(content, post) > return content > end > end > ``` >=20 > Le Monday 26 June 2023 =C3=A0 06:16:48AM, Sigismond a =C3=A9crit = : > > OK, let's try it another way : > > > > I plan to use Pandoc to convert several docx files to dokuwiki > format. > > I need to retain custom block styles and convert them to custom= tags, > something > > like=C2=A0 > > > > > > my dokuwiki formatted block text > > > > > > Do I need to develop a custom dokuwiki writer from scratch to d= o that > or is > > there a way to use lua filters for this purpose. > > Sorry if the answer is obvious but I struggle to find relevant > information. > > > > Thanks for any help, > > -- > > =C2=A0 Pascal > > > > > > Le mercredi 26 avril 2023 =C3=A0 16:14:20 UTC+2, pascal Conil-l= acoste a > =C3=A9crit=C2=A0: > > > > Hi everybody, > > > > I've been using pandoc for some years to accomplish very > straightforward > > conversions. > > Now that what I plan to do is a little more complex, I struggle= to > find > > relevant information. > > > > I need to convert docx to dokuwiki and retain Word custom style= s. I > thought > > I could use docx+styles to get custom-styles in dokuwiki files = but > they > > don't make it to the output and get stripped. > > > > I would be happy with ::: {custom-style=3D"myStyle"} my text he= re::: > > > > If I could get something along these lines, I would be able to = apply > some > > other simple transformation to get to the final dokuwiki files = and > treat > > them with a plugin. > > > > What is the best way to achieve this ? Filters ? Templates ? > > > > Any help welcome! > > > > -- > > You received this message because you are subscribed to the Goo= gle > Groups > > "pandoc-discuss" group. > > To unsubscribe from this group and stop receiving emails from i= t, > send an email > > to [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2][1]https:// > groups.google.com/d/msgid/ > > pandoc-discuss/bdc377c4-3918-4f0f-a87e-a66f9d128cc2n%[2] > 40googlegroups.com. > > > > References: > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2] [3]https://groups.google.com/d/msgid/pandoc-discuss/ > bdc377c4-3918-4f0f-a87e-a66f9d128cc2n%40googlegroups.com?utm_medi= um=3D > email&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 [4]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [5]https://groups.google.com/d/m= sgid/ > pandoc-discuss/f0b95670-24a3-4870-842f-fb6e7791a694n%40googlegroups.com. >=20 > References: >=20 > [1] https://groups.google.com/d/msgid/ > [2] http://40googlegroups.com/ > [3] https://groups.google.com/d/msgid/pandoc-discuss/bdc377c4-3918-4f0f-a= 87e-a66f9d128cc2n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter > [4] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [5] https://groups.google.com/d/msgid/pandoc-discuss/f0b95670-24a3-4870-8= 42f-fb6e7791a694n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter --=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/ZJqxpgF3fu2oa_vm%40localhost.