public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Metadata Type Conversion
@ 2019-04-05  6:55 Rohit Goswami
       [not found] ` <03e707e9-78b8-4fc5-9e5c-c35a3c937f9b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Rohit Goswami @ 2019-04-05  6:55 UTC (permalink / raw)
  To: pandoc-discuss


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


I need to convert the following metadata (from the conversion from of an 
org-mode file and its metadata):
"meta":{"kind":{"t":"MetaString","c":"article"},
Where this is from:
#+KIND: article
To the following metadata type (from the conversion of a markdown file with 
a yaml block):
"meta":{"kind":{"t":"MetaInlines","c":[{"t":"Str","c":"article"}]},
Where this is essentially from: 
kind: article



-- 
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/03e707e9-78b8-4fc5-9e5c-c35a3c937f9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Metadata Type Conversion
       [not found] ` <03e707e9-78b8-4fc5-9e5c-c35a3c937f9b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-04-09  9:58   ` Jesse Rosenthal
       [not found]     ` <871s2b33fo.fsf-4GNroTWusrE@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Jesse Rosenthal @ 2019-04-09  9:58 UTC (permalink / raw)
  To: Rohit Goswami, pandoc-discuss

Rohit Goswami <r95g10-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I need to convert the following metadata (from the conversion from of an 
> org-mode file and its metadata):
> "meta":{"kind":{"t":"MetaString","c":"article"},

This lua filter would work:

~~~
function Meta(meta)
   local new_meta = {}
   for k, v in pairs(meta) do
      if type(v) == "string" then
	 new_meta[k] = pandoc.MetaInlines({pandoc.Str(v)})
      else
	 new_meta[k] = v
      end
   end
   return new_meta
end
~~~

It matches on "string" instead of MetaString because of the way that
MetaValues are handled in lua filters.


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

* Re: Metadata Type Conversion
       [not found]     ` <871s2b33fo.fsf-4GNroTWusrE@public.gmane.org>
@ 2019-05-07 14:33       ` Rohit Goswami
  0 siblings, 0 replies; 3+ messages in thread
From: Rohit Goswami @ 2019-05-07 14:33 UTC (permalink / raw)
  To: Jesse Rosenthal; +Cc: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 1389 bytes --]

Thanks! This seems perfect :grin:

On Tue, Apr 9, 2019 at 3:29 PM Jesse Rosenthal <jrosenthal-4GNroTWusrE@public.gmane.org> wrote:

> Rohit Goswami <r95g10-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > I need to convert the following metadata (from the conversion from of an
> > org-mode file and its metadata):
> > "meta":{"kind":{"t":"MetaString","c":"article"},
>
> This lua filter would work:
>
> ~~~
> function Meta(meta)
>    local new_meta = {}
>    for k, v in pairs(meta) do
>       if type(v) == "string" then
>          new_meta[k] = pandoc.MetaInlines({pandoc.Str(v)})
>       else
>          new_meta[k] = v
>       end
>    end
>    return new_meta
> end
> ~~~
>
> It matches on "string" instead of MetaString because of the way that
> MetaValues are handled in lua filters.
>

-- 
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/CAECsBSHV41BE%3DaZ4w3_QYNnv9fSrDp_X-jqiFHMb4JA9%3D7EqAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 2355 bytes --]

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

end of thread, other threads:[~2019-05-07 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-05  6:55 Metadata Type Conversion Rohit Goswami
     [not found] ` <03e707e9-78b8-4fc5-9e5c-c35a3c937f9b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-04-09  9:58   ` Jesse Rosenthal
     [not found]     ` <871s2b33fo.fsf-4GNroTWusrE@public.gmane.org>
2019-05-07 14:33       ` Rohit Goswami

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).