* Conversion from docx to gfm: Can I stop pandoc from inserting blank lines between bullet points?
@ 2020-02-04 23:29 Clare Sudbery
[not found] ` <b8f1db8f-2905-45ea-bea6-7cced40456f7-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Clare Sudbery @ 2020-02-04 23:29 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1410 bytes --]
Hi
I am converting from docx to gfm.
My input Word docs contain simple bulleted lists like this:
· This is a test top level bullet
o This is a test nested bullet
· This is a test top level bullet
o This is a test nested bullet
· This is a test top level bullet
o This is a test nested bullet
My output markdown docs contain blank lines between every bullet point like
this:
- This is a test top level bullet
- This is a test nested bullet
- This is a test top level bullet
- This is a test nested bullet
- This is a test top level bullet
- This is a test nested bullet
I have tried using the various docx extensions available but none of them
seem relevant to this issue.
Here is a sample pandoc command:
pandoc -t gfm -o "/path/file.md" "/path/file.docx"
Is there any way I can avoid this effect, or do I have to remove the
resulting blank lines myself?
Cheers
Clare.
--
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/b8f1db8f-2905-45ea-bea6-7cced40456f7%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 47661 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Conversion from docx to gfm: Can I stop pandoc from inserting blank lines between bullet points?
[not found] ` <b8f1db8f-2905-45ea-bea6-7cced40456f7-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-02-05 20:59 ` John MacFarlane
[not found] ` <yh480ksgjowy1f.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2020-02-05 20:59 UTC (permalink / raw)
To: Clare Sudbery, pandoc-discuss
You could use a lua filter; it would have to replace
list items that consist of a single Para element with
list items that consist of a single Plain element.
This filter will do it:
```
paraToPlain = {
Para = function(el)
return pandoc.Plain(el.content)
end
}
function BulletList(el)
return pandoc.walk_block(el, paraToPlain)
end
```
Save that as tightenLists.lua and use
--lua-filter tightenLists.lua on your command line.
Clare Sudbery <claresudbery-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> Hi
>
> I am converting from docx to gfm.
>
> My input Word docs contain simple bulleted lists like this:
>
> · This is a test top level bullet
>
> o This is a test nested bullet
>
> · This is a test top level bullet
>
> o This is a test nested bullet
>
> · This is a test top level bullet
>
> o This is a test nested bullet
>
> My output markdown docs contain blank lines between every bullet point like
> this:
> - This is a test top level bullet
>
> - This is a test nested bullet
>
> - This is a test top level bullet
>
> - This is a test nested bullet
>
> - This is a test top level bullet
>
> - This is a test nested bullet
>
>
> I have tried using the various docx extensions available but none of them
> seem relevant to this issue.
>
> Here is a sample pandoc command:
> pandoc -t gfm -o "/path/file.md" "/path/file.docx"
>
> Is there any way I can avoid this effect, or do I have to remove the
> resulting blank lines myself?
>
> Cheers
> Clare.
>
> --
> 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/b8f1db8f-2905-45ea-bea6-7cced40456f7%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/yh480ksgjowy1f.fsf%40johnmacfarlane.net.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Conversion from docx to gfm: Can I stop pandoc from inserting blank lines between bullet points?
[not found] ` <yh480ksgjowy1f.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2020-02-06 12:52 ` Clare Sudbery
0 siblings, 0 replies; 3+ messages in thread
From: Clare Sudbery @ 2020-02-06 12:52 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 2748 bytes --]
Fantastic, thank you!
On Wed, 5 Feb 2020 at 20:59, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:
>
> You could use a lua filter; it would have to replace
> list items that consist of a single Para element with
> list items that consist of a single Plain element.
>
> This filter will do it:
>
> ```
>
> paraToPlain = {
> Para = function(el)
> return pandoc.Plain(el.content)
> end
> }
>
> function BulletList(el)
> return pandoc.walk_block(el, paraToPlain)
> end
>
> ```
>
> Save that as tightenLists.lua and use
>
> --lua-filter tightenLists.lua on your command line.
>
> Clare Sudbery <claresudbery-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > Hi
> >
> > I am converting from docx to gfm.
> >
> > My input Word docs contain simple bulleted lists like this:
> >
> > · This is a test top level bullet
> >
> > o This is a test nested bullet
> >
> > · This is a test top level bullet
> >
> > o This is a test nested bullet
> >
> > · This is a test top level bullet
> >
> > o This is a test nested bullet
> >
> > My output markdown docs contain blank lines between every bullet point
> like
> > this:
> > - This is a test top level bullet
> >
> > - This is a test nested bullet
> >
> > - This is a test top level bullet
> >
> > - This is a test nested bullet
> >
> > - This is a test top level bullet
> >
> > - This is a test nested bullet
> >
> >
> > I have tried using the various docx extensions available but none of
> them
> > seem relevant to this issue.
> >
> > Here is a sample pandoc command:
> > pandoc -t gfm -o "/path/file.md" "/path/file.docx"
> >
> > Is there any way I can avoid this effect, or do I have to remove the
> > resulting blank lines myself?
> >
> > Cheers
> > Clare.
> >
> > --
> > 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/b8f1db8f-2905-45ea-bea6-7cced40456f7%40googlegroups.com
> .
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAJePrFq_%3DWS1d%2BmbdVLGLFMsTq%2BVoxOFTCoqgPsCA0pL3oaLHQ%40mail.gmail.com.
[-- Attachment #2: Type: text/html, Size: 4095 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-06 12:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 23:29 Conversion from docx to gfm: Can I stop pandoc from inserting blank lines between bullet points? Clare Sudbery
[not found] ` <b8f1db8f-2905-45ea-bea6-7cced40456f7-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-02-05 20:59 ` John MacFarlane
[not found] ` <yh480ksgjowy1f.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2020-02-06 12:52 ` Clare Sudbery
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).