From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32538 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Use Writer in Lua Filter? Date: Sat, 6 May 2023 10:53:05 +0200 Message-ID: References: <9dc956cf-74a3-4e25-b4bd-62aae6dcc3f4n@googlegroups.com> <87jzxobp5d.fsf@zeitkraut.de> <87fs8cbnne.fsf@zeitkraut.de> <4c078a54-2252-4253-b2a5-6348ecc1f916n@googlegroups.com> <878re3bb7a.fsf@zeitkraut.de> <79a8dca6-9860-4109-b2e8-5841faa36cc0n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000032671505fb02890f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31980"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pandoc-discuss To: bpj Original-X-From: pandoc-discuss+bncBCWMVYEK54FRB6VK3CRAMGQEQBU6DEA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat May 06 10:53:18 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f58.google.com ([209.85.210.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pvDfJ-000841-QK for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 06 May 2023 10:53:17 +0200 Original-Received: by mail-ot1-f58.google.com with SMTP id 46e09a7af769-6a5db79c525sf1873725a34.1 for ; Sat, 06 May 2023 01:53:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683363196; cv=pass; d=google.com; s=arc-20160816; b=St2pb0FNKILjS+20GrLAvz43DnuesdsrzISJvstCWzV+kSz9J0Z7ejm5EKNvk6L5Be PfY96Sy31K+di0PkRFXMpOBspff/dGNMNgoMMlpkdCL4E9Aprlc9Rm58YQmMV9X2JgEe glJ8EH1QOvyM4ouT175J3xqZ8urDqou/eKz2K0nZwZtV2sUdBdb1kUgPjA30cZAgX8v0 c9dbzp2JBNeGPIfoa6UpS4CpjK4Fup86pU86ERp4HuDD6RlSdPnlqXDB3Me4sT4GpTc0 035p/3fklApH5dPcEOeBtKDBXcPMF/iTCbc1M1sYbFK6BBZ9ZtGn4ArCmjcI2UMkxXzg Z2Tw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:sender:dkim-signature; bh=xwXnChBrA/85Tmb2YqmIZOO2qGARxGpQ8zkW/+GaDPE=; b=wsSceUTV8gokCZLvdqn+thH6YDL2+PDRSBiRVfKQTtcpofc+Cxwj4afo0pyWPkZsML 6jELVlATuAT96rASdKWscZUPpzh1ZCwf/cUC3SLo6yu06d6eilD1I+swDRwfklK8wgq6 rLVsTG6QtK2CRW4uq98mmvYEPC/63qkFFK9RBqaPPk6ZvdhcF/jD2JD2va2qJEhkirZt QpM9ZS6h6hG1g/de8oklmN3rBXdtI2dXjcwF3fqqKMD+QzcWK9/NsvO3jMZpMe4ekspY xil+c475TGWYFGKtGwOpyFSD2lGIfp0zp5lb9LQBk4E3GSES++Aw46BKSftfc9EfVJYU 1qkw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.219.179 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1683363196; x=1685955196; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:cc:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:sender:from:to:cc:subject:date :message-id:reply-to; bh=xwXnChBrA/85Tmb2YqmIZOO2qGARxGpQ8zkW/+GaDPE=; b=lvqPnFScg4aAF2t6xqVq7Qk34JePdsjJTpa4FaWuWFJg0zCZonQ5CTt/Ykg0KL26Yo UxAN3ad6B34yeUl9tIOWLe+ivBJO5BXB9w5jG98vvxdrRG0eLRipneYAS+veyd2xbdYE jb4C3Kd4YZyaimxj7j/VZnP2dcz9qgf92RI799C382sUMzbA8XqDktceZmX6ksxltmHl 5g32VbLV/Ejqtc9G0Auyo32y/RKcjf1zUNvWKBKwZQoY0WjgXC32LY6ZnHq3ckMSKLpm vuKeN10YZmG8p5lE6fQAAQpWAV1vTKzaHEcNENlkdTfNJc4WZ1roDqfaYJMey6is72fh X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683363196; x=1685955196; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:cc:to:subject :message-id:date:from:reply-to:in-reply-to:references:mime-version :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=xwXnChBrA/85Tmb2YqmIZOO2qGARxGpQ8zkW/+GaDPE=; b=dWEdFj4y2HImvQzq99QmsM129hj7uBqVJ2pqJd2h4lTtytRQnzfE4VQ2/zP8dqBc7p fBwBRlkxYr6tvTzDyYnbpFEmDzlFf8kozLaa8tx04DGVLTOAsj/zY2KgOqqQ38cnEU6T eFQFlKmjvWehR2iW0VTNydJQiAF35yka2wbVFM/gFo5WybL62tOwaRCSIbqiDRmXw8LF pgv87w76KcxdwL9ffMXMQh6aaIT7xOHVis6lLl6G45Pix4/xNkgDWHd2+DVLxIcg374W e1L Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDyxrdSvwMwf5lCRmRKkZg/nAmbXxuopchK0lszqh0FeCEtqhJD3 DplwgQRHm5I2cCFOB673y3k= X-Google-Smtp-Source: ACHHUZ7RC+IUnLUNQIcKXS6X2zsHfzgWd0V/RAMnQ4PzeSFVnJFSUaPrrVzqUUKsFA6BV6dmIRxwQw== X-Received: by 2002:a05:6830:1354:b0:6a5:dd6d:2dc3 with SMTP id r20-20020a056830135400b006a5dd6d2dc3mr1086300otq.6.1683363196669; Sat, 06 May 2023 01:53:16 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:1818:b0:38d:fef4:f867 with SMTP id bh24-20020a056808181800b0038dfef4f867ls5871480oib.4.-pod-prod-gmail; Sat, 06 May 2023 01:53:14 -0700 (PDT) X-Received: by 2002:aca:1a02:0:b0:38e:6a7f:194d with SMTP id a2-20020aca1a02000000b0038e6a7f194dmr1834530oia.54.1683363194360; Sat, 06 May 2023 01:53:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683363194; cv=none; d=google.com; s=arc-20160816; b=WFJpbYguL1+xg6KStCHgjEQpFQEQVDF19HH3Jp03U1PHDQSKCkYbhy630Hp1NUNsRU 88o2jy5ilOnIHasC95TN89UKTH3PtDdNxdcNpi9FnqTnXgE3cVQ6gh+yPpjrndyCiH5+ oNwHTPnbJl7KFHuqim31JdA0bmc5WGoHQjls+5FwAxso7VMsk8d62Xucu4+mxucakjsM Vf7YZ8I0GxbZvgJRbnhH1DbbqPvpMAJ7EEiApoZKG/i2JBXWhqbdQWQZjoEqY3neQgWM LtLaN0L54VuG8IvzFoV2V+H470qVXmnYfS+pMqGqxFWng7336RbQNFLYvibrnR6ZpqYZ laeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version; bh=8zCjBF/vPGVgRupkp1DVC+APXwuwlx9r5dfGliHJzls=; b=N0wbdtwKhuY87Q2MtbKHVaagaw51RYR3idocQG3ugbdBHF86ZRCv3R6Owu+10wNiPh XF960iOo8GlRy1mojZHxvs1nGl4MgTieZgJqnoFSNf3NqzrUnvc4Scm929jhf1ZLlZUp 1RR62G8pGLeIZGPo7eeWFJUh7uEMZXdRzgSDA+rIxmgs0Pporpeg2e+uDpsybqYD7GjA C1F5TBe88P4Sq6KTvOFk0hPfBh2bf6MlV09S/1KfCWN6vvJtdwQzI5hRxe0YLsh/5dk7 PRmTjsasKyDoTwndPLMVEhN3csrNMwGyF4uMi9BidCV0r2uSlsQXwxROd4RnmnSuvlXF eBqg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.219.179 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Original-Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com. [209.85.219.179]) by gmr-mx.google.com with ESMTPS id by4-20020a056808340400b0038409c2d352si473158oib.2.2023.05.06.01.53.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 May 2023 01:53:14 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.219.179 as permitted sender) client-ip=209.85.219.179; Original-Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-b9e27684b53so2406339276.0 for ; Sat, 06 May 2023 01:53:14 -0700 (PDT) X-Received: by 2002:a25:b101:0:b0:b99:53e9:ba97 with SMTP id g1-20020a25b101000000b00b9953e9ba97mr4914391ybj.43.1683363193839; Sat, 06 May 2023 01:53:13 -0700 (PDT) In-Reply-To: X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.219.179 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@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-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:32538 Archived-At: --00000000000032671505fb02890f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Also assigning `nil` to a table key/index deletes that key/index. A table value can't be `nil`: ``````lua local t =3D { a =3D 1, b =3D 2, c =3D 3 } for k,v in pairs(t) do print(k, v) end -- prints -- a 1 -- b 2 -- c 3 -- but in a random order t.b =3D nil for k,v in pairs(t) do print(k,v) end -- Doesn't print b 2 because it doesn't exist anymore! `````` Den l=C3=B6r 6 maj 2023 10:35BPJ skrev: > > > Den fre 5 maj 2023 10:04ThomasH skrev: > >> Ah, ok, sorry, I've only come to Lua through Pandoc, so I'm often not >> aware of general Lua features. I will keep an eye open for the 'show' >> method. >> >> T. >> > > See > > https://www.lua.org/manual/5.4/manual.html > > https://learnxinyminutes.com/docs/lua/ > > Note that the latter seems to fail to mention that the full syntax for > long strings and comments includes balanced `=3D` characters between the > brackets so that you can include double brackets with or without a lower > number of `=3D` chars in the string, e.g. > > ``````lua > local foo =3D [=3D=3D=3D[ [=3D=3D[ [=3D[ [[ foo ]] ]=3D] ]=3D=3D] ]=3D=3D= =3D] > `````` > > is a single string delimited by `[=3D=3D=3D[` and `]=3D=3D=3D]` > > Also escapes like `\n` don't work in long strings. > > > > >> On Friday, May 5, 2023 at 7:26:41=E2=80=AFAM UTC+2 Albert Krewinkel wrot= e: >> >>> >>> ThomasH writes: >>> >>> > I just wished that would have been more apparent from the docs. >>> >>> The `tostring` function is the default Lua way to convert an object "to >>> a string in a human-readable format". Still, I made a mental note to ad= d >>> better docs once we switch from a Haskell to a Lua representation as >>> `tostring` output. >>> >>> The Haskell/native output will probably become available via show >>> methods, as in `block:show()`. This already works for Block elements, >>> but not for Inlines. >>> >>> >>> >> Albert Krewinkel writes: >>> >> >>> >> > The alternative is to use `pandoc.write`, e.g.: >>> >> > >>> >> > print(pandoc.write(pandoc.Pandoc {element})) >>> >> >>> >> The above is missing the second parameter: >>> >> >>> >> print(pandoc.write(pandoc.Pandoc {element}, 'native')) >>> >>> >>> -- >>> Albert Krewinkel >>> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 >>> >> -- >> You received this message because you are subscribed to the Google Group= s >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n >> 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/79a8dca6-9860-4109-b2e8= -5841faa36cc0n%40googlegroups.com >> >> . >> > --=20 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 e= mail 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/CADAJKhCiFbdbX7QdtODq3Vd3hemrObiFpi0W9fmf_hyS077T-g%40mail.g= mail.com. --00000000000032671505fb02890f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Also assigning `nil` to a table key/index deletes that ke= y/index. A table value can't be `nil`:

``````lua
local t =3D { a =3D 1, b =3D = 2, c =3D 3 }
for k,v in pairs(t) do
=C2=A0 print(k, v)
end
-- prints
-- a=C2=A0 =C2=A0 1
-- b=C2=A0 =C2=A0 2
-- c=C2=A0 =C2=A0 3
-- but in a random order
t.b =3D nil
for k,v in pairs(t) do print(k,v) end
-- Doesn't print b=C2=A0 =C2=A0 2 because it doesn't exist a= nymore!
``````

Den l=C3=B6r 6 maj 2023 10:35BPJ= <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> skrev:


Den fre 5 maj 2023 1= 0:04ThomasH <therch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
Ah, ok, sorry, I've only come to Lua through Pandoc,= so I'm often not aware of general Lua features. I will keep an eye ope= n for the 'show' method.

T.

See=C2=A0=


<= div dir=3D"auto">https://learnxinyminutes.com/docs/lua/

Note that the latter = seems to fail to mention that the full syntax for long strings and comments= includes balanced `=3D` characters between the brackets so that you can in= clude double brackets with or without a lower number of `=3D` chars in the = string, e.g.

``````lua
local foo =3D [=3D=3D=3D[ [=3D=3D[ [=3D[ [[ foo ]] ]= =3D] ]=3D=3D] ]=3D=3D=3D]
``````

is a single string delimited by `[=3D=3D=3D= [` and `]=3D=3D=3D]`

Als= o escapes like `\n` don't work in long strings.
=



--
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 pandoc-discuss+unsubscribe@goo= glegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7= 9a8dca6-9860-4109-b2e8-5841faa36cc0n%40googlegroups.com.

--
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 view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/CADAJKhCiFbdbX7QdtODq3Vd3hemrObiFpi0W9fmf= _hyS077T-g%40mail.gmail.com.
--00000000000032671505fb02890f--