From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32058 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: Lua filter to process chunkedhtml output Date: Sat, 21 Jan 2023 13:33:31 +0100 Message-ID: <87fsc4koud.fsf@zeitkraut.de> References: <1D22B433-211B-4033-8A63-F637F52B2008@gmail.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31546"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRBP6MV6PAMGQEVNYWSRY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Jan 21 14:19:00 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f60.google.com ([209.85.128.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pJDlr-0007vh-D0 for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 21 Jan 2023 14:18:59 +0100 Original-Received: by mail-wm1-f60.google.com with SMTP id p1-20020a05600c1d8100b003daff82f5edsf4640878wms.8 for ; Sat, 21 Jan 2023 05:18:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674307138; cv=pass; d=google.com; s=arc-20160816; b=Ljg4VMlR+mfR2rmhW8C4TnZ/Z3NzBhmsD71flG/m9vH9X2X/ZPG7toWDb3gzsBzbQl JXeexVa4gwlCKKUd2QgT/uUfEevqXme9djt+ksQBxnXNqDD8YOHi/lIcu/52hfLMn5BR NDyA6aNz4TNn7eavP5JfXtXFHANtbRFkR8eYfmKuLc8jKM3iuVxbgS92Wg1jEaa6L6HJ lu9mmev28V0tZRlriBXR8bFQdMzi2eiBeHiGdl88rXhqmutl8e2Ax1KpbBjpveTwEqvO WjTpf2C7+G8t0RIHVS68s/d59uplSZF9Y58Rklc1aH30acw7T3VnIeIK0C4UmyCY4K80 Muew== 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:reply-to:content-transfer-encoding :mime-version:message-id:in-reply-to:date:subject:to:from:references :sender:dkim-signature; bh=Arpz5FtRZJfqTXvW4g3z448pLb6XiI+0KpQOllFfKTQ=; b=vrHTnJcG5jJNIkZEmwQDj1lrvzqW7XgDvmWVtz3u6lsB0sQgxCb98xWUev/j/vOBEH F5oOX1C8+ZfRsefsN8OqVtcy+2udAh60LvsI0OSz5yl3/+SKpnl+oEJBKTwpceRJm6Qb ByAZdOj3q3OK13NOH5fPgfKBj9aN1HWRgH0xdCnHXcMesqQcydTm4gx8Ikkj4dNzkGuO MpAjBuYB6f/Lz4SxdFhOzRRwq8MWzjVGrFcr0OGmhkFYW0pbFmRrntWFk7K+yLcJpxOt ll92DF8NFmqxZqfzva0luls+dmagrvBwWHkh5LkEhbI+Ym7J1yN3F9jbG5pPesv33MvG smMw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::101 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender :content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:to:from:references:sender:from:to:cc:subject:date :message-id:reply-to; bh=Arpz5FtRZJfqTXvW4g3z448pLb6XiI+0KpQOllFfKTQ=; b=ZF/VKprBBRBPZQVTpJcF8TVWU7/YZjorpGbrULEtl5pv46oOGaEp/1YHDwNZCxTKeR 0lVE95tNrzIDIVEk7nIWopadxHfWc1pEhvoH7j0wwAaV0w7tIc6RBZOTuf8Pd/M4abwG ARSsivTsL+6/foh0vjzgyq8+CD9/aPRycIcj4wjJjOEml76AjeBjYlpCVY6s0jmr7+rT eNNhpQnVms8Ci31rVTfb8n+bJ4i2rKD8wNSwl/IX1xC7g0OAxXCsRw2U4OzMAzf20g2T tsDCwSYs2CyqOcS1Yu8hYIFKpTKUy0TtqCdnyr9KOXCuyXqxtQQnBuLs86I1lrVhC X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender :content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:to:from:references:x-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=Arpz5FtRZJfqTXvW4g3z448pLb6XiI+0KpQOllFfKTQ=; b=ngSsgs9Gto/II7J1WkElKrixhCEkfNe6unpZSeFp2ElD5TPTiOxFaGfxFElKuUtZaL ZtmCvzXVdrNS5Vdp0uAvb+0Xyo52bFm01xL+APVb24p9slgSRmHNRZ7sAxTkr1SZ6Czf vm2XR4bqqPvsrOHbIgzlsTvWbxux6o4qiBiAi87xOWehui+ZBQOqaFY16PmqZd/P+/Gx rmCL6mmO96eiznmcGwLKNnJlOJoOV79sPxFr2PVUJMmSGgOJawkrXYXXszrXWVNnQtov 9clt5nuxo4CUDmLYMZ3c Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AFqh2kpb59S0j/vLm0am6mFY+F8WzCf7wdhdBBDrI02UBbretLQqlcGy DM6kZ4dsGclyWv8v/tPDgv8= X-Google-Smtp-Source: AMrXdXso4tE0Nfjcs8AkJu9CsCNaTdVPU5kR1IsDKsZbnbz9wPxsgFg0dc1MVhbOjr7Y2Igwikhoaw== X-Received: by 2002:a7b:ce93:0:b0:3d9:9ee3:b8d2 with SMTP id q19-20020a7bce93000000b003d99ee3b8d2mr1057215wmj.70.1674307138791; Sat, 21 Jan 2023 05:18:58 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:600c:1c12:b0:3c6:c1ff:1fd with SMTP id j18-20020a05600c1c1200b003c6c1ff01fdls5784838wms.2.-pod-canary-gmail; Sat, 21 Jan 2023 05:18:54 -0800 (PST) X-Received: by 2002:a05:600c:510d:b0:3da:f6ae:faa9 with SMTP id o13-20020a05600c510d00b003daf6aefaa9mr22642291wms.29.1674307134286; Sat, 21 Jan 2023 05:18:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674307134; cv=none; d=google.com; s=arc-20160816; b=g3Db9yXERQWZZe9CgK4ESc3PEPG2SGLDyRmiH7ue2WDCad3cv2bjpCjXe7dNPhnxPs JJ9NQ1GY58ixvgLsmzmj5amiI+xToP1RFs9tJ9jaxJrC/LapTKBsgmPzkU/FuBzhNTJJ LEu9weQwD3fdEYdaraGd7iotwO2MI63lrv9WnifuXSP0fcRY7CUW8HvS+UFOafFAPk/Q FjTANsxhzf/9eceWnL6P/cwHycu/kCZwx9NYD/NZpsXTfD2+UdnM6MGOmt0L+b6qVPgW gi6xPpiI/MFYq3rEfEehrcpR+VctlTgkio/SWGw10D28N0vKz8BdodOtvYGmbkNfjHCj byhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:to:from:references; bh=My1k0jv6GPe7ziJhNE3vyAJBYngbbY+0GVP45dsJp8w=; b=EhFTfuKT8TAwuThZOGUh3m8GeGgfi/j+kmhW6kZzVCarDKc9lqRf3jdAD7FSlY/eD/ n1XSoCmjJUZ7Orja50uNutqqIrwXHLhCdpQITzaqzTN0TMTOi/JWlAzOEwSyLbkH4vtA JhJZ+wOy9kTVu9G54aKErGIpJJF1/r2clA4YdOi1C3PzISk8bryD6E+MMnWI8pUTzFON gD+FtMQZ+AazDt32MYB7Jg3bH3AvGrp82P3ArSenNwXWB7KuUXh+aG1OJQGGeRB+EHuo 4UQEKVxr5Z495gOu/Qt1vdnfLh0dpVcR8BSOkvAEvmy72GPb/x7ZIClRTlijKFt7/xmJ atAg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::101 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Original-Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org. [2001:67c:2050:0:465::101]) by gmr-mx.google.com with ESMTPS id e11-20020a05600c4e4b00b003db0d2c3d6esi269103wmq.0.2023.01.21.05.18.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 05:18:54 -0800 (PST) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::101 as permitted sender) client-ip=2001:67c:2050:0:465::101; Original-Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4NzcQ34gxzz9sRg for ; Sat, 21 Jan 2023 14:18:51 +0100 (CET) In-reply-to: X-Rspamd-Queue-Id: 4NzcQ34gxzz9sRg X-Original-Sender: albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::101 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@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:32058 Archived-At: "'William Lupton' via pandoc-discuss" wri= tes: > pandoc.utils.type() return values seem to be a little inconsistent. > For example, it can return: > > 'List' ... for pandoc.List (note: logging.lua leaves this alone) > 'pandoc Xxx' ... for pandoc.Row etc. (note: logging.lua replaces > the space with a dot) > 'HsLua.JSON.array' ... presumably for arrays that have come via a > JSON library Thank you for digging and asking! It's great to have more eyeballs in this part of the code. A bit of background: all types have a corresponding entry in the Lua "registry", a global table that contains all sorts of info. The Lua manual states "you should use as key a string containing your library name", hence the "pandoc" and "HsLua" prefixes. Additional inconsistencies are cause by the fact that I didn't follow the Lua manual's advice in the beginning, as name clashes with other packages where not really a concern of mine. > I was toying with not indicating HsLua.JSON.array (i.e., showing it > like any other table) but perhaps it's better just to report things > as they are. Can any other HsLua.JSON.xxx values be returned, e.g., > why not HsLua.JSON.object or indeed HsLua.JSON. > {boolean,number,string,null}? There's a technical reason for this: we must be able to round-trip from JSON to Lua to JSON. Both JSON arrays and objects are represented as Lua tables, but how can we know whether an empty Lua table `{}` represents an empty array or an empty object? We solve this by assigning a metatable/type to array values. I guess we could also do this for JSON objects, but the advantage is less clear in that case: being able to add metamethods like `insert` makes sense for lists, but not for objects: String fields can shadow any method, which would most likely lead to subtle bugs. E.g., `obj:merge(obj2)` would stop working if `obj` has a key `merge`. Adding a metatable to objects would therefore be little more than performance degrading overhead. The other JSON types, boolean, numbers, and strings, map directly to the respective Lua types of the same name, and pandoc.utils.type will report the Lua type name in those cases. Anyway, please do open issues for any inconsistencies you find. We may want to keep some of those old names to keep error messages more readable, but consistency would be nice to have, too. > On Fri, 20 Jan 2023 at 16:33, William Lupton < > wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> wrote: > > Update: Until today, logging.lua assumed that pairs() would work > on all userdata. Option 2 (my favourite) should work well if > there are ever any other types of userdata (not sure whether > there ever will be). > =20 > On Fri, 20 Jan 2023 at 16:29, William Lupton < > wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> wrote: > =20 > Thanks Albert. I expect I'll raise an issue. I assume > that=C2=A0this is the only use of light userdata? > =20 > Looking more closely (why didn't I do this before?) I see > that tostring() returns 'userdata: 0x0' for these values, so > I think it makes sense to report them as one of: > Whatever tostring() returns > As above=C2=A0with=C2=A0the leading 'userdata: ' removed=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0<--- probably my favourite > As above with '0x0' reported as 'nil' (not sure about > this) > =20 > On Fri, 20 Jan 2023 at 16:05, ChrisD < > cd34-gg-4SSc53hpTiu9TMao6EloiEEOCMrvLtNR@public.gmane.org> wrote: > =20 > On 1/20/2023 2:54 AM, 'William Lupton' via pandoc-discuss > wrote: > > I investigated, and parts of the writer options are > "light userdata" (I hadn't heard of that). I've committed > and merged a fix that will report such items as " > ". You can now list most of the writer options > (just a few colors show as ). > =20 > Your update works well. (I didn't know about light > userdata either.) Thanks! > =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 email to=20 > 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/ > fbca8e05-fed7-39e1-08f0-0498c399f33f%40intielectronics.com > . --=20 Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 --=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/87fsc4koud.fsf%40zeitkraut.de.