From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28337 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: luacheck configuration for pandoc Lua filters? Date: Thu, 13 May 2021 09:46:33 +0200 Message-ID: <87mtszyt2e.fsf@zeitkraut.de> References: <7fd5e3eb-99cd-4bce-84c4-313077e96637n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15449"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRBZFS6OCAMGQETXXN5SI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu May 13 09:46:47 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f188.google.com ([209.85.208.188]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lh63S-0003qK-T1 for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 13 May 2021 09:46:46 +0200 Original-Received: by mail-lj1-f188.google.com with SMTP id c41-20020a2ebf290000b02900dee6b2c595sf13932669ljr.5 for ; Thu, 13 May 2021 00:46:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620892006; cv=pass; d=google.com; s=arc-20160816; b=inFvIcEPHXCxpbZ2/yJxjxrbUM1PhryxXmFheU/aZcJtbTmpwXk8m9Rd2/9HfqbbMy KDN4MxQbAUYobM+xrHZDA4TcfU7DkQu/ls8rzmqsXcQjCxxptoqzC3309wSR17OM2063 bPU+ADpARhc9RZKoHzkUA+i4yPR2niVYSGzQqS1hw5q1OBuDjWrCvWZf/IV6vHuIZE16 YFfs/RmN1E4zChFaag32bCvB35OCjV9GboOflr36dwTNurlZdg9PAI+K3j1mz4pGmTcX dJ4aINHLJClFg0YL/HbWiYOXo1Tlj5fUAdit8RTp4XqaqfKVYsqz6Iv6t7k8MKDxir74 cTyQ== 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:mime-version:message-id :date:in-reply-to:subject:to:from:references:sender:dkim-signature; bh=11dHDzRvFlMSx1SuS64hPS7gADwMpObcLpZcHm26kQw=; b=o76qEtDDCLQh/xHCAFUcRRIvts910H1LL2Q8OnhXyk9INIl83KZlgBUX9SPc91eS1k z5SxKpeJASDlBCM4iMDuILn85gF6q8CRlF3skt2qvfR3wo5xj1J3f4EAbAgWu5jllFe3 JnrPtaYVjqFb1aKE6Few+Jg05Owv4x7fBkEoRgNCMCGeoneYa16x0iWRGsHrv5lPE0Gz YLUV51OYHOaMpjacvDSKM2mipWgnTMpjPzsPT2BUEun9oiQx1tfFzBbC+Xorx1i64oaE L76OFDKjZJAjKkRRsGoCdj+Z9UelF15VTyGMYz0gvIYaGL6dGp6jOOTMPrlTAqL00mpI VgPg== 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::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=20161025; h=sender:references:from:to:subject:in-reply-to:date:message-id :mime-version:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=11dHDzRvFlMSx1SuS64hPS7gADwMpObcLpZcHm26kQw=; b=khMuHmgkiDzHD5mY/DJZtdhKWcGPMBddJ/fPMfx4/9PEVtxWjOeEW1fbFAltduBc4p IIkUJIK8IeNQzn+m6O8+V6QJoTqntQv4cf0NwvC2bzR1Zzz1s3FKJqXzUGlm+EJFQlRo hmkNTMSZRyBZJJN7PYs6NK7Yowmo2KYTdvDPt9OBW0Vr5t+psweUIxxaE8hE+wswmcmm l2rb7tGdy1pib9qfsIFmmKq12ERYa3tiw1Kz1eDb9pgJiB9cX2QabK/XgMASf3jck5d4 su/cP8QJ7T9kUrBchl/fEjDNEIzgzdMVhY4EDK+xZt+rG5GAljsTh9uZbtKbU3OEAucG /jHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:references:from:to:subject:in-reply-to :date:message-id:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=11dHDzRvFlMSx1SuS64hPS7gADwMpObcLpZcHm26kQw=; b=KybP01e20D7RM5UEkYG2vObNHMKnFHCj4VZ23F38WI5E6OV5UrjLqoGjm4pBcX6WUV /u1wMSNgPx87Raw4GIshBqx1Wo1RETsWey41peN0G8aB7+mNel9oLiRgOw9joXoc4ss1 HOVzoXeU62NWLaXqnpyMZXVkjioaWu5SZx0LQzT/R5BHubsGofmj0hvwwQ21GHQd7/lz /z3GHlYdjeznVKqlbmOjvxaKVTJc5BlxdLAw70T1CfFCvwEW4V7TapIhSZ51tRX51ctn XSAwADMgUFVJzsAiu2l+Qhuc5cQShgjgbxszQlwaT7W9eaxAYonp9KkOkQHG5a2YdqxG yNfA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5314n8O9dEmHamoNmH4BVt0r54ft4WVKzX6duNfyXyjt1EP6uSxq cHp79wVskNympwvPVsT4JFs= X-Google-Smtp-Source: ABdhPJyGNEfe5/kCXvvMi9yb9b1Hvoigr7PiLUvAp2i/Jb7DKBjbIMsG02o16fG1lX1B22Mn1TXRJg== X-Received: by 2002:a2e:850d:: with SMTP id j13mr33074460lji.19.1620892006351; Thu, 13 May 2021 00:46:46 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:ac2:5592:: with SMTP id v18ls3068362lfg.0.gmail; Thu, 13 May 2021 00:46:43 -0700 (PDT) X-Received: by 2002:ac2:5384:: with SMTP id g4mr28537450lfh.82.1620892003626; Thu, 13 May 2021 00:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620892003; cv=none; d=google.com; s=arc-20160816; b=KmvCRkZvDgHn11Spra3nyx0sV3A+CjAhK1fFGy74iO5Np15cwcjTjmS8YrGJ/aBhBD vjFbK47zxfnZM9EQiT11Q5JJWTeioa16mkircvWdfDY0Zc9QkNjUrjMSzorqskJEKKa5 ePEoq1ZRQb6hJSDO59pE/DjmlzYlFUZ8VgvoIfF8DOXN86kloNx53jrQ3WyC41XVJQeA 5zWMDac89L1r5+vBWuycs2XOTMHG1jhaK0C0EsoAF/dLPxtwKHc1ZMcfr4ewzRsmTL5l nTX2N9P4xXmONYcivexVOkFFW8ldJl0cfXy42PU8A4JuqcPHW46TMZ4NR9n7ATg8+Aho beng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:in-reply-to:subject:to:from:references; bh=vTvQ2a8JJnPKStUflTzA7koPHhqdRiuc42PbK/zaPd0=; b=cMfUwA8Qm8HPnX3gJn+gffU2mBpt+nz9F3zCM/v08/7rBhE6MZVOvCXd/uq4qlBvuU XHvukbh1rbKteNL5oYeFbWjYrp9SXtndiFrSWvq11aBiByWm1oizyTqIRcsLzKk1dfdE b5FzQZJdlgaZFe7OHbYc6WGlZcb2177JueEVS1CKerFVodm0gpRLUU2dTNDS5swv9n4S 5fk+rxHR2JMa+fvVZjNskvL3tPL26PSOJSC92Q5v6zT2LVN1GejPT/8tB2w42mA3Rekp n9ojYcpYOeh7/nO0U9lay/qZt1Kb18QfwBTskf5hcieP09+UZAPVKBUPIZ3ig6o28pnP /2mQ== 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::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::465:101]) by gmr-mx.google.com with ESMTPS id b2si81729ljf.0.2021.05.13.00.46.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 00:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050::465:101 as permitted sender) client-ip=2001:67c:2050::465:101; Original-Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (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 4FgkHy6Lv1zQjgR for ; Thu, 13 May 2021 09:46:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id j9kZy5upFDot for ; Thu, 13 May 2021 09:46:35 +0200 (CEST) In-reply-to: X-MBO-SPAM-Probability: ** X-Rspamd-Score: 2.83 / 15.00 / 15.00 X-Rspamd-Queue-Id: 1987A17F6 X-Rspamd-UID: 119643 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::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:28337 Archived-At: Norman Ramsey writes: > luacheck works with one module at a time, so all I need to do is figure out > the _names_ of the callable objects. I could poke at metatables or could > assume conservatively that all objects are callable. What I don't know how > to do is find callable names that _aren't_ materialized in the `pandoc` > table but are available only via an `__index` metamethod. We don't do any metatable magic on the pandoc module itself, so iterating over the module table should give us all objects. As BPJ points out, some functions are actually callable tables, so we have to check for those. Also, the three objects 'Block', 'Inline', and 'MetaValue' are callable, but always lead to errors when called. Therefore, the following code should print all the names we are after: local dont_call = pandoc.List{'Block', 'Inline', 'MetaValue'} for k, v in pairs(pandoc) do if not dont_call:includes(k) and (type(v) == 'function' or getmetatable(v) and getmetatable(v).__call) then print(k) end end The refactored Lua subsystem that I'm working on will do away with these silly inconsistencies -- just testing if an object has type "function" will be enough. > On Tuesday, May 11, 2021 at 4:21:47 AM UTC-4 BP wrote: > >> Den tis 11 maj 2021 01:16Norman Ramsey skrev: >> >>> I've recently discovered `luacheck`, a fantastic static-analysis tool for >>> Lua programs. I'd like to use it with my Pandoc filters, but it needs a >>> configuration to tell it what functions in the global `pandoc` table are OK >>> to call. If anybody happens to have made such a configuration, please let >>> us know. >> >> >> I guess the fact that most of the constructors in the pandoc library are >> actually callable objects rather than functions may be a problem one way or >> another. -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124