public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* concatenating md have a page-break between in resulting docx?
@ 2019-09-02 16:03 Joseph Reagle
       [not found] ` <f9be4687-f24a-919d-e699-75a535d0d492-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Reagle @ 2019-09-02 16:03 UTC (permalink / raw)
  To: pandoc-discuss

There might be some hacks I can resort to in [1], but does anyone have a simple solution for ensuring there's a page break between the two sources in the docx file?


```

pandoc -f markdown+footnotes -i 0-01-reagle-koerner.md -i 1-01-reagle.md -o test.docx

```


[1]: https://github.com/jgm/pandoc/issues/1934


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

* Re: concatenating md have a page-break between in resulting docx?
       [not found] ` <f9be4687-f24a-919d-e699-75a535d0d492-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
@ 2019-09-05 17:24   ` Joseph Reagle
       [not found]     ` <db6ee278-4ed8-6e81-e42e-5c155c412795-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Reagle @ 2019-09-05 17:24 UTC (permalink / raw)
  To: pandoc-discuss


On 9/2/19 12:03 PM, Joseph Reagle wrote:
> There might be some hacks I can resort to in [1], but does anyone
> have a simple solution for ensuring there's a page break between the
> two sources in the docx file?

I could do this in the shell/script, but I assume there's no inbuilt way to append a file like page-break.md to *each* of the input files, rather than the output file?
 

╰─➤  cat page-break.md
```{=openxml}
<w:p> <w:r> <w:br w:type="page"/> </w:r> </w:p>
```

```
╭─reagle@hom ~/joseph/2019/09
╰─➤  pandoc -f markdown+raw_attribute --toc -A page-break.md -i
1-chap.md 2-chap.md
```

-- 
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/db6ee278-4ed8-6e81-e42e-5c155c412795%40reagle.org.


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

* Re: concatenating md have a page-break between in resulting docx?
       [not found]     ` <db6ee278-4ed8-6e81-e42e-5c155c412795-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
@ 2019-09-05 19:55       ` BPJ
       [not found]         ` <CADAJKhB0LFNiTyspQnN5_4j87P1vA0LcgSM-9GrDKoLEOZGrDg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: BPJ @ 2019-09-05 19:55 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]

https://github.com/pandoc/lua-filters/tree/master/pagebreak

Den tors 5 sep. 2019 19:25Joseph Reagle <joseph.2011-T1oY19WcHSwdnm+yROfE0A@public.gmane.org> skrev:

>
> On 9/2/19 12:03 PM, Joseph Reagle wrote:
> > There might be some hacks I can resort to in [1], but does anyone
> > have a simple solution for ensuring there's a page break between the
> > two sources in the docx file?
>
> I could do this in the shell/script, but I assume there's no inbuilt way
> to append a file like page-break.md to *each* of the input files, rather
> than the output file?
>
>
> ╰─➤  cat page-break.md
> ```{=openxml}
> <w:p> <w:r> <w:br w:type="page"/> </w:r> </w:p>
> ```
>
> ```
> ╭─reagle@hom ~/joseph/2019/09
> ╰─➤  pandoc -f markdown+raw_attribute --toc -A page-break.md -i
> 1-chap.md 2-chap.md
> ```
>
> --
> 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/db6ee278-4ed8-6e81-e42e-5c155c412795%40reagle.org
> .
>

-- 
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/CADAJKhB0LFNiTyspQnN5_4j87P1vA0LcgSM-9GrDKoLEOZGrDg%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 2673 bytes --]

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

* Re: concatenating md have a page-break between in resulting docx?
       [not found]         ` <CADAJKhB0LFNiTyspQnN5_4j87P1vA0LcgSM-9GrDKoLEOZGrDg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-09-05 20:43           ` BPJ
       [not found]             ` <CADAJKhCuGvDDSueCMNS+E6EW2cboz5LVQBSjPR7KmRo0Lic5bQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2019-09-05 20:46           ` concatenating md have a page-break between in resulting docx? Joseph Reagle
  1 sibling, 1 reply; 12+ messages in thread
From: BPJ @ 2019-09-05 20:43 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 2236 bytes --]

You could create a file which contains only the page break code and use
some shell script or Makefile trickery to insert it between the other input
file arguments. You could also use a shell script (untested!)

echo "" > concat.md

for arg in "$@"
do
    if [ ${arg: -3} == ".md" ]
    then
      cat $arg break.md >> concat.md
    fi
done

pandoc concat.md -o output.docx

rm concat.md

Den tors 5 sep. 2019 21:55BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> https://github.com/pandoc/lua-filters/tree/master/pagebreak
>
> Den tors 5 sep. 2019 19:25Joseph Reagle <joseph.2011-T1oY19WcHSwdnm+yROfE0A@public.gmane.org> skrev:
>
>>
>> On 9/2/19 12:03 PM, Joseph Reagle wrote:
>> > There might be some hacks I can resort to in [1], but does anyone
>> > have a simple solution for ensuring there's a page break between the
>> > two sources in the docx file?
>>
>> I could do this in the shell/script, but I assume there's no inbuilt way
>> to append a file like page-break.md to *each* of the input files, rather
>> than the output file?
>>
>>
>> ╰─➤  cat page-break.md
>> ```{=openxml}
>> <w:p> <w:r> <w:br w:type="page"/> </w:r> </w:p>
>> ```
>>
>> ```
>> ╭─reagle@hom ~/joseph/2019/09
>> ╰─➤  pandoc -f markdown+raw_attribute --toc -A page-break.md -i
>> 1-chap.md 2-chap.md
>> ```
>>
>> --
>> 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/db6ee278-4ed8-6e81-e42e-5c155c412795%40reagle.org
>> .
>>
>

-- 
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/CADAJKhCuGvDDSueCMNS%2BE6EW2cboz5LVQBSjPR7KmRo0Lic5bQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 3939 bytes --]

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

* Re: concatenating md have a page-break between in resulting docx?
       [not found]         ` <CADAJKhB0LFNiTyspQnN5_4j87P1vA0LcgSM-9GrDKoLEOZGrDg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2019-09-05 20:43           ` BPJ
@ 2019-09-05 20:46           ` Joseph Reagle
       [not found]             ` <16c406f5-ca1a-c2f2-de16-db846a919570-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Joseph Reagle @ 2019-09-05 20:46 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


On 9/5/19 3:55 PM, BPJ wrote:
> https://github.com/pandoc/lua-filters/tree/master/pagebreak

Thank you, that requires me to add `\newpage` to my files (rather than as an option on input file processing) but that's easy enough. And when I don't use the filter, it looks like the latex command is ignored.

Two asides:

1. For lua filters, why not use the same `-F`/`--filters` option? 

I know lua is internal and the other is json-based, but couldn't pandoc figure it out?

2. When I accidentally used `--filter`, I get a confusing message:

```
╰─➤  pandoc --filter=pagebreak.lua --toc -i 1-chap.md 2-chap.md -s -o test.docx
Error running filter /Users/reagle/.pandoc/filters/pagebreak.lua:
Could not find executable /Users/reagle/.pandoc/filters/pagebreak.lua
```

It is there, it'd be nicer if it said "if a lua file, use --lua-filter."

-- 
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/16c406f5-ca1a-c2f2-de16-db846a919570%40reagle.org.


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

* Re: concatenating md have a page-break between in resulting docx?
       [not found]             ` <CADAJKhCuGvDDSueCMNS+E6EW2cboz5LVQBSjPR7KmRo0Lic5bQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-09-05 20:48               ` Joseph Reagle
       [not found]                 ` <236f815f-2db1-4ee2-30d0-5794cd6301b3-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Reagle @ 2019-09-05 20:48 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


On 9/5/19 4:43 PM, BPJ wrote:
> You could create a file which contains only the page break code and

Yes, I've been doing something like that:

```
 for f in *-*-*.md; do cat $f page-break.md; done > test.md
```


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

* Re: concatenating md have a page-break between in resulting docx?
       [not found]             ` <16c406f5-ca1a-c2f2-de16-db846a919570-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
@ 2019-09-06  9:14               ` BP Jonsson
       [not found]                 ` <CAFC_yuTGVSn9VaG4h3-NgngzKxOW0maTvcpnxakUx7oTYYEjWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: BP Jonsson @ 2019-09-06  9:14 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 2254 bytes --]

That would work except for the fact that a JSON filter *could* be written
in Lua and there probably are such filters out there. I thought there used
to be an -L option but I can't find it anymore so perhaps -L can be
repurposed as a synonym of --lua-filter. (Which reminds me I ought to
update my default-options wrapper script to reflect the current set of
options!)

Den tors 5 sep. 2019 22:46Joseph Reagle <joseph.2011-T1oY19WcHSwdnm+yROfE0A@public.gmane.org> skrev:

>
> On 9/5/19 3:55 PM, BPJ wrote:
> > https://github.com/pandoc/lua-filters/tree/master/pagebreak
>
> Thank you, that requires me to add `\newpage` to my files (rather than as
> an option on input file processing) but that's easy enough. And when I
> don't use the filter, it looks like the latex command is ignored.
>
> Two asides:
>
> 1. For lua filters, why not use the same `-F`/`--filters` option?
>
> I know lua is internal and the other is json-based, but couldn't pandoc
> figure it out?
>
> 2. When I accidentally used `--filter`, I get a confusing message:
>
> ```
> ╰─➤  pandoc --filter=pagebreak.lua --toc -i 1-chap.md 2-chap.md -s -o
> test.docx
> Error running filter /Users/reagle/.pandoc/filters/pagebreak.lua:
> Could not find executable /Users/reagle/.pandoc/filters/pagebreak.lua
> ```
>
> It is there, it'd be nicer if it said "if a lua file, use --lua-filter."
>
> --
> 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/16c406f5-ca1a-c2f2-de16-db846a919570%40reagle.org
> .
>

-- 
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/CAFC_yuTGVSn9VaG4h3-NgngzKxOW0maTvcpnxakUx7oTYYEjWw%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 3274 bytes --]

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

* -L for --lua-filter?
       [not found]                 ` <CAFC_yuTGVSn9VaG4h3-NgngzKxOW0maTvcpnxakUx7oTYYEjWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-09-06 16:24                   ` John MacFarlane
  0 siblings, 0 replies; 12+ messages in thread
From: John MacFarlane @ 2019-09-06 16:24 UTC (permalink / raw)
  To: BP Jonsson, pandoc-discuss


I wouldn't mind adding -L as a synonym for --lua-filter.
Would others welcome that?  Any problems you can see?


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

* Number concatenated chapters (Was: concatenating md have a page-break between in resulting docx?)
       [not found]                 ` <236f815f-2db1-4ee2-30d0-5794cd6301b3-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
@ 2019-09-16 20:15                   ` Joseph Reagle
       [not found]                     ` <83bd8e54-4c7f-2fd7-966e-fe2fb55755bd-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Reagle @ 2019-09-16 20:15 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


On 9/5/19 4:48 PM, Joseph Reagle wrote:
> ```
>  for f in *-*-*.md; do cat $f page-break.md; done > test.md
> ```

In addition to adding page breaks between the chapters, I'd like to have the title (first level-1 heading, in this case) prefixed with an chapter number taken from the file name. I want to do this dynamically, as I might rename/resort/reorganize the files based on their names.

So, for example, `1-01-reagle.md` is the first chapter in the first section, and could have '1.' prefixed to its first heading. In looking at filters, especially panflute, all the examples are of stand-alone filters that are stateless between invocations...

```
0-01-reagle-koerner.md			
1-00-hindsight.md			    
1-01-reagle.md				    
1-02-benjakob-harrison.md		
1-03-hill-shaw.md
```

Any suggestions?

-- 
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/83bd8e54-4c7f-2fd7-966e-fe2fb55755bd%40reagle.org.


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

* Re: Number concatenated chapters (Was: concatenating md have a page-break between in resulting docx?)
       [not found]                     ` <83bd8e54-4c7f-2fd7-966e-fe2fb55755bd-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
@ 2019-09-19 22:00                       ` brainchild
  2019-09-25  8:10                       ` Agustín Martín
  1 sibling, 0 replies; 12+ messages in thread
From: brainchild @ 2019-09-19 22:00 UTC (permalink / raw)
  To: pandoc-discuss


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

I'm not sure whether my thought will be distracting or helpful.

Based on your comments so far, it seems that your ultimate objective might 
be to publish a book from a source collection of one chapter per source 
document.  

Page breaks between chapters are a normal formatting feature of book-style 
output.  If you could pre-filter the source such that the header levels are 
shifted right and the file information is then applied as the top-level 
header for each resulting sequence of sections, would you be moving closer 
toward a desired outcome?

At this moment, I cannot propose a good way to achieve the above, but 
depending on your needs it may be worth considering, especially if someone 
else can suggest an existing feature that supports it.

Ultimately, the specific problem you describe is more difficult than you 
would hope because formatting features such as page breaks are generally 
determined by the logical structure of the input document applied to the 
physical design of the output document.

If you are able to utilize this design by slightly shifting your approach, 
you might have more fun and less pain.

Of course it would be even simpler if the source already had the needed 
structure, but it seems you have external constraints or preferences that 
restrict this possibility.


On Monday, September 16, 2019 at 4:15:49 PM UTC-4, Joseph wrote:
>
>
> In addition to adding page breaks between the chapters, I'd like to have 
> the title (first level-1 heading, in this case) prefixed with an chapter 
> number taken from the file name. I want to do this dynamically, as I might 
> rename/resort/reorganize the files based on their names. 
>
>
>

-- 
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/33bca4bd-c1e7-4356-b79c-625ee4792773%40googlegroups.com.

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

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

* Re: Number concatenated chapters (Was: concatenating md have a page-break between in resulting docx?)
       [not found]                     ` <83bd8e54-4c7f-2fd7-966e-fe2fb55755bd-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
  2019-09-19 22:00                       ` brainchild
@ 2019-09-25  8:10                       ` Agustín Martín
       [not found]                         ` <d4057f17-ab65-4bb4-afb4-7ec97ab3cb22-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Agustín Martín @ 2019-09-25  8:10 UTC (permalink / raw)
  To: pandoc-discuss


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

> In addition to adding page breaks between the chapters, I'd like to have 
the title (first level-1 heading, in this case) prefixed with an chapter 
number taken from the file name. I want to do this dynamically, as I might 
rename/resort/reorganize the files based on their names.

I'm not sure if you're artificially complicating matters. Both things can 
be achieved simply by modifying your reference-doc heading styles, having 
first level heading include a pagebreak before, and being numbered. Then 
you can put any name to the files (numbers if you like for sorting), and 
all your chapters will be sensibly numbered (independently of what the name 
of the original file was).



On Monday, September 16, 2019 at 10:15:49 PM UTC+2, Joseph wrote:
>
>
> On 9/5/19 4:48 PM, Joseph Reagle wrote: 
> > ``` 
> >  for f in *-*-*.md; do cat $f page-break.md; done > test.md 
> > ``` 
>
> In addition to adding page breaks between the chapters, I'd like to have 
> the title (first level-1 heading, in this case) prefixed with an chapter 
> number taken from the file name. I want to do this dynamically, as I might 
> rename/resort/reorganize the files based on their names. 
>
> So, for example, `1-01-reagle.md` is the first chapter in the first 
> section, and could have '1.' prefixed to its first heading. In looking at 
> filters, especially panflute, all the examples are of stand-alone filters 
> that are stateless between invocations... 
>
> ``` 
> 0-01-reagle-koerner.md                         
> 1-00-hindsight.md                             
> 1-01-reagle.md                                     
> 1-02-benjakob-harrison.md                 
> 1-03-hill-shaw.md 
> ``` 
>
> Any suggestions? 
>
>

-- 
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/d4057f17-ab65-4bb4-afb4-7ec97ab3cb22%40googlegroups.com.

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

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

* Re: Number concatenated chapters (Was: concatenating md have a page-break between in resulting docx?)
       [not found]                         ` <d4057f17-ab65-4bb4-afb4-7ec97ab3cb22-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-09-25 10:25                           ` 山本一貴
  0 siblings, 0 replies; 12+ messages in thread
From: 山本一貴 @ 2019-09-25 10:25 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 3470 bytes --]

Hello,

My pre-processing lua filter might give a hint for you.
https://github.com/pandocker/pandocker-lua-filters/blob/master/lua/preprocess.lua
(I know this filter implement is not great. PR welcome btw )

1. make another md file ("base.md" for example) to include files by your
order like:

``` markdown
# #include "0-01-reagle-koerner.md"
# #include "1-00-hindsight.md"
# #include "1-01-reagle.md"
# #include "1-02-benjakob-harrison.md"
# #include "1-03-hill-shaw.md"
```

2. let pandoc process with base.md and the filter
pandoc -t docx --lua-filter=preprocess.lua base.md -o out.docx

3. the out.docx is equivalent to concatenated files by your order



2019年9月25日(水) 17:10 Agustín Martín <agusmba-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:

> > In addition to adding page breaks between the chapters, I'd like to have
> the title (first level-1 heading, in this case) prefixed with an chapter
> number taken from the file name. I want to do this dynamically, as I might
> rename/resort/reorganize the files based on their names.
>
> I'm not sure if you're artificially complicating matters. Both things can
> be achieved simply by modifying your reference-doc heading styles, having
> first level heading include a pagebreak before, and being numbered. Then
> you can put any name to the files (numbers if you like for sorting), and
> all your chapters will be sensibly numbered (independently of what the name
> of the original file was).
>
>
>
> On Monday, September 16, 2019 at 10:15:49 PM UTC+2, Joseph wrote:
>>
>>
>> On 9/5/19 4:48 PM, Joseph Reagle wrote:
>> > ```
>> >  for f in *-*-*.md; do cat $f page-break.md; done > test.md
>> > ```
>>
>> In addition to adding page breaks between the chapters, I'd like to have
>> the title (first level-1 heading, in this case) prefixed with an chapter
>> number taken from the file name. I want to do this dynamically, as I might
>> rename/resort/reorganize the files based on their names.
>>
>> So, for example, `1-01-reagle.md` is the first chapter in the first
>> section, and could have '1.' prefixed to its first heading. In looking at
>> filters, especially panflute, all the examples are of stand-alone filters
>> that are stateless between invocations...
>>
>> ```
>> 0-01-reagle-koerner.md
>> 1-00-hindsight.md
>> 1-01-reagle.md
>> 1-02-benjakob-harrison.md
>> 1-03-hill-shaw.md
>> ```
>>
>> Any suggestions?
>>
>> --
> 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/d4057f17-ab65-4bb4-afb4-7ec97ab3cb22%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/d4057f17-ab65-4bb4-afb4-7ec97ab3cb22%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/CAPBn7noaBRW%2Bg%2B_Opvb28MPrW1w1rnLC1LSyrU8xSES3%3Dt6OYg%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 5463 bytes --]

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

end of thread, other threads:[~2019-09-25 10:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 16:03 concatenating md have a page-break between in resulting docx? Joseph Reagle
     [not found] ` <f9be4687-f24a-919d-e699-75a535d0d492-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
2019-09-05 17:24   ` Joseph Reagle
     [not found]     ` <db6ee278-4ed8-6e81-e42e-5c155c412795-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
2019-09-05 19:55       ` BPJ
     [not found]         ` <CADAJKhB0LFNiTyspQnN5_4j87P1vA0LcgSM-9GrDKoLEOZGrDg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-05 20:43           ` BPJ
     [not found]             ` <CADAJKhCuGvDDSueCMNS+E6EW2cboz5LVQBSjPR7KmRo0Lic5bQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-05 20:48               ` Joseph Reagle
     [not found]                 ` <236f815f-2db1-4ee2-30d0-5794cd6301b3-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
2019-09-16 20:15                   ` Number concatenated chapters (Was: concatenating md have a page-break between in resulting docx?) Joseph Reagle
     [not found]                     ` <83bd8e54-4c7f-2fd7-966e-fe2fb55755bd-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
2019-09-19 22:00                       ` brainchild
2019-09-25  8:10                       ` Agustín Martín
     [not found]                         ` <d4057f17-ab65-4bb4-afb4-7ec97ab3cb22-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-09-25 10:25                           ` 山本一貴
2019-09-05 20:46           ` concatenating md have a page-break between in resulting docx? Joseph Reagle
     [not found]             ` <16c406f5-ca1a-c2f2-de16-db846a919570-T1oY19WcHSwdnm+yROfE0A@public.gmane.org>
2019-09-06  9:14               ` BP Jonsson
     [not found]                 ` <CAFC_yuTGVSn9VaG4h3-NgngzKxOW0maTvcpnxakUx7oTYYEjWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-06 16:24                   ` -L for --lua-filter? 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).