public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Iterate over YAML tree and extract elements when converting to another format (e.g. DOCX or PDF)
@ 2018-02-15 10:33 Brendan Pearl
       [not found] ` <a3611b42-8260-42ab-95e7-b6baba1c747b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Brendan Pearl @ 2018-02-15 10:33 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1882 bytes --]

Is it possible to iterate over a YAML file containing the elements I want 
converted into another format?

Here is a snippet of my current YAML structure (it is in YAML so that I can 
use it in other ways later - such as with R)

---
Items:
  "@Kamieniecki_Prevalencepsychologicaldistress_2001":
    Focus:  "Prevalence of psychological distress or disorders in young 
people who are homeless in Australia"
    Number of studies:  14
    Reported findings:  "Young people who are homeless have high rates of 
psychological disorders and score higher on tests of psychological distress"
    Reference: "@Kamieniecki_Prevalencepsychologicaldistress_2001"
    Tags:
      - negative_outcomes
      - mental_health

  "@EmbletonMwangiEtAl_epidemiologysubstanceuse_2013":
    Focus: "Prevalence of lifetime substance use in children living on the 
street in 'resource constrained settings'"
    Number of studies: 50
    Reported findings: "Pooled prevalence estimate of 60% [95% CI: 51-69%]"
    Reference: "@EmbletonMwangiEtAl_epidemiologysubstanceuse_2013"
    Tags:
      - negative_outcomes
      - substance_use
...

Is it possible to get pandoc (or a pandoc filter) to iterate over each of 
the items and extract specific elements (perhaps even conditionally - e.g. 
only those with certain tags)?

Brendan.

-- 
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/a3611b42-8260-42ab-95e7-b6baba1c747b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 2515 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Iterate over YAML tree and extract elements when converting to another format (e.g. DOCX or PDF)
       [not found] ` <a3611b42-8260-42ab-95e7-b6baba1c747b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-02-15 18:01   ` John MacFarlane
  0 siblings, 0 replies; 2+ messages in thread
From: John MacFarlane @ 2018-02-15 18:01 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

If you're targeting PDF, yes, this is easy, you can just
create a custom latex template and use the iteration commands
($for$) provided in the template language.

For Docx, you'd need to write a filter, because there is
no template.

+++ Brendan Pearl [Feb 15 18 02:33 ]:
>   Is it possible to iterate over a YAML file containing the elements I
>   want converted into another format?
>   Here is a snippet of my current YAML structure (it is in YAML so that I
>   can use it in other ways later - such as with R)
>   ---
>   Items:
>     "@Kamieniecki_Prevalencepsychologicaldistress_2001":
>       Focus:  "Prevalence of psychological distress or disorders in young
>   people who are homeless in Australia"
>       Number of studies:  14
>       Reported findings:  "Young people who are homeless have high rates
>   of psychological disorders and score higher on tests of psychological
>   distress"
>       Reference: "@Kamieniecki_Prevalencepsychologicaldistress_2001"
>       Tags:
>         - negative_outcomes
>         - mental_health
>     "@EmbletonMwangiEtAl_epidemiologysubstanceuse_2013":
>       Focus: "Prevalence of lifetime substance use in children living on
>   the street in 'resource constrained settings'"
>       Number of studies: 50
>       Reported findings: "Pooled prevalence estimate of 60% [95% CI:
>   51-69%]"
>       Reference: "@EmbletonMwangiEtAl_epidemiologysubstanceuse_2013"
>       Tags:
>         - negative_outcomes
>         - substance_use
>   ...
>   Is it possible to get pandoc (or a pandoc filter) to iterate over each
>   of the items and extract specific elements (perhaps even conditionally
>   - e.g. only those with certain tags)?
>   Brendan.
>
>   --
>   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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To post to this group, send email to
>   [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To view this discussion on the web visit
>   [3]https://groups.google.com/d/msgid/pandoc-discuss/a3611b42-8260-42ab-
>   95e7-b6baba1c747b%40googlegroups.com.
>   For more options, visit [4]https://groups.google.com/d/optout.
>
>References
>
>   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   3. https://groups.google.com/d/msgid/pandoc-discuss/a3611b42-8260-42ab-95e7-b6baba1c747b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   4. https://groups.google.com/d/optout


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-15 18:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-15 10:33 Iterate over YAML tree and extract elements when converting to another format (e.g. DOCX or PDF) Brendan Pearl
     [not found] ` <a3611b42-8260-42ab-95e7-b6baba1c747b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-02-15 18:01   ` 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).