From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/27484 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: Lua filter to remove captions from tables Date: Sat, 16 Jan 2021 18:05:03 +0100 Message-ID: <87czy43j9c.fsf@zeitkraut.de> References: <82e61683-5190-45c6-8420-60243cf1bee3n@googlegroups.com> <7e2c1a91-6cb1-4344-aab5-8577f1b82905n@googlegroups.com> <35c35036-590d-48d9-bddb-09e6e71b4982n@googlegroups.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="1418"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRBRVZRSAAMGQEZ2JPZFA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Jan 16 18:05:14 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lf1-f58.google.com ([209.85.167.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l0p0i-00009o-FO for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 16 Jan 2021 18:05:12 +0100 Original-Received: by mail-lf1-f58.google.com with SMTP id 25sf4622475lft.1 for ; Sat, 16 Jan 2021 09:05:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1610816712; cv=pass; d=google.com; s=arc-20160816; b=wL/Hoc5G/7eIBJ4Xl25+1ONXlDVDdfO57ZH6MoF5AuzE/+2w3SApjatE6m9Bx4DdYq MMqsbrQjOC4tj7ClVphpRaZGRKc73FZ3A7PFRLVhHMWJ5aMOYLcf5dISWfTX2o/RYmeL n4TeC33HjQXpk3MVBF80sz9D1Lt0NRolmrzRUxaikIcNIXeSw3hAFyaV4G/svTFUspin yxp4w+c/FUe/XeO/nFNZPtTgok6UJJj/7e5PMYtGLcfy4o5I1idUff4J1B3KSPKqj5zF rKllxkQ4Y992ZP9n3wrbmEe2iyCgUrRnXxf9V63FVchEBtaYeDnOw/u9ndI35fhfGREQ mMdg== 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:date:in-reply-to:subject:to:from:references :sender:dkim-signature; bh=YFGhmy2pwHndlENL+rAZ3s4LRwnHrh+nMmS9iA25MkA=; b=uQXwT9laWus4vStmtIZXt8dJrMaeEGmIixKsJb2fYAILg/80vDFIDh3V64DVhWURix ZfGT+gneXsGH2JlS86NRCKFFvbr2S1t0VLYS/yz3T+8zgZxj2b3GzA0t5lb1rJhdbfIa iLjljfROkdH0mYXoJL02nIAm/KOSQ8EycZtzJCmUTLYDuytAvWf4twlPwfObjm8WdHwG FA/7rnDC1V2tUktxW8dWq+50FnI1+yOA4XA1/Vk8eLEeNSOT4O/9NL/cRK6IVvwNhxZg iuHzOWK39+jndf6jsczhJCGveRd5OozoeyckKkvKNGDgqPEaekUoW2M4TtM3Avg9H4HL 2bng== 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:202 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:content-transfer-encoding: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=YFGhmy2pwHndlENL+rAZ3s4LRwnHrh+nMmS9iA25MkA=; b=R6qG9z2GEeFgwrYwnLbLI3sVf4Qr89BjrBk7A+iz2DfQV/ASaxukHjktsF/8tsZdHE 0BZ+0Q/5Ijj4Gjg7Y/YuolbhyOi6CaELjjep9goqPLd9++f0MTLAnBC6sjsOMsp8yV0M fpWdnEwFFe+6FLd7p+90OWu1Rox9ZIsH/5MXwl3PnlS7bv4PYgWjBVM5x2/SrDZNHjHF 7+MDn2hYGclLqwCP94ZNdrBSpXy3VIiE8Yakb5wk7oOxMmLygNYGIGn+cxq+4OJ/hkzt 5+BYjV2shQ0+1Qd3Motr/DG/ZaUNCdliDJcVjt5cWU6r2UKjzJ5TfXxVXoKzL1xNtzwj Xufw== 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:content-transfer-encoding :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=YFGhmy2pwHndlENL+rAZ3s4LRwnHrh+nMmS9iA25MkA=; b=pxEW4uqKS/cpMBzgVhBxZy8BnvxmHcYc8REYuA7YiuuY31f9zXKGyIxO8GUJW8dUoE 4W4kCJ/vZO+RYuGZga5OfrqlDOZi2iBQjFA359y/VjhHqECDruamRWItPeSYrBX2Zbt+ WkNci4gu17u9fNWyATJOZfkz5t/4JkNwBZaaohSEidLShLmPYmlGpRFMUZKCrHGYHo2s emy3+9qmdAP8NWZjbpB2prxWhsoqfY5ZnbsfkWpAsoS7dNZEMaimKGeUagzOH7Wndt8R GmrI8dAnjC0P8ipxxWGtDH21vfCwKAgA7OflKrYUsltNzsOfPLa/VE4TAlOj5syU26R0 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533QNUh+PERecsKSrS1Xm/4LnDa1BasTWZ9m9EpFgV5onfeV/4Qe RAzYVH0S0e4kX9SrOl31O5k= X-Google-Smtp-Source: ABdhPJyUX+iTBI2ToC2xqRDsn6gR+tk16Nhc0nOzriuF6T0t8SrnuB6W2og3/AGKT2pBQG0Sr/rs9A== X-Received: by 2002:a19:d3:: with SMTP id 202mr7580302lfa.570.1610816711979; Sat, 16 Jan 2021 09:05:11 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a19:c1cd:: with SMTP id r196ls135412lff.1.gmail; Sat, 16 Jan 2021 09:05:09 -0800 (PST) X-Received: by 2002:a19:f249:: with SMTP id d9mr8244394lfk.158.1610816709305; Sat, 16 Jan 2021 09:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610816709; cv=none; d=google.com; s=arc-20160816; b=xY00V08wldSi20KktaTKO9rAsz+A/nu/mKKWFCs20FANqGAOmiKzun6WssD8N/dniv ugi7EJ2n3UiS4AaNefJovKHFn83AG+cf4tuPqWzzs1koUUTzEX2C0C8ZELOGyDIRzMJE Fb6rjOV+QJ7S93rst+JIhy8atwQYoWY2FIVjZoUjYSN32U9SxiXHr1B2NRb4sFVpnqt1 xfj7ws4QZ95XWItQbJjlh8xOdVzNVxbFQXMFtEAqLjUsvWgiVKcNUopWJieoLOHHyDlG fHA/JvucBuVnqOn7k/fan+x6s4/mMf6DIAHhagADeoSPDphLFdqPQrIPQVgs5f6bHRIn IOJg== 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:date:in-reply-to :subject:to:from:references; bh=CbRHwuUVgijuqgqlzjzCsakyYWuve101TLPPRsTkMzo=; b=TWHyHLIKtLlffSmo3kfHXIot8sr70z5jzmFrbslLpKTtUmiZJMLK1g88H1NaRaIgby x1hwHMDXtIDwAgHmuHm38EaleqmTVNjnj6+w02NNVrd6pnMTjFRqioIw8RSYAJnKzEHr tWX6Gh+0v1hrevJKr1Qg/bhHeMCEjnsdr3BSuAT4JfGsskotyKPtPXh6wHFD3m6r/TvK bpj0pPvudff8wkR0Hm1zgK6+j3VSEZuwSwIRSo92sMMZBZxgmLUJlIpssPiEEB0kQVOD e3H0jut3KhaZXqR1HIKg6MyG8gs/OuVFSOD58B/fFwcNLDqvxIT5X4gCLFkJ8PMmF2P/ axmg== 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:202 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Original-Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org. [2001:67c:2050::465:202]) by gmr-mx.google.com with ESMTPS id e18si585506lfn.6.2021.01.16.09.05.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jan 2021 09:05:09 -0800 (PST) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050::465:202 as permitted sender) client-ip=2001:67c:2050::465:202; Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (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-202.mailbox.org (Postfix) with ESMTPS id 4DJ4DN3l7RzQlT4 for ; Sat, 16 Jan 2021 18:05:08 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter04.heinlein-hosting.de (spamfilter04.heinlein-hosting.de [80.241.56.122]) (amavisd-new, port 10030) with ESMTP id ENmhyXsQ7VRC for ; Sat, 16 Jan 2021 18:05:04 +0100 (CET) In-reply-to: X-Rspamd-Score: -5.96 / 15.00 / 15.00 X-Rspamd-Queue-Id: 44AB71831 X-Rspamd-UID: 2484a4 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:202 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:27484 Archived-At: I didn't test it, but I believe this should prevent the error: elem.caption =3D {long =3D {}} I feel like BPJ's version is morally correct, so I'll create a PR that would allow it. BPJ writes: > It does? I'm away from my work computer ATM so I can't test. Have you tri= ed > to just return elem without wrapping it in a table? (Not that it should > make any difference.) Also try to explicitly return nil as a fallback at > the bottom of the function, although I'm not sure that should make any > difference either. > > -- > Better --help|less than helpless > > Den l=C3=B6r 16 jan. 2021 10:24Stephan Boltzmann > skrev: > >> Thanks again for your answer. >> I'm not sure whether I understood everything correctly. >> >> if FORMAT:match 'latex' then >> function Table (elem) >> elem.caption =3D {} >> return {elem} >> end >> end >> >> Gives me an error message. >> >> BPJ schrieb am Donnerstag, 14. Januar 2021 um 23:00:07 UTC+1: >> >>> You can just return the original table having replaced the caption with >>> an empty list in place. >>> >>> >>> -- >>> Better --help|less than helpless >>> Den tors 14 jan. 2021 13:29Stephan Boltzmann >>> skrev: >>> >>>> Thanks a lot for your hint. >>>> >>>> Then I would still have to fix the return statement. >>>> >>>> BP schrieb am Donnerstag, 14. Januar 2021 um 11:43:32 UTC+1: >>>> >>>>> I think you should use `elem.caption =3D {}` >>>>> >>>>> -- >>>>> Better --help|less than helpless >>>>> >>>>> Den tors 14 jan. 2021 10:41Stephan Boltzmann >>>>> skrev: >>>>> >>>>>> Hello everybody out there using Pandoc, >>>>>> >>>>>> I would like to remove the caption from tables in PDF output and tri= ed >>>>>> a couple of things without success: >>>>>> >>>>>> if FORMAT:match 'latex' then >>>>>> function Table (elem) >>>>>> --caption =3D elem.caption >>>>>> caption =3D elem.c[2] -- caption seems to be second element >>>>>> print(pandoc.utils.stringify(caption)) >>>>>> --elem.c[2] =3D nil >>>>>> --elem.c[2] =3D pandoc.Str('Test') >>>>>> --elem.caption =3D nil >>>>>> --elem =3D nil >>>>>> --return {pandoc.Table(elem.c)} >>>>>> --return {elem} >>>>>> --elem:remove(2) >>>>>> --table.remove(elem.c,2) >>>>>> --[[ >>>>>> return { >>>>>> pandoc.Para(pandoc.Str('test')) >>>>>> } >>>>>> --]] >>>>>> return { >>>>>> --pandoc.Table(elem.caption, elem.aligns, elem.widths, >>>>>> elem.headers, elem.rows) >>>>>> } >>>>>> end >>>>>> end >>>>>> >>>>>> The main problem could actually rather be the construction of the >>>>>> table using the function pandoc.Table in the return statement: >>>>>> Could not read list: Could not get Block value: expected table, got >>>>>> 'nil' (nil) >>>>>> >>>>>> -- >>>>>> 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, se= nd >>>>>> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/pandoc-discuss/82e61683-5190-45c6-= 8420-60243cf1bee3n%40googlegroups.com >>>>>> >>>>>> . >>>>>> >>>>> -- >>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> >>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/pandoc-discuss/7e2c1a91-6cb1-4344-aa= b5-8577f1b82905n%40googlegroups.com >>>> >>>> . >>>> >>> -- >> 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/35c35036-590d-48d9-bddb= -09e6e71b4982n%40googlegroups.com >> >> . >> -- 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/87czy43j9c.fsf%40zeitkraut.de.