* Markdown/HTML: Convert CSS styles to ODT styles (enhancement)
@ 2023-11-06 15:23 Kelly “STrRedWolf” Price
[not found] ` <9b60d1f7-098c-4e8e-a801-764d0b754ef0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Kelly “STrRedWolf” Price @ 2023-11-06 15:23 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1094 bytes --]
Hello all. Using Pandoc to help convert my fiction (written in Markdown)
into ODT format so I can combine and publish... but in writing, I found a
specific use case.
I need colored text.
For instance, if I define a CSS stylesheet file to color said text, I can
use this Markdown:
[Are the good guys really good if they use it for cover for evil?]{.rose}
I can work around it a bit by exporting to HTML
(markdown_phpextra+bracketed_spans) and opening that into LibreOffice, but
that opens a whole can of LibreOffice worms relating to web vs PDF/print
formatting.
Is there a way for Pandoc to translate the CSS stylesheet into ODT styles,
and apply said styles as wanted?
--
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/9b60d1f7-098c-4e8e-a801-764d0b754ef0n%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 1543 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Markdown/HTML: Convert CSS styles to ODT styles (enhancement)
[not found] ` <9b60d1f7-098c-4e8e-a801-764d0b754ef0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-11-06 16:04 ` 'William Lupton' via pandoc-discuss
[not found] ` <CAEe_xxg-6qcmSgvqtHCZgBMBG3UyMhLyLai1xU2Aa39n+ZJfvQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-11-07 14:30 ` jcr
1 sibling, 1 reply; 8+ messages in thread
From: 'William Lupton' via pandoc-discuss @ 2023-11-06 16:04 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 2394 bytes --]
This isn't an answer to your question, but it reminds me of a similar Typst
discussion: https://github.com/jgm/pandoc/issues/8988. This issue is closed
but I still intend (at some point) to act on jgm's suggestions (this hasn't
been urgent for me because my custom writer is fine for now).
So anyway, couldn't there be a similar approach for ODT or for any other
non-HTML output format? an ODT-specific filter could set odt-style
attributes that would be honored by the ODT writer in some appropriate
ODT-specific way.
On Mon, 6 Nov 2023 at 15:23, Kelly “STrRedWolf” Price <strredwolf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> Hello all. Using Pandoc to help convert my fiction (written in Markdown)
> into ODT format so I can combine and publish... but in writing, I found a
> specific use case.
>
> I need colored text.
>
> For instance, if I define a CSS stylesheet file to color said text, I can
> use this Markdown:
>
> [Are the good guys really good if they use it for cover for evil?]{.rose}
>
> I can work around it a bit by exporting to HTML
> (markdown_phpextra+bracketed_spans) and opening that into LibreOffice, but
> that opens a whole can of LibreOffice worms relating to web vs PDF/print
> formatting.
>
> Is there a way for Pandoc to translate the CSS stylesheet into ODT styles,
> and apply said styles as wanted?
>
> --
> 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/9b60d1f7-098c-4e8e-a801-764d0b754ef0n%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/9b60d1f7-098c-4e8e-a801-764d0b754ef0n%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/CAEe_xxg-6qcmSgvqtHCZgBMBG3UyMhLyLai1xU2Aa39n%2BZJfvQ%40mail.gmail.com.
[-- Attachment #2: Type: text/html, Size: 3296 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Markdown/HTML: Convert CSS styles to ODT styles (enhancement)
[not found] ` <CAEe_xxg-6qcmSgvqtHCZgBMBG3UyMhLyLai1xU2Aa39n+ZJfvQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-11-06 18:23 ` Bastien DUMONT
0 siblings, 0 replies; 8+ messages in thread
From: Bastien DUMONT @ 2023-11-06 18:23 UTC (permalink / raw)
To: 'William Lupton' via pandoc-discuss
The problem is that the ODT format does not permit to include formatting instructions in the document body. See the flat ODT document below (conversion from `With _emphasis_.`, abridged):
```
<?xml version="1.0" encoding="utf-8" ?>
<office:document-content>
<office:styles/>
<office:automatic-styles>
<style:style style:name="T1" style:family="text">
<style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" />
</style:style>
</office:automatic-styles>
<office:body>
<office:text>
<text:p text:style-name="Text_20_body">With
<text:span text:style-name="T1">emphasis</text:span>.</text:p>
</office:text>
</office:body>
</office:document-content>
```
All predefined styles (removed for conciseness) are stored in <office:styles>. When we apply direct formatting in LibreOffice, a new style is automatically created in <office:automatic-styles> with the formatting instructions. Pandoc rightly replicates this behaviour when converting. There are no direct formatting instructions in <office:body>, only predefined and automatic styles.
Part of the solution is to use a filter to enclose the spans with class "rose" in <text:span> elements with the attribute `text:style-name="custom_rose"`. Here is a basic implementation:
``` custom-odt-style.lua
function Span(span)
if span.classes:includes('rose') then
return {
pandoc.RawInline('opendocument', '<text:span text:style-name="custom_rose">'),
span,
pandoc.RawInline('opendocument', '</text:span>')
}
end
end
```
Then, one has to add a style definition in the ODT file. Please correct me if I am wrong, but I think that this is currently not possible with a filter (it would require a function to decode ZIP archives in pandoc.zip). However, an external script could extract the file content.xml from the ODT file (which is a ZIP archive) produced by Pandoc, add the right <style:style> element in <office:styles>, and update the ODT with the new content.xml. The following bash script would do the job:
``` add-style-to-odt.sh
#!/bin/bash
7z x "$1" content.xml
sed -i 's%<office:styles>%<office:styles><style:style style:name="custom_rose" style:family="text" style:parent-style-name="Text_20_body"><style:text-properties fo:background-color="#ff99ff"/></style:style>%' content.xml
7z a "$1" content.xml && rm content.xml
```
The invocation would be someting like: pandoc -o myfile.odt -L custom-odt-style.lua myfile.md && ./add-style-to-odt.sh myfile.odt
Le Monday 06 November 2023 à 04:04:06PM, 'William Lupton' via pandoc-discuss a écrit :
> This isn't an answer to your question, but it reminds me of a similar Typst
> discussion: [1]https://github.com/jgm/pandoc/issues/8988. This issue is closed
> but I still intend (at some point) to act on jgm's suggestions (this hasn't
> been urgent for me because my custom writer is fine for now).
>
> So anyway, couldn't there be a similar approach for ODT or for any other
> non-HTML output format? an ODT-specific filter could set odt-style attributes
> that would be honored by the ODT writer in some appropriate ODT-specific way.
>
> On Mon, 6 Nov 2023 at 15:23, Kelly “STrRedWolf” Price <[2]strredwolf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> wrote:
>
> Hello all. Using Pandoc to help convert my fiction (written in Markdown)
> into ODT format so I can combine and publish... but in writing, I found a
> specific use case.
>
> I need colored text.
>
> For instance, if I define a CSS stylesheet file to color said text, I can
> use this Markdown:
>
> [Are the good guys really good if they use it for cover for evil?]{.rose}
>
> I can work around it a bit by exporting to HTML
> (markdown_phpextra+bracketed_spans) and opening that into LibreOffice, but
> that opens a whole can of LibreOffice worms relating to web vs PDF/print
> formatting.
>
> Is there a way for Pandoc to translate the CSS stylesheet into ODT styles,
> and apply said styles as wanted?
>
> --
> 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 [3]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [4]https://groups.google.com/d/
> msgid/pandoc-discuss/
> 9b60d1f7-098c-4e8e-a801-764d0b754ef0n%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 [5]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [6]https://groups.google.com/d/msgid/
> pandoc-discuss/
> CAEe_xxg-6qcmSgvqtHCZgBMBG3UyMhLyLai1xU2Aa39n%2BZJfvQ%40mail.gmail.com.
>
> References:
>
> [1] https://github.com/jgm/pandoc/issues/8988
> [2] mailto:strredwolf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> [3] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [4] https://groups.google.com/d/msgid/pandoc-discuss/9b60d1f7-098c-4e8e-a801-764d0b754ef0n%40googlegroups.com?utm_medium=email&utm_source=footer
> [5] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [6] https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxg-6qcmSgvqtHCZgBMBG3UyMhLyLai1xU2Aa39n%2BZJfvQ%40mail.gmail.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/ZUkvGy7Q8PsGmaM6%40localhost.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Markdown/HTML: Convert CSS styles to ODT styles (enhancement)
[not found] ` <9b60d1f7-098c-4e8e-a801-764d0b754ef0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-11-06 16:04 ` 'William Lupton' via pandoc-discuss
@ 2023-11-07 14:30 ` jcr
[not found] ` <8f4c5470-82f5-44c8-8f17-3f807ccdbd11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
1 sibling, 1 reply; 8+ messages in thread
From: jcr @ 2023-11-07 14:30 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1689 bytes --]
If you're willing to use docx instead of ODT, you can take advantage of
pandoc's support for Custom Styles
<https://pandoc.org/MANUAL.html#custom-styles> and avoid the XML wrangling.
You simply get a copy of the default reference doc with `pandoc -o
custom-reference.docx --print-default- data-file reference.docx`, add a
Rose style to `custom-reference.docx`, and give a `custom-style=Rose`
attribute in Markdown to colored text.
On Monday, November 6, 2023 at 10:23:36 AM UTC-5 Kelly “STrRedWolf” Price
wrote:
> Hello all. Using Pandoc to help convert my fiction (written in Markdown)
> into ODT format so I can combine and publish... but in writing, I found a
> specific use case.
>
> I need colored text.
>
> For instance, if I define a CSS stylesheet file to color said text, I can
> use this Markdown:
>
> [Are the good guys really good if they use it for cover for evil?]{.rose}
>
> I can work around it a bit by exporting to HTML
> (markdown_phpextra+bracketed_spans) and opening that into LibreOffice, but
> that opens a whole can of LibreOffice worms relating to web vs PDF/print
> formatting.
>
> Is there a way for Pandoc to translate the CSS stylesheet into ODT styles,
> and apply said styles as wanted?
>
--
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/8f4c5470-82f5-44c8-8f17-3f807ccdbd11n%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 2280 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Markdown/HTML: Convert CSS styles to ODT styles (enhancement)
[not found] ` <8f4c5470-82f5-44c8-8f17-3f807ccdbd11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-11-07 15:28 ` Kelly Price
[not found] ` <CAKzFY7T9oPjduCwp32o2UB8wOrMOUJhu2k0yUfdJBrMv-BKRdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Kelly Price @ 2023-11-07 15:28 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
Okay, so before I go completely crazy, following the DOCX route.
Using Pandoc 2.9.2.1 currently (it's in Ubuntu's repos).
custom-ref.docx file has the style definition for "Rose" and it's
going through to the text document. Using:
pandoc --reference-doc=custom-ref.docx test.md -f
'markdown_phpextra+bracketed_spans' -t docx -o test.docx
test.md has:
[Good evening, Drake.]{custom-style="Rose"}
When I run it, the style does not get applied to the bracketed text. Any ideas?
On Tue, Nov 7, 2023 at 9:30 AM jcr <ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> If you're willing to use docx instead of ODT, you can take advantage of pandoc's support for Custom Styles and avoid the XML wrangling. You simply get a copy of the default reference doc with `pandoc -o custom-reference.docx --print-default- data-file reference.docx`, add a Rose style to `custom-reference.docx`, and give a `custom-style=Rose` attribute in Markdown to colored text.
>
> On Monday, November 6, 2023 at 10:23:36 AM UTC-5 Kelly “STrRedWolf” Price wrote:
>>
>> Hello all. Using Pandoc to help convert my fiction (written in Markdown) into ODT format so I can combine and publish... but in writing, I found a specific use case.
>>
>> I need colored text.
>>
>> For instance, if I define a CSS stylesheet file to color said text, I can use this Markdown:
>>
>> [Are the good guys really good if they use it for cover for evil?]{.rose}
>>
>> I can work around it a bit by exporting to HTML (markdown_phpextra+bracketed_spans) and opening that into LibreOffice, but that opens a whole can of LibreOffice worms relating to web vs PDF/print formatting.
>>
>> Is there a way for Pandoc to translate the CSS stylesheet into ODT styles, and apply said styles as wanted?
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "pandoc-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/xMuBWNkXPRI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/8f4c5470-82f5-44c8-8f17-3f807ccdbd11n%40googlegroups.com.
--
Kelly "STrRedWolf" Price
http://redwolf.ws
--
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/CAKzFY7T9oPjduCwp32o2UB8wOrMOUJhu2k0yUfdJBrMv-BKRdA%40mail.gmail.com.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Markdown/HTML: Convert CSS styles to ODT styles (enhancement)
[not found] ` <CAKzFY7T9oPjduCwp32o2UB8wOrMOUJhu2k0yUfdJBrMv-BKRdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-11-07 16:21 ` jcr
[not found] ` <62ec21c7-f152-42b1-8b24-b78f8f56a2cen-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: jcr @ 2023-11-07 16:21 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 3381 bytes --]
I tried it with pandoc 3.1.9, and it worked for me, but make sure you're
defining a character style called "Rose" and not a paragraph style called
"Rose." I forgot to mention that important detail. Character styles are
used for spans with `custom-style` attributes. Paragraph styles are used
for paragraphs in divs with `custom-style` attributes.
On Tuesday, November 7, 2023 at 10:28:36 AM UTC-5 Kelly Price wrote:
> Okay, so before I go completely crazy, following the DOCX route.
> Using Pandoc 2.9.2.1 currently (it's in Ubuntu's repos).
> custom-ref.docx file has the style definition for "Rose" and it's
> going through to the text document. Using:
>
> pandoc --reference-doc=custom-ref.docx test.md -f
> 'markdown_phpextra+bracketed_spans' -t docx -o test.docx
>
> test.md has:
>
> [Good evening, Drake.]{custom-style="Rose"}
>
> When I run it, the style does not get applied to the bracketed text. Any
> ideas?
>
> On Tue, Nov 7, 2023 at 9:30 AM jcr <ffi.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > If you're willing to use docx instead of ODT, you can take advantage of
> pandoc's support for Custom Styles and avoid the XML wrangling. You simply
> get a copy of the default reference doc with `pandoc -o
> custom-reference.docx --print-default- data-file reference.docx`, add a
> Rose style to `custom-reference.docx`, and give a `custom-style=Rose`
> attribute in Markdown to colored text.
> >
> > On Monday, November 6, 2023 at 10:23:36 AM UTC-5 Kelly “STrRedWolf”
> Price wrote:
> >>
> >> Hello all. Using Pandoc to help convert my fiction (written in
> Markdown) into ODT format so I can combine and publish... but in writing, I
> found a specific use case.
> >>
> >> I need colored text.
> >>
> >> For instance, if I define a CSS stylesheet file to color said text, I
> can use this Markdown:
> >>
> >> [Are the good guys really good if they use it for cover for
> evil?]{.rose}
> >>
> >> I can work around it a bit by exporting to HTML
> (markdown_phpextra+bracketed_spans) and opening that into LibreOffice, but
> that opens a whole can of LibreOffice worms relating to web vs PDF/print
> formatting.
> >>
> >> Is there a way for Pandoc to translate the CSS stylesheet into ODT
> styles, and apply said styles as wanted?
> >
> > --
> > You received this message because you are subscribed to a topic in the
> Google Groups "pandoc-discuss" group.
> > To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/pandoc-discuss/xMuBWNkXPRI/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to
> pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/8f4c5470-82f5-44c8-8f17-3f807ccdbd11n%40googlegroups.com
> .
>
>
>
> --
> Kelly "STrRedWolf" Price
> http://redwolf.ws
>
--
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/62ec21c7-f152-42b1-8b24-b78f8f56a2cen%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 5089 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Markdown/HTML: Convert CSS styles to ODT styles (enhancement)
[not found] ` <62ec21c7-f152-42b1-8b24-b78f8f56a2cen-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-11-07 16:33 ` Kelly Price
[not found] ` <CAKzFY7RU4+aa=cWL1z7dwDjGu7bWWei3xe=Lg4txT5jngy+bRA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Kelly Price @ 2023-11-07 16:33 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
Ahhh, that is what was missing. I was using a paragraph style and not
a character style. Kinda easy to skip over that in the docs.
Now if we can get that feature over on ODTs, that'll cut out having to
use DOCX and forcing more translation...
On Tue, Nov 7, 2023 at 11:22 AM jcr <ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> I tried it with pandoc 3.1.9, and it worked for me, but make sure you're defining a character style called "Rose" and not a paragraph style called "Rose." I forgot to mention that important detail. Character styles are used for spans with `custom-style` attributes. Paragraph styles are used for paragraphs in divs with `custom-style` attributes.
>
> On Tuesday, November 7, 2023 at 10:28:36 AM UTC-5 Kelly Price wrote:
>>
>> Okay, so before I go completely crazy, following the DOCX route.
>> Using Pandoc 2.9.2.1 currently (it's in Ubuntu's repos).
>> custom-ref.docx file has the style definition for "Rose" and it's
>> going through to the text document. Using:
>>
>> pandoc --reference-doc=custom-ref.docx test.md -f
>> 'markdown_phpextra+bracketed_spans' -t docx -o test.docx
>>
>> test.md has:
>>
>> [Good evening, Drake.]{custom-style="Rose"}
>>
>> When I run it, the style does not get applied to the bracketed text. Any ideas?
>>
>> On Tue, Nov 7, 2023 at 9:30 AM jcr <ffi.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> >
>> > If you're willing to use docx instead of ODT, you can take advantage of pandoc's support for Custom Styles and avoid the XML wrangling. You simply get a copy of the default reference doc with `pandoc -o custom-reference.docx --print-default- data-file reference.docx`, add a Rose style to `custom-reference.docx`, and give a `custom-style=Rose` attribute in Markdown to colored text.
>> >
>> > On Monday, November 6, 2023 at 10:23:36 AM UTC-5 Kelly “STrRedWolf” Price wrote:
>> >>
>> >> Hello all. Using Pandoc to help convert my fiction (written in Markdown) into ODT format so I can combine and publish... but in writing, I found a specific use case.
>> >>
>> >> I need colored text.
>> >>
>> >> For instance, if I define a CSS stylesheet file to color said text, I can use this Markdown:
>> >>
>> >> [Are the good guys really good if they use it for cover for evil?]{.rose}
>> >>
>> >> I can work around it a bit by exporting to HTML (markdown_phpextra+bracketed_spans) and opening that into LibreOffice, but that opens a whole can of LibreOffice worms relating to web vs PDF/print formatting.
>> >>
>> >> Is there a way for Pandoc to translate the CSS stylesheet into ODT styles, and apply said styles as wanted?
>> >
>> > --
>> > You received this message because you are subscribed to a topic in the Google Groups "pandoc-discuss" group.
>> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/xMuBWNkXPRI/unsubscribe.
>> > To unsubscribe from this group and all its topics, send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8f4c5470-82f5-44c8-8f17-3f807ccdbd11n%40googlegroups.com.
>>
>>
>>
>> --
>> Kelly "STrRedWolf" Price
>> http://redwolf.ws
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "pandoc-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/xMuBWNkXPRI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/62ec21c7-f152-42b1-8b24-b78f8f56a2cen%40googlegroups.com.
--
Kelly "STrRedWolf" Price
http://redwolf.ws
--
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/CAKzFY7RU4%2Baa%3DcWL1z7dwDjGu7bWWei3xe%3DLg4txT5jngy%2BbRA%40mail.gmail.com.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Markdown/HTML: Convert CSS styles to ODT styles (enhancement)
[not found] ` <CAKzFY7RU4+aa=cWL1z7dwDjGu7bWWei3xe=Lg4txT5jngy+bRA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-11-07 19:10 ` Bastien DUMONT
0 siblings, 0 replies; 8+ messages in thread
From: Bastien DUMONT @ 2023-11-07 19:10 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
In theory, it is possible to implement the custom-styles extension for the ODT format, but it requires someone willing to work on it... However, if you want to stick to ODT (which I approve), the solution I proposed just works.
Le Tuesday 07 November 2023 à 11:33:20AM, Kelly Price a écrit :
> Ahhh, that is what was missing. I was using a paragraph style and not
> a character style. Kinda easy to skip over that in the docs.
>
> Now if we can get that feature over on ODTs, that'll cut out having to
> use DOCX and forcing more translation...
>
> On Tue, Nov 7, 2023 at 11:22 AM jcr <ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > I tried it with pandoc 3.1.9, and it worked for me, but make sure you're defining a character style called "Rose" and not a paragraph style called "Rose." I forgot to mention that important detail. Character styles are used for spans with `custom-style` attributes. Paragraph styles are used for paragraphs in divs with `custom-style` attributes.
> >
> > On Tuesday, November 7, 2023 at 10:28:36 AM UTC-5 Kelly Price wrote:
> >>
> >> Okay, so before I go completely crazy, following the DOCX route.
> >> Using Pandoc 2.9.2.1 currently (it's in Ubuntu's repos).
> >> custom-ref.docx file has the style definition for "Rose" and it's
> >> going through to the text document. Using:
> >>
> >> pandoc --reference-doc=custom-ref.docx test.md -f
> >> 'markdown_phpextra+bracketed_spans' -t docx -o test.docx
> >>
> >> test.md has:
> >>
> >> [Good evening, Drake.]{custom-style="Rose"}
> >>
> >> When I run it, the style does not get applied to the bracketed text. Any ideas?
> >>
> >> On Tue, Nov 7, 2023 at 9:30 AM jcr <ffi.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >> >
> >> > If you're willing to use docx instead of ODT, you can take advantage of pandoc's support for Custom Styles and avoid the XML wrangling. You simply get a copy of the default reference doc with `pandoc -o custom-reference.docx --print-default- data-file reference.docx`, add a Rose style to `custom-reference.docx`, and give a `custom-style=Rose` attribute in Markdown to colored text.
> >> >
> >> > On Monday, November 6, 2023 at 10:23:36 AM UTC-5 Kelly “STrRedWolf” Price wrote:
> >> >>
> >> >> Hello all. Using Pandoc to help convert my fiction (written in Markdown) into ODT format so I can combine and publish... but in writing, I found a specific use case.
> >> >>
> >> >> I need colored text.
> >> >>
> >> >> For instance, if I define a CSS stylesheet file to color said text, I can use this Markdown:
> >> >>
> >> >> [Are the good guys really good if they use it for cover for evil?]{.rose}
> >> >>
> >> >> I can work around it a bit by exporting to HTML (markdown_phpextra+bracketed_spans) and opening that into LibreOffice, but that opens a whole can of LibreOffice worms relating to web vs PDF/print formatting.
> >> >>
> >> >> Is there a way for Pandoc to translate the CSS stylesheet into ODT styles, and apply said styles as wanted?
> >> >
> >> > --
> >> > You received this message because you are subscribed to a topic in the Google Groups "pandoc-discuss" group.
> >> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/xMuBWNkXPRI/unsubscribe.
> >> > To unsubscribe from this group and all its topics, send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >> > To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8f4c5470-82f5-44c8-8f17-3f807ccdbd11n%40googlegroups.com.
> >>
> >>
> >>
> >> --
> >> Kelly "STrRedWolf" Price
> >> http://redwolf.ws
> >
> > --
> > You received this message because you are subscribed to a topic in the Google Groups "pandoc-discuss" group.
> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/xMuBWNkXPRI/unsubscribe.
> > To unsubscribe from this group and all its topics, 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/62ec21c7-f152-42b1-8b24-b78f8f56a2cen%40googlegroups.com.
>
>
>
> --
> Kelly "STrRedWolf" Price
> http://redwolf.ws
>
> --
> 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/CAKzFY7RU4%2Baa%3DcWL1z7dwDjGu7bWWei3xe%3DLg4txT5jngy%2BbRA%40mail.gmail.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/ZUqLv-GvKI1OwUdS%40localhost.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-11-07 19:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-06 15:23 Markdown/HTML: Convert CSS styles to ODT styles (enhancement) Kelly “STrRedWolf” Price
[not found] ` <9b60d1f7-098c-4e8e-a801-764d0b754ef0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-11-06 16:04 ` 'William Lupton' via pandoc-discuss
[not found] ` <CAEe_xxg-6qcmSgvqtHCZgBMBG3UyMhLyLai1xU2Aa39n+ZJfvQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-11-06 18:23 ` Bastien DUMONT
2023-11-07 14:30 ` jcr
[not found] ` <8f4c5470-82f5-44c8-8f17-3f807ccdbd11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-11-07 15:28 ` Kelly Price
[not found] ` <CAKzFY7T9oPjduCwp32o2UB8wOrMOUJhu2k0yUfdJBrMv-BKRdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-11-07 16:21 ` jcr
[not found] ` <62ec21c7-f152-42b1-8b24-b78f8f56a2cen-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-11-07 16:33 ` Kelly Price
[not found] ` <CAKzFY7RU4+aa=cWL1z7dwDjGu7bWWei3xe=Lg4txT5jngy+bRA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-11-07 19:10 ` Bastien DUMONT
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).