From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/23393 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Can't access keys containing spaces in pandoc Date: Fri, 6 Sep 2019 22:31:08 +0200 Message-ID: References: <92055fd0-049b-4943-a51a-2eb0905b59ca@googlegroups.com> <5E6256F2-6354-43F9-9A49-2328471A9D2B@gmail.com> <68fbd484-0729-4ee2-a7a2-0846cd0bbd28@googlegroups.com> <7c15c170-1b08-4274-b24e-280b4585c0c6@googlegroups.com> <35a9acd1-dff5-4529-9abb-d8f9fc87bce4@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000314c5e0591e8520e" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="255742"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBGUEZPVQKGQEIJFFYMQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Sep 06 22:31:25 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-pg1-f191.google.com ([209.85.215.191]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1i6KtA-0014Lz-TN for gtp-pandoc-discuss@m.gmane.org; Fri, 06 Sep 2019 22:31:25 +0200 Original-Received: by mail-pg1-f191.google.com with SMTP id i12sf4019262pgm.12 for ; Fri, 06 Sep 2019 13:31:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1567801882; cv=pass; d=google.com; s=arc-20160816; b=uMfMouj8Ea/1hLxHL4/NG0eEoS7/PBaTrvK6obtXPUlUIuW/N5shT4aTQTRqOZPck0 qPjmAbz+T/4GA0A76zU45WDKYO8lLCnpSQOYXNF9NUapaqda6bRPS5YIRAEznN+FhKTN yIXEEwPP3Dt0LfpY5RMcIqC8h1OnWwPuxBWTHNaHE/traZJ7A92kwAYjkk1crYmUtjux 4Z+nTzQJ2b7lcga8xFK1cUPxhpSmita4jVPdrjPgQtcXQnD0ggq+gIA/eRgoKWlKQBKM zHW1icKFG6XWzXyMoDtWpPWxqCV2nhHHUTvklzt1lJD3gZwYIR5pIGKuilKwIhtOdJGa mHLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date :from:in-reply-to:references:mime-version:sender:dkim-signature :dkim-signature; bh=Jup/HYfTllFm4+8hNLRNRraaKYEH+Z+eq8Wi+9K1ois=; b=wgf9SkTWmxkzI/q2jSUARBWbIRrx7WYtI1BzxF93ANs988+gnhSY1y62nJ5xTy3zX8 QYEGB5CrCDxAT1KvSgt0HEKrEmzwNNYsCm6TU28PyqlgWBCbriBAOok+2z0YfAcqm/F6 Ua3vX6vXl1V+4cgKPARDRHd5rX8HCYKcca7Jw0m9KeBHqzV/yfmDyIyaiiFlh7lWKHFx JdkeTRoaf3HGSO+3Mr3PKm6OFxVqpxt+tUqY9zuvWLwAnfcwG7lqQkfRBGrzyx4QfCn8 Tdc1s+1icbtkiOfcFdX7LqpHLLAJ71uMb4Dapv6eYZTnG7SRCoe/Um6rndwH7niuv4pU Hqpg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oazBBGFA; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::233 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:references:in-reply-to:from:date:message-id :subject:to:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=Jup/HYfTllFm4+8hNLRNRraaKYEH+Z+eq8Wi+9K1ois=; b=HAvRJviFm5HzMA8/Qk1vHaWzxfS3Mj3oMc5p8457EymnMlY765TxK0UEADehPzS9Gp Q4ydO1i+T9SxFau5SY4TSBVk/5flo87GX4gJY7035iNzsiGRIlFdRGXTeN/oDUAnSsF9 QqMl99o3ZTA3ZDEB1yAVwA66cuCRv3/L0F6ht/qEDwOIfvuqoqqnLCr5o4+NtN1ONy+M GXuFjM7IAeyvBAelQ3pt1FTe8HfvUrlI7kFzBCKA40qscscUGGWu6ul+ELPgHukVdg2S or+48lriXCDC5f0zR2Eull7TW0lZGWNLkwF84D0m9BJZxGJDTXfCmdHjqayAp1yBft7k 5frQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Jup/HYfTllFm4+8hNLRNRraaKYEH+Z+eq8Wi+9K1ois=; b=t+PJhJFReboxLPRVaSJc3xN/1TnCAPhueTcMJ1+3gz+FE/7Bi45oAieONE2xSZmwdg ElwgxoME0L40PmUGM+8xbLK4OtdligjqCSBManfSjgvY1xZUUdz/3DkbaPy2ohvkBJ9+ vGw7AmOrsp2ba7UukJcW1ZsK2UkASmh6udf9cNfA4DgU1LPcMEFKBVw3rXNNi57EwNic kbaQHNkvcsWOBZk6+kqvcnv70pa9yd6U8ZepC71HOaCOkcAWVi62KqRVUt0/aRwwQuE2 pIc7g42Zdb6tYD6oGDag+LVJoiE0LrYwoZK/nl1MMgjsQ2nKG4NaXMBIDlRoNGFFzzCO lalQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:references:in-reply-to:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Jup/HYfTllFm4+8hNLRNRraaKYEH+Z+eq8Wi+9K1ois=; b=Z+gA0XbqyK0ZMnqfGHkU2OsST7umqQx/mkNMA8XgCaKXtwkJQmPCNSHi1S6udZuBdN Tp8tmhfXAL9OW3DjaNJuK/C8bC+x1jK7fjhlCCMonyhaFnyQGCIlOIC+CjZ8f41ZpFhs Nws7XIFlvu5JHA0VMOWqxHoKA2TxoD0+0wx62ujNDNopeYQiFIWe6HLsogz5zsclDv0e P0oUiRunCxV6hYFgiaAX2DFrqambhIhTXVsAQUzjjFQ9/XbsD6a/QMt3iXBm8U54pMGK C1OSiIIOq83GgN4VDm55CVanfuptwG423ARYdPanhOohT68OYvTiQSW93ttLqQgc6Pxk hBxQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAWQvcRL9jp5GwqTWMZdVF1JBSm0FdoF28K5cd3gPlu14x0c9Ofs 5tTb85MxG1tdURfP+srgExs= X-Google-Smtp-Source: APXvYqzsHZ/1PzuSkiqL8ywkXtlpu4570MeKDaJ32OCrCO9iR9U69QeE6TgBVgyDWO7w4Mt0fCtE8Q== X-Received: by 2002:a17:90a:fc8d:: with SMTP id ci13mr11483043pjb.32.1567801882755; Fri, 06 Sep 2019 13:31:22 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a63:fc15:: with SMTP id j21ls1353781pgi.9.gmail; Fri, 06 Sep 2019 13:31:22 -0700 (PDT) X-Received: by 2002:a65:680b:: with SMTP id l11mr9636398pgt.35.1567801881909; Fri, 06 Sep 2019 13:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567801881; cv=none; d=google.com; s=arc-20160816; b=Ai29h5+P/3mtp+GKsL7QFeBqrQQ5j/OUvVgjdlwB68e0HlyQ7O8zvpJIKa49IPlCUG OzdIKda5SwHwSH/qBoIHvwWWiw0uFVfIVLiCUnAp9ySkJ0Gy1mQVHs9195NPBe0s7njc iR4ErCLueb1NagZDr6JhNoIdZo74F+EEDaTC0X72Y88QNt3xcoTNvLmk4xb4eW9MbJFB z2hMx1BPQXGDwFqEHOnDAqOYkl3StD1lbMHOcTaYw20nQLU/1kMhk9XfCgN4JUJBhigU 3Ce7gvC7DtMQ/kPobwAlF3eOsBmHQk1k808UUNkLXNZIn7VMCNEj4J+w3xlqBpJQsY+C ThwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=hdC2OX0QSnIR6JzhNKcbDdIqEiDNeusiM51VvocLW/4=; b=ZQ/LDqbgwWMsn9B0eTGZrSd+27E8JMSGPy5J67jBntRryiL5c/Klp/YVOqSY5hRjse HDT8/pg88xhB+G1cBcOIBViIF5F8xj/g372hJvypq40bC3YGDBfFHwb+NUVc51QaKKXB kq93QlD9uHc18sPKAQO/EVK1J7Jlf5bd9u6rsVWJNB6GVC6lSPcjPwBp0vrh0OwLN4ki 3kbt6Yq873gDQeo17jg4a+9HStYhd7MmirW0yGF3Ojy9akixWBr4G8wGMYFWFPAmeRfD oSp+X1Li6QktNbIU/J78c3MuqHraxgF0Yzvd5L6DOTVuLmupQ2FNcVUhJLJIxs/DBV0w AyVQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oazBBGFA; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::233 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com. [2607:f8b0:4864:20::233]) by gmr-mx.google.com with ESMTPS id x2si601835pfq.3.2019.09.06.13.31.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Sep 2019 13:31:21 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::233 as permitted sender) client-ip=2607:f8b0:4864:20::233; Original-Received: by mail-oi1-x233.google.com with SMTP id t84so6087210oih.10 for ; Fri, 06 Sep 2019 13:31:21 -0700 (PDT) X-Received: by 2002:aca:f057:: with SMTP id o84mr8708405oih.71.1567801880954; Fri, 06 Sep 2019 13:31:20 -0700 (PDT) In-Reply-To: <35a9acd1-dff5-4529-9abb-d8f9fc87bce4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oazBBGFA; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::233 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:23393 Archived-At: --000000000000314c5e0591e8520e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable If the rule is maximally simple, along the lines of `s/[^-A-Za-z0-9]+/_/g`, perhaps followed by `s/^_+|_+$//g` I think conversion between key text and variable name would be easily grasped by anyone. In practice Unicode support would be desirable =E2=80=94 even in Icelandic it's moderatly easy = to come up with a whole phrase which contains only one or two ASCII letters =E2=80= =94 and combining marks are essential in some languages, so it's probably safer to replace all sequences of space and ASCII punctuation with underscores or hyphens: `s/[\s\pZ\p{PosixPunct}]+/-/g` =E2=80=94 I can easily provide a li= st of the Unicode code points which match that regex =E2=80=94 to get results whi= ch are intelligible practically always irrespective of language. It's hardly reasonable to expect that you will get distinct identifiers from `1 (a)` and `1 [a]`. Den ons 4 sep. 2019 10:40Frederik Hartmann skrev: > I think that at the end of the day, everything might depend on how the > current internal implementation of the template engine is. > From an end user perspective > > > $this.is.a.stupid."name with $, . and spaces"$ might actually be great > and more generic than simply replacing spaces with _. > I think allowing spaces or special characters without quoting them might > be unwise and this would bring us extremely close to allowing everything > yaml supports. > > > Am Mittwoch, 4. September 2019 07:34:20 UTC+2 schrieb jiewuza: >> >> >> This issue came up from yaml, so first of all I would like to make sure: >> >> Are we going to just support spaces or all the valid yaml thing >> (https://yaml.org/spec/1.2/spec.html#id2770814) >> >> >> And from the user's point of view, I prefer the former. Because the >> naming is consistent, and it is easier for users to customize templates >> without bearing any rules in mind. >> >> >> John MacFarlane writes: >> >> > It's something we could think about. >> > >> > There are two possible approaches here. >> > >> > 1. Modify doctemplates (our templating engine) to allow spaces in >> > variables. This would mean allowing things like >> > >> > $this is a long variable name$ >> > >> > in a template. I think this kind of thing makes it less clear >> > where the variables are, but it shouldn't pose any problem in >> principle. >> > >> > 2. Modify pandoc so that, when metadata is used to populate >> > template variables, spaces are automatically replaced by >> > underscores. In this case you'd use >> > >> > $this_is_a_long_variable_name$ >> > >> > in your template. >> > >> > Comments (from anyone) are welcome. >> > >> > Frederik Hartmann writes: >> > >> >> That's really not the answer I'd have hoped to hear... >> >> >> >> Do you know if a PR fixing this might be getting accepted? >> >> It's really limiting when perfectly valid yaml can't be used as >> template >> >> input. >> >> >> >> Thanks a lot though. >> >> -- > 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/35a9acd1-dff5-4529-9abb-= d8f9fc87bce4%40googlegroups.com > > . > --=20 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 e= mail 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/CADAJKhABoO0-K25joAELumEzTOQe4ukkCDemFfONgWN%2B-dLBSA%40mail= .gmail.com. --000000000000314c5e0591e8520e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
If the rule is maximally simple, along the lines of `s/[^= -A-Za-z0-9]+/_/g`, perhaps followed by `s/^_+|_+$//g` I think conversion be= tween key text and variable name would be easily grasped by anyone. In prac= tice Unicode support would be desirable =E2=80=94 even in Icelandic it'= s moderatly easy to come up with a whole phrase which contains only one or = two ASCII letters =E2=80=94 and combining marks are essential in some langu= ages, so it's probably safer to replace all sequences of space and ASCI= I punctuation with underscores or hyphens: `s/[\s\pZ\p{PosixPunct}]+/-/g` = =E2=80=94 I can easily provide a list of the Unicode code points which matc= h that regex =E2=80=94 to get results which are intelligible practically al= ways irrespective of language. It's hardly reasonable to expect that yo= u will get distinct identifiers from `1 (a)` and `1 [a]`.
=

Den ons 4 sep. 2019 10:40Frederik Hartmann <hecknar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
I think that at the end of the day, every= thing might depend on how the current internal implementation of the templa= te engine is.
From an end user perspective

$this.is.a.stupid."name with $, .=C2=A0 and spaces"$ = might actually be great and more generic than simply replacing spaces with = _.
I think allowing spaces or special characters without quoting = them might be unwise and this would bring us extremely close to allowing ev= erything yaml supports.


Am Mittwoch, 4. September 2019 07= :34:20 UTC+2 schrieb jiewuza:

This issue came up from yaml, so first of all I would like to make sure= :

Are we going to just support spaces or all the valid yaml thing
(https://yaml.org/spec/1.2/spec.html#id277= 0814)


And from the user's point of view, I prefer the former. Because the
naming is consistent, and it is easier for users to customize templates
without bearing any rules in mind.


John MacFarlane <j...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:

> It's something we could think about.
>
> There are two possible approaches here.
>
> 1. Modify doctemplates (our templating engine) to allow spaces in
> variables.=C2=A0 This would mean allowing things like
>
> $this is a long variable name$
>
> in a template.=C2=A0 I think this kind of thing makes it less clea= r
> where the variables are, but it shouldn't pose any problem in = principle.
>
> 2. Modify pandoc so that, when metadata is used to populate
> template variables, spaces are automatically replaced by
> underscores.=C2=A0 In this case you'd use
>
> $this_is_a_long_variable_name$
>
> in your template.
>
> Comments (from anyone) are welcome.
>
> Frederik Hartmann <
hec...@gmail.= com> writes:
>
>> That's really not the answer I'd have hoped to hear...
>>
>> Do you know if a PR fixing this might be getting accepted?
>> It's really limiting when perfectly valid yaml can't b= e used as template=20
>> input.
>>
>> Thanks a lot though.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.org= m.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/35a9acd1-dff5= -4529-9abb-d8f9fc87bce4%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://group= s.google.com/d/msgid/pandoc-discuss/CADAJKhABoO0-K25joAELumEzTOQe4ukkCDemFf= ONgWN%2B-dLBSA%40mail.gmail.com.
--000000000000314c5e0591e8520e--