public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* YAML closing delimiter
@ 2015-10-13 16:11 John Muccigrosso
       [not found] ` <ebb2d862-397d-4e25-9e7e-fb54323a81c2-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: John Muccigrosso @ 2015-10-13 16:11 UTC (permalink / raw)
  To: pandoc-discuss


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

Pandoc uses 
...

as its closing delimiter in the YAML block. It will also *read *
---

 as one.


I see from the discussion when adding metadata to pandoc was being 
discussed that gitit also uses the periods 
<https://github.com/jgm/gitit/blob/22b7f66c79068a7da3a44d3ada8e5133ea334d95/README.markdown> 
to close the front matter by the logic that sections constitutes a YAML 
document which takes that delimiter. 
<http://www.yaml.org/spec/1.2/spec.html#marker/document%20end/>

However this seems not to be the case in at least some other environments 
that use YAML for front matter, like Jekyll 
<http://jekyllrb.com/docs/frontmatter/> and Assemble 
<http://assemble.io/docs/YAML-front-matter.html>.

For me, this means that the YAML front matter in pandoc-generated markdown 
docs doesn't get read correctly in, for example, MacDown 
<https://macdown.uranusjr.com>, which I use as a markdown editor, since it 
uses Jekyll to handle the front matter.

I raise this because I wonder how common a problem this is, and what the 
best solution might be.

-- 
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/ebb2d862-397d-4e25-9e7e-fb54323a81c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: YAML closing delimiter
       [not found] ` <ebb2d862-397d-4e25-9e7e-fb54323a81c2-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-10-13 18:09   ` John MACFARLANE
       [not found]     ` <20151013180944.GB6891-4kKid1p5UN4xFjuZnxJpBp3lxR28IOakuDuwTybUTCk@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: John MACFARLANE @ 2015-10-13 18:09 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Best solution would be to ask these other processors to
support ... as closing delimiter -- since after all this
is a standard YAML.  (Another advantage is that if you
use ---, many markdown syntax highlighters will highlight the
last line of your metadata as a title, which looks bad.)

+++ John Muccigrosso [Oct 13 15 09:11 ]:
>   Pandoc uses
>   ...
>   as its closing delimiter in the YAML block. It will also read
>   ---
>    as one.
>   I see from the discussion when adding metadata to pandoc was being
>   discussed that [1]gitit also uses the periods to close the front matter
>   by the logic that sections constitutes a YAML document which [2]takes
>   that delimiter.
>   However this seems not to be the case in at least some other
>   environments that use YAML for front matter, like [3]Jekyll and
>   [4]Assemble.
>   For me, this means that the YAML front matter in pandoc-generated
>   markdown docs doesn't get read correctly in, for example, [5]MacDown,
>   which I use as a markdown editor, since it uses Jekyll to handle the
>   front matter.
>   I raise this because I wonder how common a problem this is, and what
>   the best solution might be.
>
>   --
>   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 [6]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To post to this group, send email to
>   [7]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To view this discussion on the web visit
>   [8]https://groups.google.com/d/msgid/pandoc-discuss/ebb2d862-397d-4e25-
>   9e7e-fb54323a81c2%40googlegroups.com.
>   For more options, visit [9]https://groups.google.com/d/optout.
>
>References
>
>   1. https://github.com/jgm/gitit/blob/22b7f66c79068a7da3a44d3ada8e5133ea334d95/README.markdown
>   2. http://www.yaml.org/spec/1.2/spec.html#marker/document end/
>   3. http://jekyllrb.com/docs/frontmatter/
>   4. http://assemble.io/docs/YAML-front-matter.html
>   5. https://macdown.uranusjr.com/
>   6. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   7. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   8. https://groups.google.com/d/msgid/pandoc-discuss/ebb2d862-397d-4e25-9e7e-fb54323a81c2-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   9. https://groups.google.com/d/optout


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

* Re: YAML closing delimiter
       [not found]     ` <20151013180944.GB6891-4kKid1p5UN4xFjuZnxJpBp3lxR28IOakuDuwTybUTCk@public.gmane.org>
@ 2015-10-13 20:54       ` John Muccigrosso
       [not found]         ` <08e65baa-f8d6-4437-af61-d106b36d1382-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: John Muccigrosso @ 2015-10-13 20:54 UTC (permalink / raw)
  To: pandoc-discuss


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

On Tuesday, October 13, 2015 at 2:10:00 PM UTC-4, John MacFarlane wrote:
>
> Best solution would be to ask these other processors to 
> support ... as closing delimiter -- since after all this 
> is a standard YAML.  (Another advantage is that if you 
> use ---, many markdown syntax highlighters will highlight the 
> last line of your metadata as a title, which looks bad.) 
>

I've asked over at the Jekyll github repo, where they clearly had this 
discussion and went for "simplicity" for users by eliminating the option of 
using dots, which had been added to the original (and now again current) 
practice of only allowing hyphens. Their issue 3138 
<https://github.com/jekyll/jekyll/pull/3138> has a rather derogatory 
reference to "bending to the will of pandoc", which completely ignores the 
issue of actual YAML standards, raised by several people.

-- 
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/08e65baa-f8d6-4437-af61-d106b36d1382%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: YAML closing delimiter
       [not found]         ` <08e65baa-f8d6-4437-af61-d106b36d1382-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-10-18  8:58           ` BPJ
       [not found]             ` <CADAJKhCt9EqV_v3XTrXq=oPFiOHnEsk5xEtB8wYiMKb3V0xDTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-10-18 18:39           ` John Muccigrosso
  1 sibling, 1 reply; 8+ messages in thread
From: BPJ @ 2015-10-18  8:58 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Try

pandoc -t markdown in.md | perl -ple's/^\.\.\.$/---/' >out.md

tisdag 13 oktober 2015 skrev John Muccigrosso <jmuccigr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:

> On Tuesday, October 13, 2015 at 2:10:00 PM UTC-4, John MacFarlane wrote:
>>
>> Best solution would be to ask these other processors to
>> support ... as closing delimiter -- since after all this
>> is a standard YAML.  (Another advantage is that if you
>> use ---, many markdown syntax highlighters will highlight the
>> last line of your metadata as a title, which looks bad.)
>>
>
> I've asked over at the Jekyll github repo, where they clearly had this
> discussion and went for "simplicity" for users by eliminating the option of
> using dots, which had been added to the original (and now again current)
> practice of only allowing hyphens. Their issue 3138
> <https://github.com/jekyll/jekyll/pull/3138> has a rather derogatory
> reference to "bending to the will of pandoc", which completely ignores the
> issue of actual YAML standards, raised by several people.
>
> --
> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> <javascript:_e(%7B%7D,'cvml','pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org');>
> .
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> <javascript:_e(%7B%7D,'cvml','pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/08e65baa-f8d6-4437-af61-d106b36d1382%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/08e65baa-f8d6-4437-af61-d106b36d1382%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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-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/CADAJKhCt9EqV_v3XTrXq%3DoPFiOHnEsk5xEtB8wYiMKb3V0xDTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: YAML closing delimiter
       [not found]         ` <08e65baa-f8d6-4437-af61-d106b36d1382-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2015-10-18  8:58           ` BPJ
@ 2015-10-18 18:39           ` John Muccigrosso
  1 sibling, 0 replies; 8+ messages in thread
From: John Muccigrosso @ 2015-10-18 18:39 UTC (permalink / raw)
  To: pandoc-discuss


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

OK, turns out that despite several threads to the contrary, the current 
Jekyll codebase does indeed support the dots as well as the dashes.

Working now on getting my markdown editor, MacDown, to support it too.

-- 
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/848379a7-9aff-40d9-b24e-149531932c9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: YAML closing delimiter
       [not found]             ` <CADAJKhCt9EqV_v3XTrXq=oPFiOHnEsk5xEtB8wYiMKb3V0xDTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-10-19  5:12               ` John MacFarlane
       [not found]                 ` <20151019051220.GA15885-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: John MacFarlane @ 2015-10-19  5:12 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ BPJ [Oct 18 15 10:58 ]:
>   Try
>
>   pandoc -t markdown [1]in.md | perl -ple's/^\.\.\.$/---/' >out.md

This will probably work well enough in most cases, but what
if your document has a line with `...` that isn't a YAML
header closer?  (E.g. in a fenced code block?)  It will get
converted to `---` too, won't it?


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

* Re: YAML closing delimiter
       [not found]                 ` <20151019051220.GA15885-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
@ 2015-10-19  8:50                   ` BP Jonsson
       [not found]                     ` <5624AEDA.9050903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: BP Jonsson @ 2015-10-19  8:50 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Den 2015-10-19 kl. 07:12, skrev John MacFarlane:
> +++ BPJ [Oct 18 15 10:58 ]:
>>   Try
>>
>>   pandoc -t markdown [1]in.md | perl -ple's/^\.\.\.$/---/' >out.md
>
> This will probably work well enough in most cases, but what
> if your document has a line with `...` that isn't a YAML
> header closer?  (E.g. in a fenced code block?)  It will get
> converted to `---` too, won't it?
>

I thought the same right after I hit send. There is a trick which 
will replace only the first match in the file, which is usually 
what you want in this case:

    pandoc -t markdown in.md | perl -ple'$seen ||= 
s/^\.\.\.$/---/' >out.md

Here `$seen`, which is a global variable, will be set to a true 
value the first time the substitution matches because the 
substitution operator returns the number of substitutions made on 
the current line, which in this case will be either 0 (false) or 1 
(true). On subsequent lines, when `$seen` already has a true value 
the substitution won't even be tried.  It's faster too as it 
doesn't need to try the regular expression against every line in 
the file. (It needs to *print* every line though, which it does.)

/bpj

P.S.  I don't know where the `[1]` came from.  Probably a pasting 
error!


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

* Re: YAML closing delimiter
       [not found]                     ` <5624AEDA.9050903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-10-21  4:04                       ` John MacFarlane
  0 siblings, 0 replies; 8+ messages in thread
From: John MacFarlane @ 2015-10-21  4:04 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ BP Jonsson [Oct 19 15 10:50 ]:
>Den 2015-10-19 kl. 07:12, skrev John MacFarlane:
>>+++ BPJ [Oct 18 15 10:58 ]:
>>>  Try
>>>
>>>  pandoc -t markdown [1]in.md | perl -ple's/^\.\.\.$/---/' >out.md
>>
>>This will probably work well enough in most cases, but what
>>if your document has a line with `...` that isn't a YAML
>>header closer?  (E.g. in a fenced code block?)  It will get
>>converted to `---` too, won't it?
>>
>
>I thought the same right after I hit send. There is a trick which will 
>replace only the first match in the file, which is usually what you 
>want in this case:
>
>   pandoc -t markdown in.md | perl -ple'$seen ||= s/^\.\.\.$/---/' >>out.md

Thanks for that.  I puzzled for some time trying to figure
out how to do this!  Seems like it ought to be simpler.


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

end of thread, other threads:[~2015-10-21  4:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13 16:11 YAML closing delimiter John Muccigrosso
     [not found] ` <ebb2d862-397d-4e25-9e7e-fb54323a81c2-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-10-13 18:09   ` John MACFARLANE
     [not found]     ` <20151013180944.GB6891-4kKid1p5UN4xFjuZnxJpBp3lxR28IOakuDuwTybUTCk@public.gmane.org>
2015-10-13 20:54       ` John Muccigrosso
     [not found]         ` <08e65baa-f8d6-4437-af61-d106b36d1382-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-10-18  8:58           ` BPJ
     [not found]             ` <CADAJKhCt9EqV_v3XTrXq=oPFiOHnEsk5xEtB8wYiMKb3V0xDTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-19  5:12               ` John MacFarlane
     [not found]                 ` <20151019051220.GA15885-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
2015-10-19  8:50                   ` BP Jonsson
     [not found]                     ` <5624AEDA.9050903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-21  4:04                       ` John MacFarlane
2015-10-18 18:39           ` John Muccigrosso

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