public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* org-mode verse blocks in docx
@ 2021-09-17 19:17 Charles Pletcher
       [not found] ` <8779cbcd-caf4-485f-a73d-3bf2b0c57e60n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Pletcher @ 2021-09-17 19:17 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1367 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 1934 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: org-mode verse blocks in docx
       [not found] ` <8779cbcd-caf4-485f-a73d-3bf2b0c57e60n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-09-18 18:33   ` John MacFarlane
  0 siblings, 0 replies; 2+ messages in thread
From: John MacFarlane @ 2021-09-18 18:33 UTC (permalink / raw)
  To: Charles Pletcher, pandoc-discuss


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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-18 18:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 19:17 org-mode verse blocks in docx Charles Pletcher
     [not found] ` <8779cbcd-caf4-485f-a73d-3bf2b0c57e60n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-18 18:33   ` John MacFarlane

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).