public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Replace horizontal rule in ODT files
@ 2019-03-22 10:19 Russ
       [not found] ` <187fac67-edf6-473b-a5d5-b0bd805e82b8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Russ @ 2019-03-22 10:19 UTC (permalink / raw)
  To: pandoc-discuss


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

We are using Pandoc & Markdown files to produce epub/mobi and also a 
templated ODT file for further editing and final export to a PDF for 
printing.

We use `***` in the ebooks for 'scene' or 'internal chapter' breaks, which 
is a horizontal rule (<hr/>) when converted to HTML for ebooks. 
You can then of course format this to look like what you want e.g. a 
centered `* * *` using CSS (at least for those readers that support the 
CSS.)

However when the templated ODT is created it just has it's standard 
horizontal rule and we'd like to replace that with a centered `* * *` with 
some vertical spacing (hopefully using a style).
Anyone have any idea how we could do this on creation using Pandoc or post 
production with a search and replace?

I've looked at simple ODT file source in an editor and it does not seem 
conducive to search and replace because it is compressed.

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/187fac67-edf6-473b-a5d5-b0bd805e82b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Replace horizontal rule in ODT files
       [not found] ` <187fac67-edf6-473b-a5d5-b0bd805e82b8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-03-22 12:58   ` MarLinn
  2019-03-22 17:59   ` John MacFarlane
  1 sibling, 0 replies; 7+ messages in thread
From: MarLinn @ 2019-03-22 12:58 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

AFAIK ODT doesn't have special support for horizontal lines. It's all
done with styles. A horizontal line is basically a paragraph whose style
has a lower border. You can of course change that style to add vertical
spacing, remove the border, change fonts, etc. Adding "* * *" is a bit
trickier, but still possible with just styles. The basic idea is to
create a numbering style that puts "* * *" before each line and tell the
horizontal-line-style to use this numbering.

So what I suggest is basically that you create a new template that adds
these changes. There might be some additional steps to think about on
the Pandoc side of things, but I'm not sure about that. For example it
might be necessary to insert an empty list into the
horizontal-line-paragraph with a filter to trigger the numbering style –
at which point you might as well just insert "* * *" directly.

Hope this helped.


-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/faf250fa-c2f8-fcb9-6211-1c6f7eff3ca3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

* Re: Replace horizontal rule in ODT files
       [not found] ` <187fac67-edf6-473b-a5d5-b0bd805e82b8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2019-03-22 12:58   ` MarLinn
@ 2019-03-22 17:59   ` John MacFarlane
       [not found]     ` <yh480k36nezt6i.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: John MacFarlane @ 2019-03-22 17:59 UTC (permalink / raw)
  To: Russ, pandoc-discuss


You could use a lua filter to replace a HorizontalRule
block with a bit of raw opendocument XML that
generates a centered * * *.

Russ <info-ckBjHRpK5r9MPTj2movljOTW4wlIGRCZ@public.gmane.org> writes:

> We are using Pandoc & Markdown files to produce epub/mobi and also a 
> templated ODT file for further editing and final export to a PDF for 
> printing.
>
> We use `***` in the ebooks for 'scene' or 'internal chapter' breaks, which 
> is a horizontal rule (<hr/>) when converted to HTML for ebooks. 
> You can then of course format this to look like what you want e.g. a 
> centered `* * *` using CSS (at least for those readers that support the 
> CSS.)
>
> However when the templated ODT is created it just has it's standard 
> horizontal rule and we'd like to replace that with a centered `* * *` with 
> some vertical spacing (hopefully using a style).
> Anyone have any idea how we could do this on creation using Pandoc or post 
> production with a search and replace?
>
> I've looked at simple ODT file source in an editor and it does not seem 
> conducive to search and replace because it is compressed.
>
> -- 
> 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/187fac67-edf6-473b-a5d5-b0bd805e82b8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


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

* Re: Replace horizontal rule in ODT files
       [not found]     ` <yh480k36nezt6i.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2019-03-23 15:23       ` Russ
       [not found]         ` <783ca0e4-df90-4a5c-904a-c4d64a9a7c41-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Russ @ 2019-03-23 15:23 UTC (permalink / raw)
  To: pandoc-discuss


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



On Friday, 22 March 2019 17:59:48 UTC, John MacFarlane wrote:
>
>
> You could use a lua filter to replace a HorizontalRule 
> block with a bit of raw opendocument XML that 
> generates a centered * * *. 
>  

OK, we can do this with BASH/zip, which works fine, but I'd like to give 
Johns' idea a try, however I'm not that familiar with this side of pandoc 
or lua.

If guess we have to find  HorizontalRule() and replace with text like 
<text:p text:style-name=\"Divider-InterChapter\">* * *</text:p>
but i'm a bit stuck after that, can anyone point me in the right direction?

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/783ca0e4-df90-4a5c-904a-c4d64a9a7c41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Replace horizontal rule in ODT files
       [not found]         ` <783ca0e4-df90-4a5c-904a-c4d64a9a7c41-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-03-24  9:28           ` Russ
       [not found]             ` <008a3467-b864-4cc4-acf4-f9307c61ffdc-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Russ @ 2019-03-24  9:28 UTC (permalink / raw)
  To: pandoc-discuss


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



On Saturday, 23 March 2019 15:23:24 UTC, Russ wrote:
>
>
>
> On Friday, 22 March 2019 17:59:48 UTC, John MacFarlane wrote:
>>
>>
>> You could use a lua filter to replace a HorizontalRule 
>> block with a bit of raw opendocument XML that 
>> generates a centered * * *. 
>>  
>
> OK, we can do this with BASH/zip, which works fine, but I'd like to give 
> Johns' idea a try, however I'm not that familiar with this side of pandoc 
> or lua.
>
> If guess we have to find  HorizontalRule() and replace with text like 
> <text:p text:style-name=\"Divider-InterChapter\">* * *</text:p>
> but i'm a bit stuck after that, can anyone point me in the right direction?
>

I had another go with lua and got to - which removes all the horizontal 
rules, but does not replace them with the specified text. Do I have to loop 
through blocks? If so how?
function HorizontalRule ()
    return {pandoc.RawBlock('odt','<text:p 
text:style-name="Divider-InterChapter">* * *</text:p>')}
end


-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/008a3467-b864-4cc4-acf4-f9307c61ffdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Replace horizontal rule in ODT files
       [not found]             ` <008a3467-b864-4cc4-acf4-f9307c61ffdc-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-03-25 10:43               ` BP Jonsson
       [not found]                 ` <fcdc5d37-a337-63a8-a0bf-fa068aeb1a40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: BP Jonsson @ 2019-03-25 10:43 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw, Russ

Den 2019-03-24 kl. 10:28, skrev Russ:
> 
> 
> On Saturday, 23 March 2019 15:23:24 UTC, Russ wrote:
>>
>>
>>
>> On Friday, 22 March 2019 17:59:48 UTC, John MacFarlane wrote:
>>>
>>>
>>> You could use a lua filter to replace a HorizontalRule
>>> block with a bit of raw opendocument XML that
>>> generates a centered * * *.
>>>   
>>
>> OK, we can do this with BASH/zip, which works fine, but I'd like to give
>> Johns' idea a try, however I'm not that familiar with this side of pandoc
>> or lua.
>>
>> If guess we have to find  HorizontalRule() and replace with text like
>> <text:p text:style-name=\"Divider-InterChapter\">* * *</text:p>
>> but i'm a bit stuck after that, can anyone point me in the right direction?
>>
> 
> I had another go with lua and got to - which removes all the horizontal
> rules, but does not replace them with the specified text. Do I have to loop
> through blocks? If so how?
> function HorizontalRule ()
>      return {pandoc.RawBlock('odt','<text:p
> text:style-name="Divider-InterChapter">* * *</text:p>')}
> end

Something like this works for me with a suitably defined paragraph style in a reference doc:

````lua
local custom_hrule = '<text:p text:style-name="Hrule">*    *    *</text:p>'

function HorizontalRule ()
    return pandoc.RawBlock('opendocument', custom_hrule)
end
````

Note 'opendocument' rather than 'odt' as format name!

HTH,

/bpj

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/fcdc5d37-a337-63a8-a0bf-fa068aeb1a40%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

* Re: Replace horizontal rule in ODT files
       [not found]                 ` <fcdc5d37-a337-63a8-a0bf-fa068aeb1a40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2019-03-25 11:36                   ` Russ
  0 siblings, 0 replies; 7+ messages in thread
From: Russ @ 2019-03-25 11:36 UTC (permalink / raw)
  To: pandoc-discuss


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



On Monday, 25 March 2019 10:43:59 UTC, BP Jonsson wrote:
>
> Den 2019-03-24 kl. 10:28, skrev Russ: 
> Something like this works for me with a suitably defined paragraph style 
> in a reference doc: 
> ````lua 
> local custom_hrule = '<text:p 
> text:style-name="Hrule">*    *    *</text:p>' 
>
> function HorizontalRule () 
>     return pandoc.RawBlock('opendocument', custom_hrule) 
> end 
> ```` 
> Note 'opendocument' rather than 'odt' as format name! 
>

Thank you very much BP Jonsson, it now works, your help is much appreciated.

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6ac73e1d-4aeb-4481-86d8-767e2c95006a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

end of thread, other threads:[~2019-03-25 11:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 10:19 Replace horizontal rule in ODT files Russ
     [not found] ` <187fac67-edf6-473b-a5d5-b0bd805e82b8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-03-22 12:58   ` MarLinn
2019-03-22 17:59   ` John MacFarlane
     [not found]     ` <yh480k36nezt6i.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-03-23 15:23       ` Russ
     [not found]         ` <783ca0e4-df90-4a5c-904a-c4d64a9a7c41-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-03-24  9:28           ` Russ
     [not found]             ` <008a3467-b864-4cc4-acf4-f9307c61ffdc-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-03-25 10:43               ` BP Jonsson
     [not found]                 ` <fcdc5d37-a337-63a8-a0bf-fa068aeb1a40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-25 11:36                   ` Russ

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