* ' in meta value is converted into ’ in a lua filter
@ 2019-05-15 13:01 jiewuza
[not found] ` <m2mujn7txr.fsf-9Onoh4P/yGk@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: jiewuza @ 2019-05-15 13:01 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
I have some meta value like
```
---
test: Children's Cognitive Ability
---
```
In my lua filter:
```
function Meta(meta)
for k, v in pairs(meta) do
if k=='test' then
print(pandoc.utils.stringify(v))
end
end
end
```
I find it prints
```
Children’s Cognitive Ability
```
I want to keep the single quote as it is. What should I do?
--
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/m2mujn7txr.fsf%40163.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
[not found] ` <m2mujn7txr.fsf-9Onoh4P/yGk@public.gmane.org>
@ 2019-05-15 16:21 ` John MacFarlane
2019-05-16 7:40 ` jiewuza
2019-05-16 8:46 ` jiewuza
0 siblings, 2 replies; 13+ messages in thread
From: John MacFarlane @ 2019-05-15 16:21 UTC (permalink / raw)
To: jiewuza, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
YAML metadata fields are interpreted as markdown.
You can escape it to prevent "smartification":
Children\'s Cognitive Ability
Or disable smartification globally by using `-f
markdown-smart` on the command line.
jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> I have some meta value like
> ```
> ---
> test: Children's Cognitive Ability
> ---
> ```
>
> In my lua filter:
> ```
> function Meta(meta)
> for k, v in pairs(meta) do
> if k=='test' then
> print(pandoc.utils.stringify(v))
> end
> end
> end
> ```
>
> I find it prints
> ```
> Children’s Cognitive Ability
> ```
>
> I want to keep the single quote as it is. What should I do?
>
> --
> 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/m2mujn7txr.fsf%40163.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-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/yh480kbm03elii.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
2019-05-15 16:21 ` John MacFarlane
@ 2019-05-16 7:40 ` jiewuza
[not found] ` <m2ftpe7sos.fsf-9Onoh4P/yGk@public.gmane.org>
2019-05-16 8:46 ` jiewuza
1 sibling, 1 reply; 13+ messages in thread
From: jiewuza @ 2019-05-16 7:40 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
I checked the manual, `smart` has effect on quotes and dashes.
Instead of disabling smart, I have to escape it to minimize the effect.
BTW, if it is for the title value
```
---
title: Children's Cognitive Ability
---
```
I get the expected result withouth escaping the quote or disabling smart:
```
\title{Children's Cognitive Ability}
```
Pandoc deals with it differently from a lua filter?
John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
> YAML metadata fields are interpreted as markdown.
>
> You can escape it to prevent "smartification":
>
> Children\'s Cognitive Ability
>
> Or disable smartification globally by using `-f
> markdown-smart` on the command line.
>
> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>
>> I have some meta value like
>> ```
>> ---
>> test: Children's Cognitive Ability
>> ---
>> ```
>>
>> In my lua filter:
>> ```
>> function Meta(meta)
>> for k, v in pairs(meta) do
>> if k=='test' then
>> print(pandoc.utils.stringify(v))
>> end
>> end
>> end
>> ```
>>
>> I find it prints
>> ```
>> Children’s Cognitive Ability
>> ```
>>
>> I want to keep the single quote as it is. What should I do?
>>
>> --
>> 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/m2mujn7txr.fsf%40163.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-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/m2ftpe7sos.fsf%40163.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
[not found] ` <m2ftpe7sos.fsf-9Onoh4P/yGk@public.gmane.org>
@ 2019-05-16 7:55 ` BPJ
2019-05-16 8:50 ` jiewuza
0 siblings, 1 reply; 13+ messages in thread
From: BPJ @ 2019-05-16 7:55 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 4187 bytes --]
I usually use a code span or code block in the metadata when I want it to
stringify verbatim with ASCII quotes, dollars, square brackets etc.
preserved. The stringification function should turn this into a plain
string without any change to the Lua code. Note however that since the
backtick is a reserved character in YAML you must enclose the code span in
a single quoted string and double any single quotes inside the string:
````pandoc-markdown
---
test: '`Children''s cognitive ability`'
block: |
```
Children's cognitive ability.
Several.
Lines.
Of.
Text.
```
---
````
thus in your particular example the backslash escape may be preferable, but
I definitely prefer the code span/block solution when there are many
sensitive characters in the string. A lot of backslash escapes affect
readability negatively, especially when you need to escape backslashes
themselves. For some reason I find `` '`don''t`' `` more readable than ``
don\'t ``, but YMMV.
Den tors 16 maj 2019 09:41jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>
> I checked the manual, `smart` has effect on quotes and dashes.
> Instead of disabling smart, I have to escape it to minimize the effect.
>
> BTW, if it is for the title value
> ```
> ---
> title: Children's Cognitive Ability
> ---
> ```
>
> I get the expected result withouth escaping the quote or disabling smart:
>
> ```
> \title{Children's Cognitive Ability}
> ```
>
> Pandoc deals with it differently from a lua filter?
>
>
> John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>
> > YAML metadata fields are interpreted as markdown.
> >
> > You can escape it to prevent "smartification":
> >
> > Children\'s Cognitive Ability
> >
> > Or disable smartification globally by using `-f
> > markdown-smart` on the command line.
> >
> > jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> >
> >> I have some meta value like
> >> ```
> >> ---
> >> test: Children's Cognitive Ability
> >> ---
> >> ```
> >>
> >> In my lua filter:
> >> ```
> >> function Meta(meta)
> >> for k, v in pairs(meta) do
> >> if k=='test' then
> >> print(pandoc.utils.stringify(v))
> >> end
> >> end
> >> end
> >> ```
> >>
> >> I find it prints
> >> ```
> >> Children’s Cognitive Ability
> >> ```
> >>
> >> I want to keep the single quote as it is. What should I do?
> >>
> >> --
> >> 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/m2mujn7txr.fsf%40163.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-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/m2ftpe7sos.fsf%40163.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-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/CADAJKhDvaqCFXU4CSs0nzOef%3Dv5Ws8rd9XJ7XZG50pUWcqrgxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #2: Type: text/html, Size: 6609 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
2019-05-15 16:21 ` John MacFarlane
2019-05-16 7:40 ` jiewuza
@ 2019-05-16 8:46 ` jiewuza
[not found] ` <m2bm027po2.fsf-9Onoh4P/yGk@public.gmane.org>
1 sibling, 1 reply; 13+ messages in thread
From: jiewuza @ 2019-05-16 8:46 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
I also find this: https://github.com/dotmaster/toYaml/issues/1
something inconsistent in pandoc YAML and YAML itself.
John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
> YAML metadata fields are interpreted as markdown.
>
> You can escape it to prevent "smartification":
>
> Children\'s Cognitive Ability
>
> Or disable smartification globally by using `-f
> markdown-smart` on the command line.
>
> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>
>> I have some meta value like
>> ```
>> ---
>> test: Children's Cognitive Ability
>> ---
>> ```
>>
>> In my lua filter:
>> ```
>> function Meta(meta)
>> for k, v in pairs(meta) do
>> if k=='test' then
>> print(pandoc.utils.stringify(v))
>> end
>> end
>> end
>> ```
>>
>> I find it prints
>> ```
>> Children’s Cognitive Ability
>> ```
>>
>> I want to keep the single quote as it is. What should I do?
>>
>> --
>> 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/m2mujn7txr.fsf%40163.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-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/m2bm027po2.fsf%40163.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
2019-05-16 7:55 ` BPJ
@ 2019-05-16 8:50 ` jiewuza
[not found] ` <m27eaq7pgx.fsf-9Onoh4P/yGk@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: jiewuza @ 2019-05-16 8:50 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
Thanks.
The `double single-quote` stuff is consistent to https://github.com/dotmaster/toYaml/issues/1
But it is a little complicated.
BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> I usually use a code span or code block in the metadata when I want it to stringify verbatim with ASCII quotes, dollars, square brackets etc.
> preserved. The stringification function should turn this into a plain string without any change to the Lua code. Note however that since the backtick is a
> reserved character in YAML you must enclose the code span in a single quoted string and double any single quotes inside the string:
>
> ````pandoc-markdown
> ---
> test: '`Children''s cognitive ability`'
> block: |
> ```
> Children's cognitive ability.
> Several.
> Lines.
> Of.
> Text.
> ```
> ---
> ````
>
> thus in your particular example the backslash escape may be preferable, but I definitely prefer the code span/block solution when there are many
> sensitive characters in the string. A lot of backslash escapes affect readability negatively, especially when you need to escape backslashes
> themselves. For some reason I find `` '`don''t`' `` more readable than `` don\'t ``, but YMMV.
>
> Den tors 16 maj 2019 09:41jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>
> I checked the manual, `smart` has effect on quotes and dashes.
> Instead of disabling smart, I have to escape it to minimize the effect.
>
> BTW, if it is for the title value
> ```
> ---
> title: Children's Cognitive Ability
> ---
> ```
>
> I get the expected result withouth escaping the quote or disabling smart:
>
> ```
> \title{Children's Cognitive Ability}
> ```
>
> Pandoc deals with it differently from a lua filter?
>
> John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>
> > YAML metadata fields are interpreted as markdown.
> >
> > You can escape it to prevent "smartification":
> >
> > Children\'s Cognitive Ability
> >
> > Or disable smartification globally by using `-f
> > markdown-smart` on the command line.
> >
> > jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> >
> >> I have some meta value like
> >> ```
> >> ---
> >> test: Children's Cognitive Ability
> >> ---
> >> ```
> >>
> >> In my lua filter:
> >> ```
> >> function Meta(meta)
> >> for k, v in pairs(meta) do
> >> if k=='test' then
> >> print(pandoc.utils.stringify(v))
> >> end
> >> end
> >> end
> >> ```
> >>
> >> I find it prints
> >> ```
> >> Children’s Cognitive Ability
> >> ```
> >>
> >> I want to keep the single quote as it is. What should I do?
> >>
> >> --
> >> 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/m2mujn7txr.fsf%40163.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-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/m2ftpe7sos.fsf%40163.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-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/m27eaq7pgx.fsf%40163.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
[not found] ` <m27eaq7pgx.fsf-9Onoh4P/yGk@public.gmane.org>
@ 2019-05-16 17:07 ` BPJ
2019-05-16 17:13 ` BPJ
0 siblings, 1 reply; 13+ messages in thread
From: BPJ @ 2019-05-16 17:07 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 5713 bytes --]
The double single quote is how you escape a single quote inside a single
quoted string in YAML. It makes sense because the single quote itself is
the only character which needs to be escaped inside a single quoted string,
and it's unambiguous because two quoted strings after each other without
anything between is a syntax error in YAML.
Den tors 16 maj 2019 10:55jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>
> Thanks.
>
> The `double single-quote` stuff is consistent to
> https://github.com/dotmaster/toYaml/issues/1
>
> But it is a little complicated.
>
> BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > I usually use a code span or code block in the metadata when I want it
> to stringify verbatim with ASCII quotes, dollars, square brackets etc.
> > preserved. The stringification function should turn this into a plain
> string without any change to the Lua code. Note however that since the
> backtick is a
> > reserved character in YAML you must enclose the code span in a single
> quoted string and double any single quotes inside the string:
> >
> > ````pandoc-markdown
> > ---
> > test: '`Children''s cognitive ability`'
> > block: |
> > ```
> > Children's cognitive ability.
> > Several.
> > Lines.
> > Of.
> > Text.
> > ```
> > ---
> > ````
> >
> > thus in your particular example the backslash escape may be preferable,
> but I definitely prefer the code span/block solution when there are many
> > sensitive characters in the string. A lot of backslash escapes affect
> readability negatively, especially when you need to escape backslashes
> > themselves. For some reason I find `` '`don''t`' `` more readable than
> `` don\'t ``, but YMMV.
> >
> > Den tors 16 maj 2019 09:41jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
> >
> > I checked the manual, `smart` has effect on quotes and dashes.
> > Instead of disabling smart, I have to escape it to minimize the effect.
> >
> > BTW, if it is for the title value
> > ```
> > ---
> > title: Children's Cognitive Ability
> > ---
> > ```
> >
> > I get the expected result withouth escaping the quote or disabling
> smart:
> >
> > ```
> > \title{Children's Cognitive Ability}
> > ```
> >
> > Pandoc deals with it differently from a lua filter?
> >
> > John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
> >
> > > YAML metadata fields are interpreted as markdown.
> > >
> > > You can escape it to prevent "smartification":
> > >
> > > Children\'s Cognitive Ability
> > >
> > > Or disable smartification globally by using `-f
> > > markdown-smart` on the command line.
> > >
> > > jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> > >
> > >> I have some meta value like
> > >> ```
> > >> ---
> > >> test: Children's Cognitive Ability
> > >> ---
> > >> ```
> > >>
> > >> In my lua filter:
> > >> ```
> > >> function Meta(meta)
> > >> for k, v in pairs(meta) do
> > >> if k=='test' then
> > >> print(pandoc.utils.stringify(v))
> > >> end
> > >> end
> > >> end
> > >> ```
> > >>
> > >> I find it prints
> > >> ```
> > >> Children’s Cognitive Ability
> > >> ```
> > >>
> > >> I want to keep the single quote as it is. What should I do?
> > >>
> > >> --
> > >> 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-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm
> .
> > >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/m2mujn7txr.fsf%40163.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-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/m2ftpe7sos.fsf%40163.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-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/m27eaq7pgx.fsf%40163.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-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/CADAJKhCQ%3DhBR7ZJy4tYc8PzgJ72OOYoyDVTmwzPm8huHRXKV%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #2: Type: text/html, Size: 8922 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
2019-05-16 17:07 ` BPJ
@ 2019-05-16 17:13 ` BPJ
[not found] ` <CADAJKhDEN9EA8jaBH06=sqtc5Xpu5uZEutkCwpfaSpwQ2KGOWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-17 4:17 ` jiewuza
0 siblings, 2 replies; 13+ messages in thread
From: BPJ @ 2019-05-16 17:13 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 6060 bytes --]
Also you shouldn't rely on random secondary sources.
https://yaml.org/refcard.html
Den tors 16 maj 2019 19:07BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
> The double single quote is how you escape a single quote inside a single
> quoted string in YAML. It makes sense because the single quote itself is
> the only character which needs to be escaped inside a single quoted string,
> and it's unambiguous because two quoted strings after each other without
> anything between is a syntax error in YAML.
>
> Den tors 16 maj 2019 10:55jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>
>>
>> Thanks.
>>
>> The `double single-quote` stuff is consistent to
>> https://github.com/dotmaster/toYaml/issues/1
>>
>> But it is a little complicated.
>>
>> BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>
>> > I usually use a code span or code block in the metadata when I want it
>> to stringify verbatim with ASCII quotes, dollars, square brackets etc.
>> > preserved. The stringification function should turn this into a plain
>> string without any change to the Lua code. Note however that since the
>> backtick is a
>> > reserved character in YAML you must enclose the code span in a single
>> quoted string and double any single quotes inside the string:
>> >
>> > ````pandoc-markdown
>> > ---
>> > test: '`Children''s cognitive ability`'
>> > block: |
>> > ```
>> > Children's cognitive ability.
>> > Several.
>> > Lines.
>> > Of.
>> > Text.
>> > ```
>> > ---
>> > ````
>> >
>> > thus in your particular example the backslash escape may be preferable,
>> but I definitely prefer the code span/block solution when there are many
>> > sensitive characters in the string. A lot of backslash escapes affect
>> readability negatively, especially when you need to escape backslashes
>> > themselves. For some reason I find `` '`don''t`' `` more readable than
>> `` don\'t ``, but YMMV.
>> >
>> > Den tors 16 maj 2019 09:41jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>> >
>> > I checked the manual, `smart` has effect on quotes and dashes.
>> > Instead of disabling smart, I have to escape it to minimize the effect.
>> >
>> > BTW, if it is for the title value
>> > ```
>> > ---
>> > title: Children's Cognitive Ability
>> > ---
>> > ```
>> >
>> > I get the expected result withouth escaping the quote or disabling
>> smart:
>> >
>> > ```
>> > \title{Children's Cognitive Ability}
>> > ```
>> >
>> > Pandoc deals with it differently from a lua filter?
>> >
>> > John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>> >
>> > > YAML metadata fields are interpreted as markdown.
>> > >
>> > > You can escape it to prevent "smartification":
>> > >
>> > > Children\'s Cognitive Ability
>> > >
>> > > Or disable smartification globally by using `-f
>> > > markdown-smart` on the command line.
>> > >
>> > > jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>> > >
>> > >> I have some meta value like
>> > >> ```
>> > >> ---
>> > >> test: Children's Cognitive Ability
>> > >> ---
>> > >> ```
>> > >>
>> > >> In my lua filter:
>> > >> ```
>> > >> function Meta(meta)
>> > >> for k, v in pairs(meta) do
>> > >> if k=='test' then
>> > >> print(pandoc.utils.stringify(v))
>> > >> end
>> > >> end
>> > >> end
>> > >> ```
>> > >>
>> > >> I find it prints
>> > >> ```
>> > >> Children’s Cognitive Ability
>> > >> ```
>> > >>
>> > >> I want to keep the single quote as it is. What should I do?
>> > >>
>> > >> --
>> > >> 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/m2mujn7txr.fsf%40163.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-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/m2ftpe7sos.fsf%40163.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-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/m27eaq7pgx.fsf%40163.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-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/CADAJKhDEN9EA8jaBH06%3Dsqtc5Xpu5uZEutkCwpfaSpwQ2KGOWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #2: Type: text/html, Size: 9759 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
[not found] ` <CADAJKhDEN9EA8jaBH06=sqtc5Xpu5uZEutkCwpfaSpwQ2KGOWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-05-16 17:31 ` BPJ
0 siblings, 0 replies; 13+ messages in thread
From: BPJ @ 2019-05-16 17:31 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 6394 bytes --]
The Wikipedia article has a good overview
https://en.m.wikipedia.org/wiki/YAML#Design
Den tors 16 maj 2019 19:13BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
> Also you shouldn't rely on random secondary sources.
>
> https://yaml.org/refcard.html
>
>
> Den tors 16 maj 2019 19:07BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>
>> The double single quote is how you escape a single quote inside a single
>> quoted string in YAML. It makes sense because the single quote itself is
>> the only character which needs to be escaped inside a single quoted string,
>> and it's unambiguous because two quoted strings after each other without
>> anything between is a syntax error in YAML.
>>
>> Den tors 16 maj 2019 10:55jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>>
>>>
>>> Thanks.
>>>
>>> The `double single-quote` stuff is consistent to
>>> https://github.com/dotmaster/toYaml/issues/1
>>>
>>> But it is a little complicated.
>>>
>>> BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>>
>>> > I usually use a code span or code block in the metadata when I want it
>>> to stringify verbatim with ASCII quotes, dollars, square brackets etc.
>>> > preserved. The stringification function should turn this into a plain
>>> string without any change to the Lua code. Note however that since the
>>> backtick is a
>>> > reserved character in YAML you must enclose the code span in a single
>>> quoted string and double any single quotes inside the string:
>>> >
>>> > ````pandoc-markdown
>>> > ---
>>> > test: '`Children''s cognitive ability`'
>>> > block: |
>>> > ```
>>> > Children's cognitive ability.
>>> > Several.
>>> > Lines.
>>> > Of.
>>> > Text.
>>> > ```
>>> > ---
>>> > ````
>>> >
>>> > thus in your particular example the backslash escape may be
>>> preferable, but I definitely prefer the code span/block solution when there
>>> are many
>>> > sensitive characters in the string. A lot of backslash escapes affect
>>> readability negatively, especially when you need to escape backslashes
>>> > themselves. For some reason I find `` '`don''t`' `` more readable than
>>> `` don\'t ``, but YMMV.
>>> >
>>> > Den tors 16 maj 2019 09:41jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>>> >
>>> > I checked the manual, `smart` has effect on quotes and dashes.
>>> > Instead of disabling smart, I have to escape it to minimize the
>>> effect.
>>> >
>>> > BTW, if it is for the title value
>>> > ```
>>> > ---
>>> > title: Children's Cognitive Ability
>>> > ---
>>> > ```
>>> >
>>> > I get the expected result withouth escaping the quote or disabling
>>> smart:
>>> >
>>> > ```
>>> > \title{Children's Cognitive Ability}
>>> > ```
>>> >
>>> > Pandoc deals with it differently from a lua filter?
>>> >
>>> > John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>>> >
>>> > > YAML metadata fields are interpreted as markdown.
>>> > >
>>> > > You can escape it to prevent "smartification":
>>> > >
>>> > > Children\'s Cognitive Ability
>>> > >
>>> > > Or disable smartification globally by using `-f
>>> > > markdown-smart` on the command line.
>>> > >
>>> > > jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>>> > >
>>> > >> I have some meta value like
>>> > >> ```
>>> > >> ---
>>> > >> test: Children's Cognitive Ability
>>> > >> ---
>>> > >> ```
>>> > >>
>>> > >> In my lua filter:
>>> > >> ```
>>> > >> function Meta(meta)
>>> > >> for k, v in pairs(meta) do
>>> > >> if k=='test' then
>>> > >> print(pandoc.utils.stringify(v))
>>> > >> end
>>> > >> end
>>> > >> end
>>> > >> ```
>>> > >>
>>> > >> I find it prints
>>> > >> ```
>>> > >> Children’s Cognitive Ability
>>> > >> ```
>>> > >>
>>> > >> I want to keep the single quote as it is. What should I do?
>>> > >>
>>> > >> --
>>> > >> 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/m2mujn7txr.fsf%40163.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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> > To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/pandoc-discuss/m2ftpe7sos.fsf%40163.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-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/m27eaq7pgx.fsf%40163.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-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/CADAJKhAM%2BC4YUfU7YeX6ReJGTZEdGC17pX9Q-xDJQO4z-L9cSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #2: Type: text/html, Size: 10561 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
[not found] ` <m2bm027po2.fsf-9Onoh4P/yGk@public.gmane.org>
@ 2019-05-16 21:45 ` John MacFarlane
2019-05-17 4:16 ` jiewuza
0 siblings, 1 reply; 13+ messages in thread
From: John MacFarlane @ 2019-05-16 21:45 UTC (permalink / raw)
To: jiewuza, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
No, it's not inconsistent.
Pandoc first uses YAML escaping rules to get a string.
Then, it parses the string as markdown. It's in this
second phase that the \' has an effect.
jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> I also find this: https://github.com/dotmaster/toYaml/issues/1
>
> something inconsistent in pandoc YAML and YAML itself.
>
> John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>
>> YAML metadata fields are interpreted as markdown.
>>
>> You can escape it to prevent "smartification":
>>
>> Children\'s Cognitive Ability
>>
>> Or disable smartification globally by using `-f
>> markdown-smart` on the command line.
>>
>> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>>
>>> I have some meta value like
>>> ```
>>> ---
>>> test: Children's Cognitive Ability
>>> ---
>>> ```
>>>
>>> In my lua filter:
>>> ```
>>> function Meta(meta)
>>> for k, v in pairs(meta) do
>>> if k=='test' then
>>> print(pandoc.utils.stringify(v))
>>> end
>>> end
>>> end
>>> ```
>>>
>>> I find it prints
>>> ```
>>> Children’s Cognitive Ability
>>> ```
>>>
>>> I want to keep the single quote as it is. What should I do?
>>>
>>> --
>>> 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/m2mujn7txr.fsf%40163.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-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/m2bm027po2.fsf%40163.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-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/yh480ky336gjjz.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
2019-05-16 21:45 ` John MacFarlane
@ 2019-05-17 4:16 ` jiewuza
[not found] ` <m236ld7m1o.fsf-9Onoh4P/yGk@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: jiewuza @ 2019-05-17 4:16 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
OK, I see.
So everything in YAML is read as markdown.
I find there is a pandoc.read() at https://pandoc.org/lua-filters.html
Can I use it to convert markdown to text?
John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
> No, it's not inconsistent.
>
> Pandoc first uses YAML escaping rules to get a string.
> Then, it parses the string as markdown. It's in this
> second phase that the \' has an effect.
>
> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>
>> I also find this: https://github.com/dotmaster/toYaml/issues/1
>>
>> something inconsistent in pandoc YAML and YAML itself.
>>
>> John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>>
>>> YAML metadata fields are interpreted as markdown.
>>>
>>> You can escape it to prevent "smartification":
>>>
>>> Children\'s Cognitive Ability
>>>
>>> Or disable smartification globally by using `-f
>>> markdown-smart` on the command line.
>>>
>>> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>>>
>>>> I have some meta value like
>>>> ```
>>>> ---
>>>> test: Children's Cognitive Ability
>>>> ---
>>>> ```
>>>>
>>>> In my lua filter:
>>>> ```
>>>> function Meta(meta)
>>>> for k, v in pairs(meta) do
>>>> if k=='test' then
>>>> print(pandoc.utils.stringify(v))
>>>> end
>>>> end
>>>> end
>>>> ```
>>>>
>>>> I find it prints
>>>> ```
>>>> Children’s Cognitive Ability
>>>> ```
>>>>
>>>> I want to keep the single quote as it is. What should I do?
>>>>
>>>> --
>>>> 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/m2mujn7txr.fsf%40163.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-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/m2bm027po2.fsf%40163.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-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/m236ld7m1o.fsf%40163.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
2019-05-16 17:13 ` BPJ
[not found] ` <CADAJKhDEN9EA8jaBH06=sqtc5Xpu5uZEutkCwpfaSpwQ2KGOWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-05-17 4:17 ` jiewuza
1 sibling, 0 replies; 13+ messages in thread
From: jiewuza @ 2019-05-17 4:17 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
Yes, you are right.
And thank you.
BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> Also you shouldn't rely on random secondary sources.
>
> https://yaml.org/refcard.html
>
> Den tors 16 maj 2019 19:07BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>
> The double single quote is how you escape a single quote inside a single quoted string in YAML. It makes sense because the single quote itself
> is the only character which needs to be escaped inside a single quoted string, and it's unambiguous because two quoted strings after each other
> without anything between is a syntax error in YAML.
>
> Den tors 16 maj 2019 10:55jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>
> Thanks.
>
> The `double single-quote` stuff is consistent to https://github.com/dotmaster/toYaml/issues/1
>
> But it is a little complicated.
>
> BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > I usually use a code span or code block in the metadata when I want it to stringify verbatim with ASCII quotes, dollars, square brackets
> etc.
> > preserved. The stringification function should turn this into a plain string without any change to the Lua code. Note however that since the
> backtick is a
> > reserved character in YAML you must enclose the code span in a single quoted string and double any single quotes inside the string:
> >
> > ````pandoc-markdown
> > ---
> > test: '`Children''s cognitive ability`'
> > block: |
> > ```
> > Children's cognitive ability.
> > Several.
> > Lines.
> > Of.
> > Text.
> > ```
> > ---
> > ````
> >
> > thus in your particular example the backslash escape may be preferable, but I definitely prefer the code span/block solution when there
> are many
> > sensitive characters in the string. A lot of backslash escapes affect readability negatively, especially when you need to escape
> backslashes
> > themselves. For some reason I find `` '`don''t`' `` more readable than `` don\'t ``, but YMMV.
> >
> > Den tors 16 maj 2019 09:41jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
> >
> > I checked the manual, `smart` has effect on quotes and dashes.
> > Instead of disabling smart, I have to escape it to minimize the effect.
> >
> > BTW, if it is for the title value
> > ```
> > ---
> > title: Children's Cognitive Ability
> > ---
> > ```
> >
> > I get the expected result withouth escaping the quote or disabling smart:
> >
> > ```
> > \title{Children's Cognitive Ability}
> > ```
> >
> > Pandoc deals with it differently from a lua filter?
> >
> > John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
> >
> > > YAML metadata fields are interpreted as markdown.
> > >
> > > You can escape it to prevent "smartification":
> > >
> > > Children\'s Cognitive Ability
> > >
> > > Or disable smartification globally by using `-f
> > > markdown-smart` on the command line.
> > >
> > > jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> > >
> > >> I have some meta value like
> > >> ```
> > >> ---
> > >> test: Children's Cognitive Ability
> > >> ---
> > >> ```
> > >>
> > >> In my lua filter:
> > >> ```
> > >> function Meta(meta)
> > >> for k, v in pairs(meta) do
> > >> if k=='test' then
> > >> print(pandoc.utils.stringify(v))
> > >> end
> > >> end
> > >> end
> > >> ```
> > >>
> > >> I find it prints
> > >> ```
> > >> Children’s Cognitive Ability
> > >> ```
> > >>
> > >> I want to keep the single quote as it is. What should I do?
> > >>
> > >> --
> > >> 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@googlegroups.com.
> > >> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2mujn7txr.fsf%40163.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-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/m2ftpe7sos.fsf%40163.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-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/m27eaq7pgx.fsf%40163.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-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/m2y33567fm.fsf%40163.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ' in meta value is converted into ’ in a lua filter
[not found] ` <m236ld7m1o.fsf-9Onoh4P/yGk@public.gmane.org>
@ 2019-05-17 5:09 ` John MacFarlane
0 siblings, 0 replies; 13+ messages in thread
From: John MacFarlane @ 2019-05-17 5:09 UTC (permalink / raw)
To: jiewuza, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> OK, I see.
>
> So everything in YAML is read as markdown.
>
> I find there is a pandoc.read() at https://pandoc.org/lua-filters.html
>
> Can I use it to convert markdown to text?
pandoc.read will convert markdown text to a pandoc
document. you can then use pandoc.utils.stringify to
convert this document to plain text, if that's what
you're looking for.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-05-17 5:09 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15 13:01 ' in meta value is converted into ’ in a lua filter jiewuza
[not found] ` <m2mujn7txr.fsf-9Onoh4P/yGk@public.gmane.org>
2019-05-15 16:21 ` John MacFarlane
2019-05-16 7:40 ` jiewuza
[not found] ` <m2ftpe7sos.fsf-9Onoh4P/yGk@public.gmane.org>
2019-05-16 7:55 ` BPJ
2019-05-16 8:50 ` jiewuza
[not found] ` <m27eaq7pgx.fsf-9Onoh4P/yGk@public.gmane.org>
2019-05-16 17:07 ` BPJ
2019-05-16 17:13 ` BPJ
[not found] ` <CADAJKhDEN9EA8jaBH06=sqtc5Xpu5uZEutkCwpfaSpwQ2KGOWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-16 17:31 ` BPJ
2019-05-17 4:17 ` jiewuza
2019-05-16 8:46 ` jiewuza
[not found] ` <m2bm027po2.fsf-9Onoh4P/yGk@public.gmane.org>
2019-05-16 21:45 ` John MacFarlane
2019-05-17 4:16 ` jiewuza
[not found] ` <m236ld7m1o.fsf-9Onoh4P/yGk@public.gmane.org>
2019-05-17 5:09 ` 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).