Combining files under Windows.

574 views
Skip to first unread message

Pawel Urbanski

unread,
Jan 5, 2016, 12:03:32 PM1/5/16
to pandoc-...@googlegroups.com
Dear Group,
I am trying to setup a writing workflow, where I have 10 files for
book chapters, which I wnt to combine to a single output file.

Pandoc 1.16.1 on Windows 10 64-bit installed in a separate folder does
not combine files.
I am using the following command, which I found in a few places on the web:
pandoc *.md -o testing.html

I tried putting *.md in quotes, specifying -f and -t options.
I always get the error about invalid input on both: Command prompt and
PowerShell. Files have a blank line at the beginning and the end just
to make sure that it does not cause any trouble mentioned in a few
places on the web.

Can any of you test this command under Linux / Mac. Maybe it is just a
Windows issue.

Greetings,
Pawel Urbanski

John MACFARLANE

unread,
Jan 5, 2016, 1:02:06 PM1/5/16
to pandoc-...@googlegroups.com
An error about invalid input normally means that your input
files are not UTF-8 encoded.

+++ Pawel Urbanski [Jan 05 16 18:03 ]:
>--
>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-discus...@googlegroups.com.
>To post to this group, send email to pandoc-...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CA%2BSM%2BEKOhZM3-2i6OR58KsMSJxY4Du3pQ4rhLhYUBJ2JJaQKtw%40mail.gmail.com.
>For more options, visit https://groups.google.com/d/optout.

Pawel Urbanski

unread,
Jan 6, 2016, 6:46:59 AM1/6/16
to pandoc-discuss
Dear John,
I created the files with Notepad++. The encoding is set to UTF-8 without BOM. Additionally, I used the conversion feature to make sure that encoding is correct. Files do get converted individually without errors.
Here is the error output with the command:
D:\projects\Publishing\pd>pandoc *.md -o test.html
pandoc: *.md: openFile: invalid argument (Invalid argument)

Command line parameters are separated by spaces - not tabs by any chance or mistake.

Hope that gives a hint... And thank you for help.
Pawel

John MacFarlane

unread,
Jan 6, 2016, 10:21:40 AM1/6/16
to pandoc-...@googlegroups.com
Okay, that's very interesting. I guess I'd never tried
using a * wildcard with pandoc on Windows.

On linux and OSX, the shell expands the "*.md" before it
even gets to pandoc. Pandoc just sees a list of regular
filenames. Apparently it doesn't work that way on Windows:
getArgs just returns ["*.md"], so I guess it's up to
the program to do wildcard expansion?

Is there anyone out who has experience with this?


+++ Pawel Urbanski [Jan 06 16 03:46 ]:
> --
> 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 [1]pandoc-discus...@googlegroups.com.
> To post to this group, send email to
> [2]pandoc-...@googlegroups.com.
> To view this discussion on the web visit
> [3]https://groups.google.com/d/msgid/pandoc-discuss/cc7bf9b2-33ff-4725-
> 8996-8dee26a4c000%40googlegroups.com.
> For more options, visit [4]https://groups.google.com/d/optout.
>
>References
>
> 1. mailto:pandoc-discus...@googlegroups.com
> 2. mailto:pandoc-...@googlegroups.com
> 3. https://groups.google.com/d/msgid/pandoc-discuss/cc7bf9b2-33ff-4725...@googlegroups.com?utm_medium=email&utm_source=footer
> 4. https://groups.google.com/d/optout

John MacFarlane

unread,
Jan 6, 2016, 10:22:04 AM1/6/16
to pandoc-...@googlegroups.com
PS. Can you put up a bug report on the jgm/github issue tracker?

+++ Pawel Urbanski [Jan 06 16 03:46 ]:
> --
> 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 [1]pandoc-discus...@googlegroups.com.
> To post to this group, send email to
> [2]pandoc-...@googlegroups.com.
> To view this discussion on the web visit

Shahbaz Youssefi

unread,
Jan 6, 2016, 10:44:27 AM1/6/16
to pandoc-...@googlegroups.com
This might be informative http://superuser.com/q/460598/105764

Yet another -1 to windows.

To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
To post to this group, send email to pandoc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/20160106152121.GD71895%40MacBook-Air-2.local.

Pawel Urbanski

unread,
Jan 6, 2016, 12:44:38 PM1/6/16
to pandoc-...@googlegroups.com
Hi Everyone,
I am not a Haskell developer, but have enough knowledge to search for
code / library to implement this wildcard expantin pattern. I will
search for it and add it with the issue on Github - hope I find it.
The slution for now is as follows:
I have Git-bash installed with my Git for Windows. When launching
Pandoc with the *.md parameter under Git-bash, which is very likely
based on Cygwin works without any issues.
I understand that not everyone may have Bash for Windows installed, so
I will try to help out with solving this problem.

I read the thread on Superuser, but it involves quite a bit of
scripting. I would like Pandoc to stay wonderfully simple as it is
now.

Greetings,
Pawel
> 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/eMfCGU3Gn8E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> pandoc-discus...@googlegroups.com.
> To post to this group, send email to pandoc-...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/CALeOzZ_0DtG7wRmY%2BkRvYMw_Cg06sNZMzt7%3D4DJF%3Dz5jj9q%3D3Q%40mail.gmail.com.

John MACFARLANE

unread,
Jan 6, 2016, 1:33:32 PM1/6/16
to pandoc-...@googlegroups.com
I can add the feature, now that I know that windows
doesn't expand the wildcards.

+++ Pawel Urbanski [Jan 06 16 18:44 ]:
>To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CA%2BSM%2BE%2BVEa8PcZJAZjw-WHXMP2RN-XZ%2BL70VNeLB%3DBGn4botJQ%40mail.gmail.com.

Pawel Urbanski

unread,
Jan 6, 2016, 1:48:02 PM1/6/16
to pandoc-...@googlegroups.com
Great. And the last thing I noticed.
Can sections be numbered for the DOCX format? Numbering works for HTML
/ PDF. I don't get the numbers for the DOCX format.
> https://groups.google.com/d/msgid/pandoc-discuss/20160106183318.GA57516%40protagoras.berkeley.edu.

Shahbaz Youssefi

unread,
Jan 6, 2016, 1:51:32 PM1/6/16
to pandoc-...@googlegroups.com
It's Bad(TM) that windows would force every program to implement its own wildcard expansion. I'm not sure if it makes sense to expand wildcards in pandoc just for windows, it being clearly not cli-friendly.

However. if you do want to go down that road, here are some things to look out for:

- **Make sure it only comes in effect under windows, and only with cmd.exe (and power shell apparently)**. Under posix shells (including bash in cygwin), if you get `*.md`, then the user has probably specifically didn't want wildcard expansion (for example by `pandoc "*.md"`).
- Make sure the expansion matches what other shells do (partial coverage for bash: http://tldp.org/LDP/abs/html/globbingref.html). This includes the following, and their combinations:
  * any letters: `*`
  * any letter: `?`
  * set of letters: `[abc]` and `[^abc]`
  * range of letters: `[a-z]`
  * letter type: `[[:upper:]]`
  * grouping: `{a*,b*}`
- Be able to distinguish between `pandoc *.md` and `pandoc "*.md"` (and `pandoc '*.md'`), where the expansion shouldn't happen in the second case. This includes partial quotation, such as `pandoc *."*"x`

I would personally advise recommending a real shell to those who want to use `pandoc` from command line, instead.

Keep up the good work as always,
Shahbaz

John MACFARLANE

unread,
Jan 6, 2016, 2:11:53 PM1/6/16
to pandoc-...@googlegroups.com
Have a look at the commit

https://github.com/jgm/pandoc/commit/363ecfebc32c6fe15d81634422e8607847f588fb

This uses the Glob library, but it only activates this on
Windows.

It will behave the same way on Windows, no matter what
shell is in use. (I don't actually know how to test for
that in the program.)

I can revert it if this seems a bad idea.



+++ Shahbaz Youssefi [Jan 06 16 13:51 ]:
> It's Bad(TM) that windows would force every program to implement its
> own wildcard expansion. I'm not sure if it makes sense to expand
> wildcards in pandoc just for windows, it being clearly not
> cli-friendly.
> However. if you do want to go down that road, here are some things to
> look out for:
> - **Make sure it only comes in effect under windows, and only with
> cmd.exe (and power shell apparently)**. Under posix shells (including
> bash in cygwin), if you get `*.md`, then the user has probably
> specifically didn't want wildcard expansion (for example by `pandoc
> "*.md"`).
> - Make sure the expansion matches what other shells do (partial
> coverage for bash: [1]http://tldp.org/LDP/abs/html/globbingref.html).
> On 1/6/16, Shahbaz Youssefi <[3]sha...@gmail.com> wrote:
> > This might be informative [4]http://superuser.com/q/460598/105764
> >
> > Yet another -1 to windows.
> >
> > On Wed, Jan 6, 2016 at 10:21 AM, John MacFarlane
> <[5]j...@berkeley.edu> wrote:
> >
> >> Okay, that's very interesting. I guess I'd never tried
> >> using a * wildcard with pandoc on Windows.
> >>
> >> On linux and OSX, the shell expands the "*.md" before it
> >> even gets to pandoc. Pandoc just sees a list of regular
> >> filenames. Apparently it doesn't work that way on Windows:
> >> getArgs just returns ["*.md"], so I guess it's up to
> >> the program to do wildcard expansion?
> >>
> >> Is there anyone out who has experience with this?
> >>
> >>
> >> +++ Pawel Urbanski [Jan [6]06 16 03:46 ]:
> >>
> >>> Dear John,
> >>> I created the files with Notepad++. The encoding is set to UTF-8
> >>> without BOM. Additionally, I used the conversion feature to make
> sure
> >>> that encoding is correct. Files do get converted individually
> without
> >>> errors.
> >>> Here is the error output with the command:
> >>> D:\projects\Publishing\pd>pandoc *.md -o test.html
> >>> pandoc: *.md: openFile: invalid argument (Invalid argument)
> >>> Command line parameters are separated by spaces - not tabs by any
> >>> chance or mistake.
> >>> Hope that gives a hint... And thank you for help.
> >>> Pawel
> >>>
> >>> --
> >>> 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 [1][7]pandoc-discus...@googlegroups.com.
> >>> To post to this group, send email to
> >>> [2][8]pandoc-...@googlegroups.com.
> >>> To view this discussion on the web visit
> >>>
> >>>
> [3][9]https://groups.google.com/d/msgid/pandoc-discuss/cc7bf9b2-33ff-47
> 25-
> >>> 8996-8dee26a4c000%[10]40googlegroups.com.
> >>> For more options, visit
> [4][11]https://groups.google.com/d/optout.
> >>>
> >>> References
> >>>
> >>> 1. mailto:[12]pandoc-discus...@googlegroups.com
> >>> 2. mailto:[13]pandoc-...@googlegroups.com
> >>> 3.
> >>>
> [14]https://groups.google.com/d/msgid/pandoc-discuss/cc7bf9b2-33ff-4725
> -8996-8de...@googlegroups.com?utm_medium=email&utm_source=footer
> >>> 4. [15]https://groups.google.com/d/optout
> >>>
> >>
> >> --
> >> 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 [16]pandoc-discus...@googlegroups.com.
> >> To post to this group, send email to
> [17]pandoc-...@googlegroups.com.
> >> To view this discussion on the web visit
> >>
> [18]https://groups.google.com/d/msgid/pandoc-discuss/20160106152121.GD7
> 1895%40MacBook-Air-2.local
> >> .
> >>
> >> For more options, visit [19]https://groups.google.com/d/optout.
> >>
> >
> > --
>
> > You received this message because you are subscribed to a topic in
> the
> > Google Groups "pandoc-discuss" group.
> > To unsubscribe from this topic, visit
> >
> [20]https://groups.google.com/d/topic/pandoc-discuss/eMfCGU3Gn8E/uns
> ubscribe.
> > To unsubscribe from this group and all its topics, send an email
> to
> > [21]pandoc-discus...@googlegroups.com.
> > To post to this group, send email to
> [22]pandoc-...@googlegroups.com.
> > To view this discussion on the web visit
> >
> [23]https://groups.google.com/d/msgid/pandoc-discuss/CALeOzZ_0DtG7wR
> mY%2BkRvYMw_Cg06sNZMzt7%3D4DJF%3Dz5jj9q%3D3Q%40mail.gmail.com.
> > For more options, visit [24]https://groups.google.com/d/optout.
> >
> --
> 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 [25]pandoc-discus...@googlegroups.com.
> To post to this group, send email to
> [26]pandoc-...@googlegroups.com.
> To view this discussion on the web visit
> [27]https://groups.google.com/d/msgid/pandoc-discuss/CA%2BSM%2BE%2BV
> Ea8PcZJAZjw-WHXMP2RN-XZ%2BL70VNeLB%3DBGn4botJQ%40mail.gmail.com.
>
> For more options, visit [28]https://groups.google.com/d/optout.
>
> --
> 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 [29]pandoc-discus...@googlegroups.com.
> To post to this group, send email to
> [30]pandoc-...@googlegroups.com.
> To view this discussion on the web visit
> [31]https://groups.google.com/d/msgid/pandoc-discuss/CALeOzZ-yZdw_BCCsD
> NvCg2V%3DXanJgWeyxHNJ%3D0BXKJzyDBrh9w%40mail.gmail.com.
> For more options, visit [32]https://groups.google.com/d/optout.
>
>References
>
> 1. http://tldp.org/LDP/abs/html/globbingref.html
> 2. mailto:pa...@pawelurbanski.com
> 3. mailto:sha...@gmail.com
> 4. http://superuser.com/q/460598/105764
> 5. mailto:j...@berkeley.edu
> 6. tel:06 16 03
> 7. mailto:pandoc-discus...@googlegroups.com
> 8. mailto:pandoc-...@googlegroups.com
> 9. https://groups.google.com/d/msgid/pandoc-discuss/cc7bf9b2-33ff-4725-
> 10. http://40googlegroups.com/
> 11. https://groups.google.com/d/optout
> 12. mailto:pandoc-discus...@googlegroups.com
> 13. mailto:pandoc-...@googlegroups.com
> 14. https://groups.google.com/d/msgid/pandoc-discuss/cc7bf9b2-33ff-4725...@googlegroups.com?utm_medium=email&utm_source=footer
> 15. https://groups.google.com/d/optout
> 16. mailto:pandoc-discus...@googlegroups.com
> 17. mailto:pandoc-...@googlegroups.com
> 18. https://groups.google.com/d/msgid/pandoc-discuss/20160106152...@MacBook-Air-2.local
> 19. https://groups.google.com/d/optout
> 20. https://groups.google.com/d/topic/pandoc-discuss/eMfCGU3Gn8E/unsubscribe
> 21. mailto:pandoc-discus...@googlegroups.com
> 22. mailto:pandoc-...@googlegroups.com
> 23. https://groups.google.com/d/msgid/pandoc-discuss/CALeOzZ_0DtG7wRmY+kRvYMw_Cg06sNZMzt7=4DJF=z5jj9q=3...@mail.gmail.com
> 24. https://groups.google.com/d/optout
> 25. mailto:pandoc-discus...@googlegroups.com
> 26. mailto:pandoc-...@googlegroups.com
> 27. https://groups.google.com/d/msgid/pandoc-discuss/CA+SM+E+VEa8PcZJAZjw-WHXMP2RN-XZ+L70VNeLB=BGn4...@mail.gmail.com
> 28. https://groups.google.com/d/optout
> 29. mailto:pandoc-discus...@googlegroups.com
> 30. mailto:pandoc-...@googlegroups.com
> 31. https://groups.google.com/d/msgid/pandoc-discuss/CALeOzZ-yZdw_BCCsDNvCg2V=XanJgWeyxHNJ=0BXKJz...@mail.gmail.com?utm_medium=email&utm_source=footer
> 32. https://groups.google.com/d/optout

John MACFARLANE

unread,
Jan 6, 2016, 2:15:06 PM1/6/16
to pandoc-...@googlegroups.com
Yes, on second thought I'm just going to revert that commit.

This is something that should be done by the shell.

But further comments welcome ...

+++ Shahbaz Youssefi [Jan 06 16 13:51 ]:
> It's Bad(TM) that windows would force every program to implement its
> own wildcard expansion. I'm not sure if it makes sense to expand
> wildcards in pandoc just for windows, it being clearly not
> cli-friendly.
> However. if you do want to go down that road, here are some things to
> look out for:
> - **Make sure it only comes in effect under windows, and only with
> cmd.exe (and power shell apparently)**. Under posix shells (including
> bash in cygwin), if you get `*.md`, then the user has probably
> specifically didn't want wildcard expansion (for example by `pandoc
> "*.md"`).
> - Make sure the expansion matches what other shells do (partial
> coverage for bash: [1]http://tldp.org/LDP/abs/html/globbingref.html).
> On 1/6/16, Shahbaz Youssefi <[3]sha...@gmail.com> wrote:
> > This might be informative [4]http://superuser.com/q/460598/105764
> >
> > Yet another -1 to windows.
> >
> > On Wed, Jan 6, 2016 at 10:21 AM, John MacFarlane
> <[5]j...@berkeley.edu> wrote:
> >
> >> Okay, that's very interesting. I guess I'd never tried
> >> using a * wildcard with pandoc on Windows.
> >>
> >> On linux and OSX, the shell expands the "*.md" before it
> >> even gets to pandoc. Pandoc just sees a list of regular
> >> filenames. Apparently it doesn't work that way on Windows:
> >> getArgs just returns ["*.md"], so I guess it's up to
> >> the program to do wildcard expansion?
> >>
> >> Is there anyone out who has experience with this?
> >>
> >>
> >> +++ Pawel Urbanski [Jan [6]06 16 03:46 ]:
> >>
> >>> Dear John,
> >>> I created the files with Notepad++. The encoding is set to UTF-8
> >>> without BOM. Additionally, I used the conversion feature to make
> sure
> >>> that encoding is correct. Files do get converted individually
> without
> >>> errors.
> >>> Here is the error output with the command:
> >>> D:\projects\Publishing\pd>pandoc *.md -o test.html
> >>> pandoc: *.md: openFile: invalid argument (Invalid argument)
> >>> Command line parameters are separated by spaces - not tabs by any
> >>> chance or mistake.
> >>> Hope that gives a hint... And thank you for help.
> >>> Pawel
> >>>
> >>> --
> >>> 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 [1][7]pandoc-discus...@googlegroups.com.
> >>> To post to this group, send email to
> >>> [2][8]pandoc-...@googlegroups.com.
> >>> To view this discussion on the web visit
> >>>
> >>>
> >>> For more options, visit
> [4][11]https://groups.google.com/d/optout.
> >>>
> >>> References
> >>>
> >>> 4. [15]https://groups.google.com/d/optout
> >>>
> >>
> >> --
> >> 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 [16]pandoc-discus...@googlegroups.com.
> >> To post to this group, send email to
> [17]pandoc-...@googlegroups.com.
> >> To view this discussion on the web visit
> >>
> [18]https://groups.google.com/d/msgid/pandoc-discuss/20160106152121.GD7
> 1895%40MacBook-Air-2.local
> >> .
> >>
> >> For more options, visit [19]https://groups.google.com/d/optout.
> >>
> >
> > --
>
> > You received this message because you are subscribed to a topic in
> the
> > Google Groups "pandoc-discuss" group.
> > To unsubscribe from this topic, visit
> >
> [20]https://groups.google.com/d/topic/pandoc-discuss/eMfCGU3Gn8E/uns
> ubscribe.
> > To unsubscribe from this group and all its topics, send an email
> to
> > [21]pandoc-discus...@googlegroups.com.
> > To post to this group, send email to
> [22]pandoc-...@googlegroups.com.
> > To view this discussion on the web visit
> >
> [23]https://groups.google.com/d/msgid/pandoc-discuss/CALeOzZ_0DtG7wR
> mY%2BkRvYMw_Cg06sNZMzt7%3D4DJF%3Dz5jj9q%3D3Q%40mail.gmail.com.
> > For more options, visit [24]https://groups.google.com/d/optout.
> >
> --
> 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 [25]pandoc-discus...@googlegroups.com.
> To post to this group, send email to
> [26]pandoc-...@googlegroups.com.
> To view this discussion on the web visit
> [27]https://groups.google.com/d/msgid/pandoc-discuss/CA%2BSM%2BE%2BV
> Ea8PcZJAZjw-WHXMP2RN-XZ%2BL70VNeLB%3DBGn4botJQ%40mail.gmail.com.
>
> For more options, visit [28]https://groups.google.com/d/optout.
>
> --
> 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 [29]pandoc-discus...@googlegroups.com.
> To post to this group, send email to
> [30]pandoc-...@googlegroups.com.
> To view this discussion on the web visit

Pawel Urbanski

unread,
Jan 6, 2016, 2:23:50 PM1/6/16
to pandoc-...@googlegroups.com
I found the solution. Will try to check if it is possible to get a
single executable of Bash / Sh for Windows. We can add a note in
Pandoc guide about this case?
I will add my solution to those 2 or 3 threads that pop-up on the web
about combining files under Windows. That should guide people in the
right direction.

I don't know if it is something people do alot - split a document /
book into many files.

Ryan Gray

unread,
Jan 6, 2016, 10:50:57 PM1/6/16
to pandoc-...@googlegroups.com

> On Jan 6, 2016, at 12:14 PM, John MACFARLANE <j...@berkeley.edu> wrote:
>
> Yes, on second thought I'm just going to revert that commit.
>
> This is something that should be done by the shell.
>

Maybe so, but cmd.exe will never get that feature I suspect.

My Windows box is at work, but I suspect a workaround for those that need it is to write a .cmd script wrapper that does the expansion. If I can come up with something, I'll post it.

-Ryan

Shahbaz Youssefi

unread,
Jan 7, 2016, 9:24:47 AM1/7/16
to pandoc-...@googlegroups.com
You may be able to solve the globbing problem with a wrapper, but there are all sorts of command-line niceties you would be missing with cmd.exe.

I would simply advise installing cygwin. Or, if one has git for windows installed, they get bash, with a terminal already tweaked to look nicer than the default (as little as that is possible). cmd.exe is simply not a usable cli, there is no point in supporting it.

--
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-discus...@googlegroups.com.
To post to this group, send email to pandoc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7CF81D92-CC7E-4641-AD64-4C00E3BBC3E9%40me.com.

BP Jonsson

unread,
Jan 8, 2016, 10:27:42 AM1/8/16
to pandoc-...@googlegroups.com
Den 2016-01-06 kl. 19:51, skrev Shahbaz Youssefi:
> - Make sure the expansion matches what other shells do (partial coverage
> for bash:http://tldp.org/LDP/abs/html/globbingref.html). This includes the
> following, and their combinations:
> * any letters: `*`
> * any letter: `?`
> * set of letters: `[abc]` and `[^abc]`
> * range of letters: `[a-z]`
> * letter type: `[[:upper:]]`
> * grouping: `{a*,b*}`

Isn't the definition of 'letter' dependent on the locale, or do
shells have their own definition? I don't use non-ASCII letters
in filenames if I can avoid it, but it seems that on my UTF-8
locale Ubuntu boxes bash/dash do include things like _å ä ö é_ in
* expansion.

Den 2016-01-06 kl. 20:23, skrev Pawel Urbanski:
> I don't know if it is something people do alot - split a document /
> book into many files.

All the time. The only hassle on *nix is that you want to give
the files names starting with (a prefix and) a fixed number of
digits like chap-010-something.md chap-020-otherwise.md to have
them sort correctly in the shell. Also you normally want a stride
>1 between the numbers on the original files so that you can
insert new files between the old ones without renumbering all of them.

Den 2016-01-07 kl. 04:50, skrev Ryan Gray:
>> >On Jan 6, 2016, at 12:14 PM, John
MACFARLANE<j...@berkeley.edu> wrote:
>> >
>> >Yes, on second thought I'm just going to revert that commit.
>> >
>> >This is something that should be done by the shell.
>> >
> Maybe so, but cmd.exe will never get that feature I suspect.
>
> My Windows box is at work, but I suspect a workaround for those
that need it is to write a .cmd script wrapper that does the
expansion. If I can come up with something, I'll post it.

I've written a pandoc wrapper (in Perl) mainly for allowing
fetching command line arguments from files with a syntax similar
to the command line itself, which I mean to make publicly
available. I will add support for [File::Zglob][] to it. Last
time I looked (years ago) installing perl on Windows was a *lot*
easier than installing make. Faking shell expansion in a batchfile
is not something I ever tried but I can imagine what it would be
like! I figure I add an option which takes File::Zglob patterns
as arguments, which are then expanded and appended to the pandoc
command line. It will be expansion by File::Zglob rules rather
than by shell rules, but expansion it will be,
and with as good Unicode support as perl can provide!
It's slower of course, but that's just another tradeoff.

/bpj

[File::Zglob]: https://metacpan.org/pod/File::Zglob

Ryan Gray

unread,
Jan 8, 2016, 8:31:19 PM1/8/16
to pandoc-...@googlegroups.com
I didn't intend to solve it, I intended to create a reasonable workaround for Windows users using Pandoc who want this ability now. I agree that cmd.exe is not as capable as UNIX shells, but I would not call it unusable. 

For all those not wanting to install a non-default command line environment, you can use this *workaround*:

pandocs.cmd:
```
@echo off
:: Pandoc wrapper for calling it with wildcard file parameters.
:: Expands any arguments containing wildcards according to standard
:: Windows CMD.exe conventions.
setlocal EnableDelayedExpansion
set pandoc_cmd=pandoc
for %%I in (%*) do set pandoc_cmd=!pandoc_cmd! "%%~I"
!pandoc_cmd!
endlocal
```

Works with redirecting standard input and output as well:

echo # TEST | pandocs *.md -

-Ryan

On Jan 7, 2016, at 7:24 AM, Shahbaz Youssefi <sha...@gmail.com> wrote:

You may be able to solve the globbing problem with a wrapper, but there are all sorts of command-line niceties you would be missing with cmd.exe.

I would simply advise installing cygwin. Or, if one has git for windows installed, they get bash, with a terminal already tweaked to look nicer than the default (as little as that is possible). cmd.exe is simply not a usable cli, there is no point in supporting it.
On Wed, Jan 6, 2016 at 10:50 PM, Ryan Gray <u2mr...@me.com> wrote:

> On Jan 6, 2016, at 12:14 PM, John MACFARLANE <j...@berkeley.edu> wrote:
>
> Yes, on second thought I'm just going to revert that commit.
>
> This is something that should be done by the shell.
>

Maybe so, but cmd.exe will never get that feature I suspect.

My Windows box is at work, but I suspect a workaround for those that need it is to write a .cmd script wrapper that does the expansion. If I can come up with something, I'll post it.

-Ryan

--
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-discus...@googlegroups.com.
To post to this group, send email to pandoc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7CF81D92-CC7E-4641-AD64-4C00E3BBC3E9%40me.com.
For more options, visit https://groups.google.com/d/optout.

--
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-discus...@googlegroups.com.
To post to this group, send email to pandoc-...@googlegroups.com.

Sergio Correia

unread,
Mar 8, 2017, 10:47:43 AM3/8/17
to pandoc-discuss
Bumping this thread as I've just been hit with this feature/bug (i.e. something that worked on my linux desktop is not working anymore on my laptop).

I think John's initial approach of calling Glob under Windows is sensible. It wouldn't affect Linux users at all, and would be useful to more 'casual' users, which is always good. Another advantage of using glob is that you don't have to work around every single case and just rely on glob doing it right (which it should).
Reply all
Reply to author
Forward
0 new messages