* Feature Request: Case sensitive YAML variables @ 2015-11-17 0:53 Dave Jarvis [not found] ` <afb837fa-7623-4574-bfdc-48991f2b2e3f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 2+ messages in thread From: Dave Jarvis @ 2015-11-17 0:53 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 3175 bytes --] Consider: entity: name: singular: bacterium plural: bacteria capname: singular: Bacterium plural: Bacteria The extra level of indirection could be eliminated by supporting case sensitivity: entity: singular: bacterium plural: bacteria Singular: Bacterium Plural: Bacteria The end user would have to enable case-sensitive YAML variables from the command-line, explicitly (to maintain backwards compatibility), such as: pandoc filename.md --template filename.yaml --case-sensitive Using uppercase and lowercase also requires three tiers. The names aren't important; the following are equivalent: entity: lc: singular: bacterium plural: bacteria uc: singular: Bacterium plural: Bacteria entity: singular: lowercase: bacterium uppercase: Bacterium plural: lowercase: bacteria uppercase: Bacteria I'd like to eliminate that extra tier altogether: entity: single: bacterium Single: Bacterium plural: bacteria Plural: Bacteria Variable case sensitivity would be useful for screenplays as well, where the first instance of a character's name is typically all uppercase: name: first: Jean-Luc FIRST: JEAN-LUC Further, several specifications respect case of YAML keys: - YAML and JSON should have interoperability <http://jsontoyaml.com/>, and JSON is case-sensitive - RAML <http://docs.raml.org/specs/1.0/#raml-10-spec-markup-language>, an application of the YAML 1.2 specification, is case-sensitive. - The Ruby YAML parser is case-sensitive, as are several Go YAML parsers. - Swagger <http://swagger.io/specification/> is case-sensitive. - Various tools <https://github.com/dbohdan/remarshal> convert between TOML, YAML, and JSON. There is a large tooling infrastructure that can be leveraged and a world of pipelines that are possible when the option of treating YAML case-sensitively exists. How many people would take advantage of such interoperability within their MD text is unknown, but likely rather small. I read a few times that this extra command-line option would break backwards compatibility. First, I'm not sure how. Second, even if it did, a warning/log message could be given to the end-user (and a suitable error code returned). Third, documentation should explain how the option breaks backwards compatibility. Fourth, it is possible to list keys that should be treated case-insensitively (to maintain backwards compatibility). For example: pandoc filename.md --template filename.yaml --case-sensitive --case-except 'title' Thoughts? -- 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/afb837fa-7623-4574-bfdc-48991f2b2e3f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. [-- Attachment #1.2: Type: text/html, Size: 6805 bytes --] ^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <afb837fa-7623-4574-bfdc-48991f2b2e3f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Feature Request: Case sensitive YAML variables [not found] ` <afb837fa-7623-4574-bfdc-48991f2b2e3f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2015-11-17 2:35 ` John MacFarlane 0 siblings, 0 replies; 2+ messages in thread From: John MacFarlane @ 2015-11-17 2:35 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw Let me clarify a few things (apologies, I didn't have this clearly in view when commenting on the issue in the tracker). The Markdown reader already supports case-sensitive fields in YAML metadata: ``` % pandoc -t native -s --- hi: 11 Hi: 12 ... Pandoc (Meta {unMeta = fromList [("Hi",MetaString "12"),("hi",MetaString "11")]}) [] ``` And the template engine does too! Try this template, test.tpl: ``` $hi$ $Hi$ ``` ``` % pandoc --template test.tpl -s --- hi: 11 Hi: 12 ... ^D 11 12 ``` So now I'm a bit confused about the issue! Everything you're asking for already seems to work in pandoc. If you find otherwise, please give the exact command line and input file to test with. +++ Dave Jarvis [Nov 16 15 16:53 ]: > Consider: >entity: > name: > singular: bacterium > plural: bacteria > capname: > singular: Bacterium > plural: Bacteria > > The extra level of indirection could be eliminated by supporting case > sensitivity: > >entity: > singular: bacterium > plural: bacteria > Singular: Bacterium > Plural: Bacteria > > The end user would have to enable case-sensitive YAML variables from > the command-line, explicitly (to maintain backwards compatibility), > such as: > > pandoc filename.md --template filename.yaml --case-sensitive > > Using uppercase and lowercase also requires three tiers. The names > aren't important; the following are equivalent: > >entity: > lc: > singular: bacterium > plural: bacteria > uc: > singular: Bacterium > plural: Bacteria > >entity: > singular: > lowercase: bacterium > uppercase: Bacterium > plural: > lowercase: bacteria > uppercase: Bacteria > > > I'd like to eliminate that extra tier altogether: > >entity: > single: bacterium > Single: Bacterium > plural: bacteria > Plural: Bacteria > > Variable case sensitivity would be useful for screenplays as well, > where the first instance of a character's name is typically all > uppercase: > >name: > first: Jean-Luc > FIRST: JEAN-LUC > > Further, several specifications respect case of YAML keys: > * YAML and JSON should have [1]interoperability, and JSON is > case-sensitive > * [2]RAML, an application of the YAML 1.2 specification, is > case-sensitive. > * The Ruby YAML parser is case-sensitive, as are several Go YAML > parsers. > * [3]Swagger is case-sensitive. > * Various [4]tools convert between TOML, YAML, and JSON. > > There is a large tooling infrastructure that can be leveraged and a > world of pipelines that are possible when the option of treating YAML > case-sensitively exists. How many people would take advantage of such > interoperability within their MD text is unknown, but likely rather > small. > > I read a few times that this extra command-line option would break > backwards compatibility. First, I'm not sure how. Second, even if it > did, a warning/log message could be given to the end-user (and a > suitable error code returned). Third, documentation should explain how > the option breaks backwards compatibility. Fourth, it is possible to > list keys that should be treated case-insensitively (to maintain > backwards compatibility). > > For example: > >pandoc filename.md --template filename.yaml --case-sensitive --case-except 'titl >e' > > Thoughts? > > -- > 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 [5]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to > [6]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > [7]https://groups.google.com/d/msgid/pandoc-discuss/afb837fa-7623-4574- > bfdc-48991f2b2e3f%40googlegroups.com. > For more options, visit [8]https://groups.google.com/d/optout. > >References > > 1. http://jsontoyaml.com/ > 2. http://docs.raml.org/specs/1.0/#raml-10-spec-markup-language > 3. http://swagger.io/specification/ > 4. https://github.com/dbohdan/remarshal > 5. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 6. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 7. https://groups.google.com/d/msgid/pandoc-discuss/afb837fa-7623-4574-bfdc-48991f2b2e3f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer > 8. https://groups.google.com/d/optout ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-17 2:35 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-11-17 0:53 Feature Request: Case sensitive YAML variables Dave Jarvis [not found] ` <afb837fa-7623-4574-bfdc-48991f2b2e3f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2015-11-17 2:35 ` 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).