public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: ' in meta value is converted into ’ in a lua filter
Date: Thu, 16 May 2019 19:07:43 +0200	[thread overview]
Message-ID: <CADAJKhCQ=hBR7ZJy4tYc8PzgJ72OOYoyDVTmwzPm8huHRXKV=A@mail.gmail.com> (raw)
In-Reply-To: <m27eaq7pgx.fsf-9Onoh4P/yGk@public.gmane.org>

[-- 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 --]

  parent reply	other threads:[~2019-05-16 17:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 13:01 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADAJKhCQ=hBR7ZJy4tYc8PzgJ72OOYoyDVTmwzPm8huHRXKV=A@mail.gmail.com' \
    --to=melroch-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).