public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Infelicity in Anansi/Pandoc interaction
@ 2012-03-25  9:40 Dirk Laurie
       [not found] ` <CABcj=t=wxT2Szg-cyxS4iVwf19_M40qWU_F=9jDv37CKYUL8Pw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Dirk Laurie @ 2012-03-25  9:40 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: John Millikin

The previous generation of academics used to have a little suitcase
containing every OHP slide they ever wrote on the topic, and when asked
to give a lecture somewhere they would quickly assemble a selection
of old slides.  Preparation time, 30 minutes max.

I take a leaf out of their book, or a slide out of their suitcase, using
Pandoc and Anansi, which, both being packages available via cabal,
combine rather conveniently.

1. I have an Anansi-fomatted source file with slides, which is just
a markdown-formatted file but with each slide sandwiched between
Anansi directives, thus:

    :d Slide Title
    Markdown source of slide
    :

2. In the same file, I have Anansi source for each particular slide show,
thus:

    :f lecture1.txt
    |Slide Title 1|
    |Slide Title 2|
    ...
    :

3. When I run `anansi tangle` on the file, it makes Markdown files
for all the lectures, which I then process with `pandoc -t slidy`.

Now my problem is this.  I can't reuse Pandoc top matter this
way.  On the one hand Anansi puts a blank line before every macro
expansion, on the other Pandoc does not recognize percent-sign
lines as top matter if there has been a blank line before.

The workaround is not too bad: I just copy the top matter
from one `:f` definition to another.

But either a Pandoc option to allow blank lines before percent
lines, or Anansi behaviour to suppress automatically inserted
blank lines at the top of a file, would solve the problem more
cleanly.

Does any Pandoc user have another application in which
allowing blank lines would be useful?  If so, I'd like to
ask John Macfarlane to consider it; otherwise, I'd like to
ask John Millikin whether doing it to Anansi would break
anything.


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

* Re: Infelicity in Anansi/Pandoc interaction
       [not found] ` <CABcj=t=wxT2Szg-cyxS4iVwf19_M40qWU_F=9jDv37CKYUL8Pw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-03-25 11:26   ` Dirk Laurie
  2012-03-25 20:33   ` John Millikin
  1 sibling, 0 replies; 4+ messages in thread
From: Dirk Laurie @ 2012-03-25 11:26 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: John Millikin

>
> The workaround is not too bad: I just copy the top matter
> from one `:f` definition to another.
>
Except that it does not work.  The ":f" material is also preceded
by a blank line.  I have a Linux workaround:

    tail -n +2 lecture.txt | pandoc -t slidy -o lecture.html


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

* Re: Infelicity in Anansi/Pandoc interaction
       [not found] ` <CABcj=t=wxT2Szg-cyxS4iVwf19_M40qWU_F=9jDv37CKYUL8Pw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2012-03-25 11:26   ` Dirk Laurie
@ 2012-03-25 20:33   ` John Millikin
       [not found]     ` <CAL1ky9rhN5qgKk-RM9=9O2_L4SukZyVrJgNgDhCPATYuXUyisg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: John Millikin @ 2012-03-25 20:33 UTC (permalink / raw)
  To: Dirk Laurie; +Cc: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On Sun, Mar 25, 2012 at 02:40, Dirk Laurie <dirk.laurie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Now my problem is this.  I can't reuse Pandoc top matter this
> way.  On the one hand Anansi puts a blank line before every macro
> expansion, on the other Pandoc does not recognize percent-sign
> lines as top matter if there has been a blank line before.
>
> The workaround is not too bad: I just copy the top matter
> from one `:f` definition to another.
>
> But either a Pandoc option to allow blank lines before percent
> lines, or Anansi behaviour to suppress automatically inserted
> blank lines at the top of a file, would solve the problem more
> cleanly.
>
> Does any Pandoc user have another application in which
> allowing blank lines would be useful?  If so, I'd like to
> ask John Macfarlane to consider it; otherwise, I'd like to
> ask John Millikin whether doing it to Anansi would break
> anything.

I think it's safe to just have Anansi strip off initial newlined in
tangled output. This would leave the rest of the ouput unchanged, so
tangled source code is still readable.

I've uploaded Anansi 0.4.4 with this new behavior, so please try it
and let me know if it solves the problem.

Independent of this change, I think it would also be good for Pandoc
Markdown to tolerate blank lines before its metadata block. It is
unusual for a markup format to behave differently based on blank
initial lines, especially when standard Markdown is fairly insensitive
to excess newlines.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.



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

* Re: Infelicity in Anansi/Pandoc interaction
       [not found]     ` <CAL1ky9rhN5qgKk-RM9=9O2_L4SukZyVrJgNgDhCPATYuXUyisg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-03-26  2:35       ` John MacFarlane
  0 siblings, 0 replies; 4+ messages in thread
From: John MacFarlane @ 2012-03-26  2:35 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ John Millikin [Mar 25 12 13:33 ]:
> On Sun, Mar 25, 2012 at 02:40, Dirk Laurie <dirk.laurie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Now my problem is this.  I can't reuse Pandoc top matter this
> > way.  On the one hand Anansi puts a blank line before every macro
> > expansion, on the other Pandoc does not recognize percent-sign
> > lines as top matter if there has been a blank line before.
> >
> > The workaround is not too bad: I just copy the top matter
> > from one `:f` definition to another.
> >
> > But either a Pandoc option to allow blank lines before percent
> > lines, or Anansi behaviour to suppress automatically inserted
> > blank lines at the top of a file, would solve the problem more
> > cleanly.
> >
> > Does any Pandoc user have another application in which
> > allowing blank lines would be useful?  If so, I'd like to
> > ask John Macfarlane to consider it; otherwise, I'd like to
> > ask John Millikin whether doing it to Anansi would break
> > anything.
> 
> I think it's safe to just have Anansi strip off initial newlined in
> tangled output. This would leave the rest of the ouput unchanged, so
> tangled source code is still readable.
> 
> I've uploaded Anansi 0.4.4 with this new behavior, so please try it
> and let me know if it solves the problem.
> 
> Independent of this change, I think it would also be good for Pandoc
> Markdown to tolerate blank lines before its metadata block. It is
> unusual for a markup format to behave differently based on blank
> initial lines, especially when standard Markdown is fairly insensitive
> to excess newlines.

One precedent is multimarkdown, which requires that metadata appear
on the first line. Indeed, if you want to start a multimarkdown
document with "Consider: blah blah blah", and not have this be
interpreted as metadata, the only solution is to leave a blank line at
the beginning.  I think, though, that pandoc could relax the
requirement, since if you want to start a document with a percent
sign (a pretty rare case), you can always backslash-escape it.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.



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

end of thread, other threads:[~2012-03-26  2:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-25  9:40 Infelicity in Anansi/Pandoc interaction Dirk Laurie
     [not found] ` <CABcj=t=wxT2Szg-cyxS4iVwf19_M40qWU_F=9jDv37CKYUL8Pw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-25 11:26   ` Dirk Laurie
2012-03-25 20:33   ` John Millikin
     [not found]     ` <CAL1ky9rhN5qgKk-RM9=9O2_L4SukZyVrJgNgDhCPATYuXUyisg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-26  2:35       ` 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).