* Splitting YAML header values into sub values based on a seperator value @ 2022-06-19 8:21 Abhishek Ulayil [not found] ` <a7183c8f-540b-4a9d-bb0a-79872f6f576an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Abhishek Ulayil @ 2022-06-19 8:21 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 1225 bytes --] I am writing a custom template for converting markdown into R-markdown so I can reorder the metadata as per the template. But certain YAML header variables contain more information and I would like to split it into individual values to place it in different locations. For example in a markdown file: --- address: - | person-1-name\ some university\ address\ - | person-2-name\ some university\ address\ author: - person-1-name and person-2-name title: "sample title" --- body of the markdown file. here I would like to break the individual address YAML value accessible in my template as $address$ into more atomic information bits like $address.name$,$address.university$ and $address.postal-address$ Is there any way I can break the template variables in the above manner programatically.. -- 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/a7183c8f-540b-4a9d-bb0a-79872f6f576an%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 2442 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <a7183c8f-540b-4a9d-bb0a-79872f6f576an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Splitting YAML header values into sub values based on a seperator value [not found] ` <a7183c8f-540b-4a9d-bb0a-79872f6f576an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-06-21 8:45 ` William Lupton [not found] ` <CAEe_xxhXrDZbO4T6eoMY9EqD-4mtRCCoZZs7Zvuf-GHrbWm=bA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: William Lupton @ 2022-06-21 8:45 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 2877 bytes --] If you have the freedom to define structured variables in your markdown file, then you can use a custom template to output them as desired. For example, with this in your metadata: address: - name: person-1-name university: some university postal-address: address - name: person-2-name university: some university postal-address: address and this in your template: Address: $for(address)$ - name: $address.name$, university: $address.university$, postal-address: $address.postal-address$ $endfor$ you get this: Address: - name: person-1-name, university: some university, postal-address: address - name: person-2-name, university: some university, postal-address: address See https://pandoc.org/MANUAL.html#template-syntax for details. If you have to use the existing metadata definitions then I think you'll have to parse the metadata values in a lua filter. HTH, William On Sun, 19 Jun 2022 at 09:21, Abhishek Ulayil <abhiman2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > I am writing a custom template for converting markdown into R-markdown so > I can reorder the metadata as per the template. But certain YAML header > variables contain more information and I would like to split it into > individual values to place it in different locations. > > For example in a markdown file: > --- > address: > - | > person-1-name\ > some university\ > address\ > - | > person-2-name\ > some university\ > address\ > author: > - person-1-name and person-2-name > title: "sample title" > --- > body of the markdown file. > > here I would like to break the individual address YAML value accessible in > my template as $address$ into more atomic information bits like $ > address.name$,$address.university$ and $address.postal-address$ > > Is there any way I can break the template variables in the above manner > programatically.. > > -- > 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/a7183c8f-540b-4a9d-bb0a-79872f6f576an%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/a7183c8f-540b-4a9d-bb0a-79872f6f576an%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/CAEe_xxhXrDZbO4T6eoMY9EqD-4mtRCCoZZs7Zvuf-GHrbWm%3DbA%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 5030 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAEe_xxhXrDZbO4T6eoMY9EqD-4mtRCCoZZs7Zvuf-GHrbWm=bA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Splitting YAML header values into sub values based on a seperator value [not found] ` <CAEe_xxhXrDZbO4T6eoMY9EqD-4mtRCCoZZs7Zvuf-GHrbWm=bA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2022-06-21 15:02 ` William Lupton [not found] ` <CAEe_xxj1UapJuioZL=RdakUkjZWRf6WBL=XBg1_ABCCAxe2eCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: William Lupton @ 2022-06-21 15:02 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 3216 bytes --] I just realised that there's a very similar example at https://pandoc.org/MANUAL.html#extension-yaml_metadata_block On Tue, 21 Jun 2022 at 09:45, William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> wrote: > If you have the freedom to define structured variables in your markdown > file, then you can use a custom template to output them as desired. For > example, with this in your metadata: > > address: > - name: person-1-name > university: some university > postal-address: address > - name: person-2-name > university: some university > postal-address: address > > and this in your template: > > Address: > $for(address)$ > - name: $address.name$, university: $address.university$, > postal-address: $address.postal-address$ > $endfor$ > > you get this: > > Address: > - name: person-1-name, university: some university, postal-address: > address > - name: person-2-name, university: some university, postal-address: > address > > See https://pandoc.org/MANUAL.html#template-syntax for details. > > If you have to use the existing metadata definitions then I think you'll > have to parse the metadata values in a lua filter. > > HTH, William > > On Sun, 19 Jun 2022 at 09:21, Abhishek Ulayil <abhiman2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > >> I am writing a custom template for converting markdown into R-markdown so >> I can reorder the metadata as per the template. But certain YAML header >> variables contain more information and I would like to split it into >> individual values to place it in different locations. >> >> For example in a markdown file: >> --- >> address: >> - | >> person-1-name\ >> some university\ >> address\ >> - | >> person-2-name\ >> some university\ >> address\ >> author: >> - person-1-name and person-2-name >> title: "sample title" >> --- >> body of the markdown file. >> >> here I would like to break the individual address YAML value accessible >> in my template as $address$ into more atomic information bits like $ >> address.name$,$address.university$ and $address.postal-address$ >> >> Is there any way I can break the template variables in the above manner >> programatically.. >> >> -- >> 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/a7183c8f-540b-4a9d-bb0a-79872f6f576an%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/a7183c8f-540b-4a9d-bb0a-79872f6f576an%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/CAEe_xxj1UapJuioZL%3DRdakUkjZWRf6WBL%3DXBg1_ABCCAxe2eCw%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 5730 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAEe_xxj1UapJuioZL=RdakUkjZWRf6WBL=XBg1_ABCCAxe2eCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Splitting YAML header values into sub values based on a seperator value [not found] ` <CAEe_xxj1UapJuioZL=RdakUkjZWRf6WBL=XBg1_ABCCAxe2eCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2022-06-21 16:46 ` Abhishek Ulayil 0 siblings, 0 replies; 4+ messages in thread From: Abhishek Ulayil @ 2022-06-21 16:46 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 3828 bytes --] Thank you William, I understand now, that I can play around with custom YAML headers as variables based on how they are defined. But I cant change the way the pandoc variables generated from AST will be structured without a lua filter. I did see the example and followed up with a template, it was a great help. As for the solution to the problem, I think it is better to define the YAML headers better in the source file itself. Regards, Abhishek Ulayil On Tuesday, 21 June 2022 at 20:32:17 UTC+5:30 William Lupton wrote: > I just realised that there's a very similar example at > https://pandoc.org/MANUAL.html#extension-yaml_metadata_block > > On Tue, 21 Jun 2022 at 09:45, William Lupton <wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> > wrote: > >> If you have the freedom to define structured variables in your markdown >> file, then you can use a custom template to output them as desired. For >> example, with this in your metadata: >> >> address: >> - name: person-1-name >> university: some university >> postal-address: address >> - name: person-2-name >> university: some university >> postal-address: address >> >> and this in your template: >> >> Address: >> $for(address)$ >> - name: $address.name$, university: $address.university$, >> postal-address: $address.postal-address$ >> $endfor$ >> >> you get this: >> >> Address: >> - name: person-1-name, university: some university, postal-address: >> address >> - name: person-2-name, university: some university, postal-address: >> address >> >> See https://pandoc.org/MANUAL.html#template-syntax for details. >> >> If you have to use the existing metadata definitions then I think you'll >> have to parse the metadata values in a lua filter. >> >> HTH, William >> >> On Sun, 19 Jun 2022 at 09:21, Abhishek Ulayil <abhim...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> I am writing a custom template for converting markdown into R-markdown >>> so I can reorder the metadata as per the template. But certain YAML header >>> variables contain more information and I would like to split it into >>> individual values to place it in different locations. >>> >>> For example in a markdown file: >>> --- >>> address: >>> - | >>> person-1-name\ >>> some university\ >>> address\ >>> - | >>> person-2-name\ >>> some university\ >>> address\ >>> author: >>> - person-1-name and person-2-name >>> title: "sample title" >>> --- >>> body of the markdown file. >>> >>> here I would like to break the individual address YAML value accessible >>> in my template as $address$ into more atomic information bits like $ >>> address.name$,$address.university$ and $address.postal-address$ >>> >>> Is there any way I can break the template variables in the above manner >>> programatically.. >>> >>> -- >>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/pandoc-discuss/a7183c8f-540b-4a9d-bb0a-79872f6f576an%40googlegroups.com >>> <https://groups.google.com/d/msgid/pandoc-discuss/a7183c8f-540b-4a9d-bb0a-79872f6f576an%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/68cf1ed1-9c32-4248-aba7-f5e99378431an%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 7518 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-21 16:46 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-06-19 8:21 Splitting YAML header values into sub values based on a seperator value Abhishek Ulayil [not found] ` <a7183c8f-540b-4a9d-bb0a-79872f6f576an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-06-21 8:45 ` William Lupton [not found] ` <CAEe_xxhXrDZbO4T6eoMY9EqD-4mtRCCoZZs7Zvuf-GHrbWm=bA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2022-06-21 15:02 ` William Lupton [not found] ` <CAEe_xxj1UapJuioZL=RdakUkjZWRf6WBL=XBg1_ABCCAxe2eCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2022-06-21 16:46 ` Abhishek Ulayil
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).