public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Bastien DUMONT <bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: docx -> gfm with custom styles
Date: Fri, 17 Feb 2023 08:10:03 +0000	[thread overview]
Message-ID: <Y+82W6+ZIQlExrwL@localhost> (raw)
In-Reply-To: <3909f520-e8db-4cf9-900d-6a5a858c1a18n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

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'] == 'Internal Heading' then
    return pandoc.Header(2, div.content[1].content)
  end
end
```

Le Thursday 16 February 2023 à 08:00:08PM, Ben Menashe a écrit :
> Hi,
> We have a need to convert docx to gfm.
> Since docx has some user defined styles we use this "+styles" extension:
> 
> 
> pandoc --to=gfm -f docx+styles --output=rtb.md --extract-media=. --wrap=none
> 'rtb.docx'
> 
> 
> So now we have html div that wraps our content.  Let's say I want to transform
> this:
> 
> <div custom-style="Internal Heading">
> 
> Scope
> 
> </div>
> 
> 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 Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [2]https://groups.google.com/d/msgid/
> pandoc-discuss/3909f520-e8db-4cf9-900d-6a5a858c1a18n%40googlegroups.com.
> 
> References:
> 
> [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [2] https://groups.google.com/d/msgid/pandoc-discuss/3909f520-e8db-4cf9-900d-6a5a858c1a18n%40googlegroups.com?utm_medium=email&utm_source=footer

-- 
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/Y%2B82W6%2BZIQlExrwL%40localhost.


  parent reply	other threads:[~2023-02-17  8:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  4:00 Ben Menashe
     [not found] ` <3909f520-e8db-4cf9-900d-6a5a858c1a18n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-17  8:10   ` Bastien DUMONT [this message]
2023-02-17 15:00     ` Ben Menashe
     [not found]       ` <52ada5c3-e26e-4c8c-8b3f-b55bb8ce8e1en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-18  8:19         ` Bastien DUMONT
2023-02-18 19:26           ` Ben Menashe
     [not found]             ` <ef5a0088-1df4-4540-98d5-a0120df8f3cen-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-18 19:39               ` Bastien DUMONT
2023-02-18 19:46                 ` Ben Menashe
     [not found]                   ` <5aeae8ad-aec8-4f00-b51c-9ffddf8c112fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-18 19:59                     ` Bastien DUMONT
2023-02-18 20:15                       ` Ben Menashe
     [not found]                         ` <085f9581-c85a-4511-ad94-ec9bca0ab8c8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-20 21:24                           ` Ben Menashe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+82W6+ZIQlExrwL@localhost \
    --to=bastien.dumont-vwifzpto/vqstnjn9+bgxg@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).