From a444321be87da3cba36c737995cd1590fa644e8b Mon Sep 17 00:00:00 2001
From: Albert Krewinkel <albert@zeitkraut.de>
Date: Mon, 15 Oct 2018 21:00:50 +0200
Subject: [PATCH] Lua pandoc module: fix MetaList constructor

Passing a MetaList object to the constructor `pandoc.MetaList` now
returns the passed list as a MetaList. This is consistent with the
constructor behavior when passed an (untagged) list.

Previously, the constructor used to create a new MetaList with the
passed MetaList as its only element.
---
 data/pandoc.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/data/pandoc.lua b/data/pandoc.lua
index 1e2d2a061..dc09c85f8 100644
--- a/data/pandoc.lua
+++ b/data/pandoc.lua
@@ -267,7 +267,12 @@ M.MetaInlines = M.MetaValue:create_constructor(
 -- @tparam {MetaValue,...} meta_values list of meta values
 M.MetaList = M.MetaValue:create_constructor(
   'MetaList',
-  function (content) return ensureList(content) end
+  function (content)
+    if content.tag == 'MetaList' then
+      return content
+    end
+    return ensureList(content)
+  end
 )
 
 --- Meta map