From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/19440 Path: news.gmane.org!.POSTED!not-for-mail From: tolot27 Newsgroups: gmane.text.pandoc Subject: lua access to metadata variables Date: Fri, 2 Feb 2018 02:32:47 -0800 (PST) Message-ID: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_371_1951929735.1517567567443" X-Trace: blaine.gmane.org 1517567452 21761 195.159.176.226 (2 Feb 2018 10:30:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 2 Feb 2018 10:30:52 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCE4JTPKQMMRBUH42DJQKGQEZBOZ6BY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Feb 02 11:30:47 2018 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-ot0-f187.google.com ([74.125.82.187]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ehYcG-0005EH-BL for gtp-pandoc-discuss@m.gmane.org; Fri, 02 Feb 2018 11:30:44 +0100 Original-Received: by mail-ot0-f187.google.com with SMTP id h8sf14143968ote.8 for ; Fri, 02 Feb 2018 02:32:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=CS+kY+81ip7Hshp9LCG/JyL8qmFu9oV7kJiNGeRJ33A=; b=SNmRFD/UfBlR4aY/cx0GhYchzfSvbP0hau0IO88CD2fJHpGdTcXaYrkF0zC4Qq12rt qHWTcMPZqn6tQLKaN/ZfOwOOMEAnNqZ1pZU9+pLqDDPVFv7/h4IWN3AqO7pU+eMvPEXK pZX4dZtn25qLY+DuhOqgYdEQ1v9YE85nAXh+0ESosmFAQqg89vL0KqCqcT+8UsJ705nN hLOCoKqnvB1VRjBfQA3KFiQPY7vzSPLLApC4yxBcrCgfs79cExa7+P6YnLkzRdUxd4CH E0umy5CCxOG/3xnScLHNoKAkkaLc1y53EmygIPygYAYmAxTdmz6WpWHZhJ3VG973+R5i X9Lw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walter.gd; s=google; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=CS+kY+81ip7Hshp9LCG/JyL8qmFu9oV7kJiNGeRJ33A=; b=ZBDvIXuETJcpIGAS8R0Tv2UHY1YFZ/lSAw7JC5ZQ9+xGoO3zgmg9+bdpfCS0dsE7Bj 71YtdybXApoyBu4Vd6CV7Yp6EnM69fB9hnpg9zUp246itqb6UEiU84UGsWiNh4iE3Ki3 kkkScoFjk8QHNZiZjB+9TsYDVcKwGMegLRy+M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=CS+kY+81ip7Hshp9LCG/JyL8qmFu9oV7kJiNGeRJ33A=; b=f6pFxBdef+5Ta951Eecc9VQiUR24YVmNwHEgKO8vioWfI0gg2hHRfGZSAPor2WJxIy lVb84KRs5jrN+v9LJdKDUqh3arPo2mKIsGE62M5RNi4/6SbzfZOTeauuErV7Vc70Skhr 9JNrWjIJhE7+XeRavX+KsUXNq6xc4rS4sM9Qc1VA4gT6s7zbe/HlUusFix7bfpaTo6d5 oGerhTz28g2zaAyneetRATUB76R1WVwspnDHQj4Wujs7+66+e08t4Q9M4PSa2SVPk4y2 ZlaNclvv8rrC9PXnrH3QftFykhreum6uXConsGOwp41oYrt6OoBS+n93wnXl+doImDsW UsEg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APf1xPCdEoGVGv9MSznGJqjP6tQkdF9jeyBDUI/KYEsnfAPF2BmzoTDD anZNrETZoLuBIdgiRA10DxI= X-Google-Smtp-Source: AH8x2250xNiOABYGqvnfnqK82HIerWrKuPnWv59VE+E6COsDJMvG7N1Afokvae5uUYeToX9uBOxdtA== X-Received: by 10.157.87.132 with SMTP id q4mr360190oth.2.1517567569372; Fri, 02 Feb 2018 02:32:49 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.157.40.38 with SMTP id m35ls701904otb.3.gmail; Fri, 02 Feb 2018 02:32:48 -0800 (PST) X-Received: by 10.157.24.117 with SMTP id t50mr2129631ott.9.1517567567856; Fri, 02 Feb 2018 02:32:47 -0800 (PST) X-Original-Sender: mathias-taBouHiV1h1goHlPtYpdqQ@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Spam-Checked-In-Group: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:19440 Archived-At: ------=_Part_371_1951929735.1517567567443 Content-Type: multipart/alternative; boundary="----=_Part_372_1684735059.1517567567443" ------=_Part_372_1684735059.1517567567443 Content-Type: text/plain; charset="UTF-8" Hi. I try to access a metadata variable inside a lua filter with pandoc 2.1 but find no easy solution to cover the four cases (known to me): 1. at the command line with: -M key:value 2. inside a YAML block as a single line: key: value 3. inside a YAML block printed at a second line with: key: | value 4. inside a YAML block printed at a second line with: key: - value Inside the lua filter I access the variable using meta['key'] but the type and content depends on the case. 1. returns a string 2-4. returns a table with: 2. { [1] = { ["c"] = value,} ,} 3. { [1] = { [1] = { ["c"] = value,} ,} ,} 4. { [1] = { ["c"] = { [1] = { ["c"] = value,} ,} ,} ,} Hence, an increasing nesting. How to easily "unlist" these tables or access the key directly? And why is there a table key "c"? -- Regards, Mathias -- 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/ac250ed2-67fb-4fef-aed1-45681b15f48c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_372_1684735059.1517567567443 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi.

I try to access a metadata variable= inside a lua filter with pandoc 2.1 but find no easy solution to cover the= four cases (known to me):

  1. at the command = line with: -M key:value
  2. inside a YAML block as a single line: key: value
  3. inside a YAML block printed at a secon= d line with: key: |
    value
  4. inside a YAML block printed at a second line with:=C2=A0key:
    =C2=A0 - value

Inside the lua filter I access the variable using meta['key'] but the type and content depends on the case.

1. returns a string
2-4. returns a table = with:
=C2=A0 2.=C2=A0{ [1] = =3D { ["c"] =3D=C2=A0value,} ,}
=C2=A0 3.=C2=A0<= font face=3D"courier new, monospace">{ [1] =3D { [1] =3D { ["c"] = =3D=C2=A0value,} ,} ,}
=C2=A0 4.=C2=A0{ [1] =3D { ["c"] =3D { [1] =3D { ["c"= ;] =3D=C2=A0value,} ,} ,} ,}

Hence, an increasing nesting. How to easily "= ;unlist" these tables or access the key directly? And why is there a t= able key "c"?

--
Regards,
Mathias

--
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/ac250ed2-67fb-4fef-aed1-45681b15f48c%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_372_1684735059.1517567567443-- ------=_Part_371_1951929735.1517567567443--