public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: Charles Pletcher <cp2924-WLbs8XpHrcb2fBVCVOL8/A@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: org-mode verse blocks in docx
Date: Sat, 18 Sep 2021 11:33:48 -0700	[thread overview]
Message-ID: <m2tuihivhv.fsf@Johns-Air.hsd1.ca.comcast.net> (raw)
In-Reply-To: <8779cbcd-caf4-485f-a73d-3bf2b0c57e60n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


Currently verse blocks are parsed as pandoc LineBlock elements.
When rendered to docx, they appear as regular paragraphs with
hard breaks, so there is no styling.

However, you could try using a filter that puts each LineBlock
element into a Div with a custom style attribute.
Then the docx writer will add this style.

How to do that?  See the documentation on Lua filters on the
website. With a Lua filter it would be something like this:

function LineBlock(el)
  local div = pandoc.Div({el})
  div.attributes['custom-style'] = 'Poetry'
  return div
end

Save this as poetry.lua.  Then invoke with

pandoc --lua-filter poetry.lua yourfile.org -o yourfile.docx

Charles Pletcher <cp2924-WLbs8XpHrcb2fBVCVOL8/A@public.gmane.org> writes:

> Apologies if this question has already been answered, but I couldn't find 
> anything for this specific conversion by searching around.
>
> I'm trying to export org-mode containing verse blocks to docx, but the docx 
> output doesn't have any style attached to the verse blocks that I can 
> modify in my reference.docx.
>
> I want to be able to format verses via Word's styles so that I don't need 
> to format each block individually.
>
> Is it possible to do this, or am I missing something simple?
>
> Minimal example for what I'm trying to do:
>
> input.org:
>
> #+begin_verse
> λείπου μηδὲ σύ, παρθέν', ἐπ' οἴκων,
> μεγάλους μὲν ἰδοῦσα νέους θανάτους,
> πολλὰ δὲ πήματα  καινοπαθῆ·
> κοὐδὲν τούτων ὅ τι μὴ Ζεύς.
> #+end_verse
>
> pandoc -i input.org -o output.docx
>
> You'll see that the verse just has the "Body Text" style.
>
> Thanks,
> Charles
>
>
> -- 
> 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/8779cbcd-caf4-485f-a73d-3bf2b0c57e60n%40googlegroups.com.

-- 
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/m2tuihivhv.fsf%40Johns-Air.hsd1.ca.comcast.net.


      parent reply	other threads:[~2021-09-18 18:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 19:17 Charles Pletcher
     [not found] ` <8779cbcd-caf4-485f-a73d-3bf2b0c57e60n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-18 18:33   ` John MacFarlane [this message]

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=m2tuihivhv.fsf@Johns-Air.hsd1.ca.comcast.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=cp2924-WLbs8XpHrcb2fBVCVOL8/A@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).