* Can't access keys containing spaces in pandoc @ 2019-09-02 9:10 Frederik Hartmann [not found] ` <92055fd0-049b-4943-a51a-2eb0905b59ca-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Frederik Hartmann @ 2019-09-02 9:10 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 1566 bytes --] Hi! We are using rather complicated templates to display certain information about dependencies. These information can be exported in yaml files and looks like the following: --- dependencies: external: hardware: - Description: Text here.... Dependency On: Text here.... Date Required: Text here.... Dependency Owner: Text here.... Color: Text here.... Status: Text here.... Last Updated: Text here.... State: Text here.... ... This is a perfectly valid and well-formed yaml document. Now, the best thing would be if I could simply loop over these attributes without having to specify them directly. The next best thing would be if I could access them via the usual method: $for(dependencies.external.hardware)$ $if(dependencies.external.hardware.Description)$\textbf{Description:} & $dependencies.external.hardware.Description$ \\ $endif$ $endfor$ The issue are with the keys that contain spaces. I can't find a way to access them at all. I tried it the following ways: $if(dependencies.external.hardware.Dependency On)$ $if(dependencies.external.hardware.Dependency\ On)$ Any suggestion? -- 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/92055fd0-049b-4943-a51a-2eb0905b59ca%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 11244 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <92055fd0-049b-4943-a51a-2eb0905b59ca-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Can't access keys containing spaces in pandoc [not found] ` <92055fd0-049b-4943-a51a-2eb0905b59ca-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2019-09-02 9:37 ` James [not found] ` <5E6256F2-6354-43F9-9A49-2328471A9D2B-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: James @ 2019-09-02 9:37 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw [-- Attachment #1: Type: text/plain, Size: 2253 bytes --] Hi Have you tried enclosing the content containing spaces within quotation marks? Sent from my iPhone > On 2 Sep 2019, at 10:10, Frederik Hartmann <hecknar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi! > > We are using rather complicated templates to display certain information about dependencies. > These information can be exported in yaml files and looks like the following: > > --- > dependencies: > external: > hardware: > - Description: Text here.... > Dependency On: Text here.... > Date Required: Text here.... > Dependency Owner: Text here.... > Color: Text here.... > Status: Text here.... > Last Updated: Text here.... > State: Text here.... > ... > > This is a perfectly valid and well-formed yaml document. > > Now, the best thing would be if I could simply loop over these attributes without having to specify them directly. > The next best thing would be if I could access them via the usual method: > > $for(dependencies.external.hardware)$ > $if(dependencies.external.hardware.Description)$\textbf{Description:} & $dependencies.external.hardware.Description$ \\ $endif$ > $endfor$ > > > The issue are with the keys that contain spaces. I can't find a way to access them at all. > > I tried it the following ways: > $if(dependencies.external.hardware.Dependency On)$ > $if(dependencies.external.hardware.Dependency\ On)$ > > Any suggestion? > -- > 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/92055fd0-049b-4943-a51a-2eb0905b59ca%40googlegroups.com. -- 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/5E6256F2-6354-43F9-9A49-2328471A9D2B%40gmail.com. [-- Attachment #2: Type: text/html, Size: 12582 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <5E6256F2-6354-43F9-9A49-2328471A9D2B-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: Can't access keys containing spaces in pandoc [not found] ` <5E6256F2-6354-43F9-9A49-2328471A9D2B-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2019-09-02 10:32 ` Frederik Hartmann [not found] ` <68fbd484-0729-4ee2-a7a2-0846cd0bbd28-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Frederik Hartmann @ 2019-09-02 10:32 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 2832 bytes --] Yes, I tried this as well. $if(dependencies.external.hardware."Dependency On")$\textbf{Dependency:} & $dependencies.external.hardware.dependency$ \\ $endif$ Causes the following error: unexpected "\"" expecting letter In comparison, an unquoted regular blank causes this error: unexpected " " expecting "." or ")$" Am Montag, 2. September 2019 11:37:45 UTC+2 schrieb James: > > Hi > > Have you tried enclosing the content containing spaces within quotation > marks? > > Sent from my iPhone > > On 2 Sep 2019, at 10:10, Frederik Hartmann <hec...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> > wrote: > > Hi! > > We are using rather complicated templates to display certain information > about dependencies. > These information can be exported in yaml files and looks like the > following: > > --- > dependencies: > external: > hardware: > - Description: Text here.... > Dependency On: Text here.... > Date Required: Text here.... > Dependency Owner: Text here.... > Color: Text here.... > Status: Text here.... > Last Updated: Text here.... > State: Text here.... > ... > > This is a perfectly valid and well-formed yaml document. > > Now, the best thing would be if I could simply loop over these attributes > without having to specify them directly. > The next best thing would be if I could access them via the usual method: > > $for(dependencies.external.hardware)$ > $if(dependencies.external.hardware.Description)$\textbf{Description:} & > $dependencies.external.hardware.Description$ \\ $endif$ > $endfor$ > > > The issue are with the keys that contain spaces. I can't find a way to > access them at all. > > I tried it the following ways: > $if(dependencies.external.hardware.Dependency On)$ > $if(dependencies.external.hardware.Dependency\ On)$ > > Any suggestion? > > -- > 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/92055fd0-049b-4943-a51a-2eb0905b59ca%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/92055fd0-049b-4943-a51a-2eb0905b59ca%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- 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/68fbd484-0729-4ee2-a7a2-0846cd0bbd28%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 10430 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <68fbd484-0729-4ee2-a7a2-0846cd0bbd28-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Can't access keys containing spaces in pandoc [not found] ` <68fbd484-0729-4ee2-a7a2-0846cd0bbd28-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2019-09-02 17:28 ` John MacFarlane [not found] ` <m2tv9uboau.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: John MacFarlane @ 2019-09-02 17:28 UTC (permalink / raw) To: Frederik Hartmann, pandoc-discuss In pandoc's templating system: Variable names must begin with a letter and can contain letters, numbers, _, -, and .. No spaces. One approach would be to use a lua filter to dynamically rename the metadata fields, converting spaces to _. You could then use _ in the template. Frederik Hartmann <hecknar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > Yes, I tried this as well. > > $if(dependencies.external.hardware."Dependency On")$\textbf{Dependency:} & > $dependencies.external.hardware.dependency$ \\ $endif$ > > Causes the following error: > > unexpected "\"" > expecting letter > > In comparison, an unquoted regular blank causes this error: > > unexpected " " > expecting "." or ")$" > > > > > > Am Montag, 2. September 2019 11:37:45 UTC+2 schrieb James: >> >> Hi >> >> Have you tried enclosing the content containing spaces within quotation >> marks? >> >> Sent from my iPhone >> >> On 2 Sep 2019, at 10:10, Frederik Hartmann <hec...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> >> wrote: >> >> Hi! >> >> We are using rather complicated templates to display certain information >> about dependencies. >> These information can be exported in yaml files and looks like the >> following: >> >> --- >> dependencies: >> external: >> hardware: >> - Description: Text here.... >> Dependency On: Text here.... >> Date Required: Text here.... >> Dependency Owner: Text here.... >> Color: Text here.... >> Status: Text here.... >> Last Updated: Text here.... >> State: Text here.... >> ... >> >> This is a perfectly valid and well-formed yaml document. >> >> Now, the best thing would be if I could simply loop over these attributes >> without having to specify them directly. >> The next best thing would be if I could access them via the usual method: >> >> $for(dependencies.external.hardware)$ >> $if(dependencies.external.hardware.Description)$\textbf{Description:} & >> $dependencies.external.hardware.Description$ \\ $endif$ >> $endfor$ >> >> >> The issue are with the keys that contain spaces. I can't find a way to >> access them at all. >> >> I tried it the following ways: >> $if(dependencies.external.hardware.Dependency On)$ >> $if(dependencies.external.hardware.Dependency\ On)$ >> >> Any suggestion? >> >> -- >> 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/92055fd0-049b-4943-a51a-2eb0905b59ca%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/92055fd0-049b-4943-a51a-2eb0905b59ca%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> > > -- > 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/68fbd484-0729-4ee2-a7a2-0846cd0bbd28%40googlegroups.com. ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <m2tv9uboau.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>]
* Re: Can't access keys containing spaces in pandoc [not found] ` <m2tv9uboau.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> @ 2019-09-02 20:19 ` Frederik Hartmann [not found] ` <7c15c170-1b08-4274-b24e-280b4585c0c6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Frederik Hartmann @ 2019-09-02 20:19 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 4322 bytes --] 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. Am Montag, 2. September 2019 19:28:41 UTC+2 schrieb John MacFarlane: > > > In pandoc's templating system: > > Variable names must begin with a letter and can contain letters, > numbers, _, -, and .. > > No spaces. > > One approach would be to use a lua filter to dynamically rename > the metadata fields, converting spaces to _. > You could then use _ in the template. > > > Frederik Hartmann <hec...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> writes: > > > Yes, I tried this as well. > > > > $if(dependencies.external.hardware."Dependency On")$\textbf{Dependency:} > & > > $dependencies.external.hardware.dependency$ \\ $endif$ > > > > Causes the following error: > > > > unexpected "\"" > > expecting letter > > > > In comparison, an unquoted regular blank causes this error: > > > > unexpected " " > > expecting "." or ")$" > > > > > > > > > > > > Am Montag, 2. September 2019 11:37:45 UTC+2 schrieb James: > >> > >> Hi > >> > >> Have you tried enclosing the content containing spaces within quotation > >> marks? > >> > >> Sent from my iPhone > >> > >> On 2 Sep 2019, at 10:10, Frederik Hartmann <hec...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > <javascript:>> > >> wrote: > >> > >> Hi! > >> > >> We are using rather complicated templates to display certain > information > >> about dependencies. > >> These information can be exported in yaml files and looks like the > >> following: > >> > >> --- > >> dependencies: > >> external: > >> hardware: > >> - Description: Text here.... > >> Dependency On: Text here.... > >> Date Required: Text here.... > >> Dependency Owner: Text here.... > >> Color: Text here.... > >> Status: Text here.... > >> Last Updated: Text here.... > >> State: Text here.... > >> ... > >> > >> This is a perfectly valid and well-formed yaml document. > >> > >> Now, the best thing would be if I could simply loop over these > attributes > >> without having to specify them directly. > >> The next best thing would be if I could access them via the usual > method: > >> > >> $for(dependencies.external.hardware)$ > >> $if(dependencies.external.hardware.Description)$\textbf{Description:} & > >> $dependencies.external.hardware.Description$ \\ $endif$ > >> $endfor$ > >> > >> > >> The issue are with the keys that contain spaces. I can't find a way to > >> access them at all. > >> > >> I tried it the following ways: > >> $if(dependencies.external.hardware.Dependency On)$ > >> $if(dependencies.external.hardware.Dependency\ On)$ > >> > >> Any suggestion? > >> > >> -- > >> 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > >> To view this discussion on the web visit > >> > https://groups.google.com/d/msgid/pandoc-discuss/92055fd0-049b-4943-a51a-2eb0905b59ca%40googlegroups.com > >> < > https://groups.google.com/d/msgid/pandoc-discuss/92055fd0-049b-4943-a51a-2eb0905b59ca%40googlegroups.com?utm_medium=email&utm_source=footer> > > >> . > >> > >> > > > > -- > > 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/68fbd484-0729-4ee2-a7a2-0846cd0bbd28%40googlegroups.com. > > -- 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/7c15c170-1b08-4274-b24e-280b4585c0c6%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 7547 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <7c15c170-1b08-4274-b24e-280b4585c0c6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Can't access keys containing spaces in pandoc [not found] ` <7c15c170-1b08-4274-b24e-280b4585c0c6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2019-09-03 16:25 ` John MacFarlane [not found] ` <yh480k8sr5z6r1.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> 2019-09-04 5:33 ` jiewuza 0 siblings, 2 replies; 11+ messages in thread From: John MacFarlane @ 2019-09-03 16:25 UTC (permalink / raw) To: Frederik Hartmann, pandoc-discuss 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 <hecknar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <yh480k8sr5z6r1.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>]
* Re: Can't access keys containing spaces in pandoc [not found] ` <yh480k8sr5z6r1.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> @ 2019-09-03 16:35 ` Daniel Staal [not found] ` <330c5975-5678-26fa-e517-2a9ca612a383-Jdbf3xiKgS8@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Daniel Staal @ 2019-09-03 16:35 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw On 9/3/19 12:25 PM, John MacFarlane wrote: > 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. I'd *strongly* prefer the latter. I can't think of any programming or templating language that allows spaces in names - and it's pretty rare in human names as well. (It's used in 'long-form' names, but very rare in commonly used names.) Daniel T. Staal -- --------------------------------------------------------------- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. --------------------------------------------------------------- ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <330c5975-5678-26fa-e517-2a9ca612a383-Jdbf3xiKgS8@public.gmane.org>]
* Re: Can't access keys containing spaces in pandoc [not found] ` <330c5975-5678-26fa-e517-2a9ca612a383-Jdbf3xiKgS8@public.gmane.org> @ 2019-09-03 17:20 ` Benct Philip Jonsson 0 siblings, 0 replies; 11+ messages in thread From: Benct Philip Jonsson @ 2019-09-03 17:20 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw On 2019-09-03 18:35, Daniel Staal wrote: > On 9/3/19 12:25 PM, John MacFarlane wrote: >> 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. > > I'd *strongly* prefer the latter. So would I. Replacing all sequences of non-(ASCII)alphanumerics with an underscore is the usual way to convert arbitrary strings to identifiers, after all. > -- 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/33895bfe-75ea-cbe3-d484-530ef2ee8314%40gmail.com. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Can't access keys containing spaces in pandoc 2019-09-03 16:25 ` John MacFarlane [not found] ` <yh480k8sr5z6r1.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> @ 2019-09-04 5:33 ` jiewuza [not found] ` <m2o900wrpc.fsf-9Onoh4P/yGk@public.gmane.org> 1 sibling, 1 reply; 11+ messages in thread From: jiewuza @ 2019-09-04 5:33 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw 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 <jgm-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. 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 <hecknar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <m2o900wrpc.fsf-9Onoh4P/yGk@public.gmane.org>]
* Re: Can't access keys containing spaces in pandoc [not found] ` <m2o900wrpc.fsf-9Onoh4P/yGk@public.gmane.org> @ 2019-09-04 8:39 ` Frederik Hartmann [not found] ` <35a9acd1-dff5-4529-9abb-d8f9fc87bce4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Frederik Hartmann @ 2019-09-04 8:39 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 2480 bytes --] 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 <j...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org <javascript:>> 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 <hec...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> 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. [-- Attachment #1.2: Type: text/html, Size: 4154 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <35a9acd1-dff5-4529-9abb-d8f9fc87bce4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Can't access keys containing spaces in pandoc [not found] ` <35a9acd1-dff5-4529-9abb-d8f9fc87bce4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2019-09-06 20:31 ` BPJ 0 siblings, 0 replies; 11+ messages in thread From: BPJ @ 2019-09-06 20:31 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw [-- Attachment #1: Type: text/plain, Size: 4091 bytes --] 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 — even in Icelandic it's moderatly easy to come up with a whole phrase which contains only one or two ASCII letters — 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` — I can easily provide a list of the Unicode code points which match that regex — to get results which 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 <hecknar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 <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. 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 <hec...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 > <https://groups.google.com/d/msgid/pandoc-discuss/35a9acd1-dff5-4529-9abb-d8f9fc87bce4%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CADAJKhABoO0-K25joAELumEzTOQe4ukkCDemFfONgWN%2B-dLBSA%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 5406 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-09-06 20:31 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-09-02 9:10 Can't access keys containing spaces in pandoc Frederik Hartmann [not found] ` <92055fd0-049b-4943-a51a-2eb0905b59ca-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2019-09-02 9:37 ` James [not found] ` <5E6256F2-6354-43F9-9A49-2328471A9D2B-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2019-09-02 10:32 ` Frederik Hartmann [not found] ` <68fbd484-0729-4ee2-a7a2-0846cd0bbd28-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2019-09-02 17:28 ` John MacFarlane [not found] ` <m2tv9uboau.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> 2019-09-02 20:19 ` Frederik Hartmann [not found] ` <7c15c170-1b08-4274-b24e-280b4585c0c6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2019-09-03 16:25 ` John MacFarlane [not found] ` <yh480k8sr5z6r1.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> 2019-09-03 16:35 ` Daniel Staal [not found] ` <330c5975-5678-26fa-e517-2a9ca612a383-Jdbf3xiKgS8@public.gmane.org> 2019-09-03 17:20 ` Benct Philip Jonsson 2019-09-04 5:33 ` jiewuza [not found] ` <m2o900wrpc.fsf-9Onoh4P/yGk@public.gmane.org> 2019-09-04 8:39 ` Frederik Hartmann [not found] ` <35a9acd1-dff5-4529-9abb-d8f9fc87bce4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2019-09-06 20:31 ` BPJ
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).