From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/27482 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephan Boltzmann Newsgroups: gmane.text.pandoc Subject: Re: Lua filter to remove captions from tables Date: Sat, 16 Jan 2021 01:23:18 -0800 (PST) Message-ID: <35c35036-590d-48d9-bddb-09e6e71b4982n@googlegroups.com> References: <82e61683-5190-45c6-8420-60243cf1bee3n@googlegroups.com> <7e2c1a91-6cb1-4344-aab5-8577f1b82905n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1598_213283559.1610788998338" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31654"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCZ25UWY24ERBB7BRKAAMGQEFD4D2HQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Jan 16 10:23:22 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f59.google.com ([209.85.161.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l0hnm-00087R-03 for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 16 Jan 2021 10:23:22 +0100 Original-Received: by mail-oo1-f59.google.com with SMTP id f23sf7227617oov.3 for ; Sat, 16 Jan 2021 01:23:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=XS/lfjMDfOVPYuvLazkNDHQAtys3+HsS44G5SLtKzEU=; b=PYLM9wGjOehTbBh2tolgfoPHIKM54uwus8vq/kaLMIVJV5i/OHjjMGzsVDVDHmtAZo 2/2JhkqJ/sId0O1g0qx3vqgrZDCQwB1w5AEBTgjH4+K4+3IFZC7jAkxxKdle7ThEqRoz LieBrYf1IiSQO/xtCkAgvkKn70wrnDV4O6fLUJ6l84uLl9jPrUp90WaMKYwDUfPdzK2t eWma/2g5RB6trU+MRynbEd4LwKv2bSZWLBrdvS0bN5IDmiCusff0ZcEgE1VzF7oBMqA9 bdDFgw+PWSRegnC9QqMJwZLa0fndEAkEYt5WrP7LwMqCGCtWOHVlQSocpQAeaMj9NVRN h3Kw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=XS/lfjMDfOVPYuvLazkNDHQAtys3+HsS44G5SLtKzEU=; b=XI6pzQWui1keupvxXH3d+VCUYpLjEqKRaXOH0+3VqpER+jcOSEgF/ToBNnaKBJtidI UFe+nqrRUtzzgbYdJ0N3b87zFT28e1t493Drf+BsBRHfcquoA+jMnVHN6Na3RKUXPxXv 1g8mQjzFBYBWshtxrefWy0Cj4SfRUQRe+rh00K5/gQwpMISklCbN+Q7gebIdD8seZJs+ 14e06DLsj2nEJyC5pxW9/1F3ebutZtd0UEFClN0F6z0n6cefKteqVW+MkgJbrem6u4Bm 8L0cPXRHC+zs/a5VNTG6ctRTLWWXtEIEo0k2WIOZB4HHHPvVfKDCLoT6MwmtIWby5zBS wQbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=XS/lfjMDfOVPYuvLazkNDHQAtys3+HsS44G5SLtKzEU=; b=d+1O6Iy8/yBR7B3r7BDXfQ57WTDag4Y/R4uQQAp+doEsjhRGdG9SMcJjU1KE6zlZwA Nyoz6A2fptolf5jPKdEkXxJhlC04lWAvtOJpk+RTpVU311FFxp0lomUpuQEbTkfdSc4t pw1gKRPAWDGzTBQtkzKimzG2YM6akR9V4o6BwMwWD5joIlkXr4WSHxMEmoQAT5qqcwZh cFGoXOjG1kgPJwJXXxd9Kq7Rzz/EKcxMVF6jRtLYil8FtOAa/bbAgwT7msHAZsPSgxpW 0krxHlHh+J3cZZJ6FfFf16cz0XrblwYOaJUfGfABxXwtgVu4VrtL+zkIUR/+YaGcHeJf Kvdw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM530hUWLpG9kTpI/hTRy0WCIfbX1TjpZkoxlbTyHb6lOVTQik1Nev J88PD/qCBGqVv7H/eIZrVf0= X-Google-Smtp-Source: ABdhPJyqVgQbkmpF1gYyTdCIFljrampKmSbuUbyU9vt7TNGk9NWpscO8fSxjmPJ6hGNWazXnXXDKbw== X-Received: by 2002:aca:8c6:: with SMTP id 189mr3270848oii.10.1610789001017; Sat, 16 Jan 2021 01:23:21 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6830:18f1:: with SMTP id d17ls2978714otf.6.gmail; Sat, 16 Jan 2021 01:23:19 -0800 (PST) X-Received: by 2002:a05:6830:1d8b:: with SMTP id y11mr3466620oti.95.1610788999172; Sat, 16 Jan 2021 01:23:19 -0800 (PST) In-Reply-To: X-Original-Sender: stephan2boltzmann-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:27482 Archived-At: ------=_Part_1598_213283559.1610788998338 Content-Type: multipart/alternative; boundary="----=_Part_1599_1788558157.1610788998338" ------=_Part_1599_1788558157.1610788998338 Content-Type: text/plain; charset="UTF-8" Thanks again for your answer. I'm not sure whether I understood everything correctly. if FORMAT:match 'latex' then function Table (elem) elem.caption = {} 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 = {}` >>> >>> -- >>> 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 tried >>>> a couple of things without success: >>>> >>>> if FORMAT:match 'latex' then >>>> function Table (elem) >>>> --caption = elem.caption >>>> caption = elem.c[2] -- caption seems to be second element >>>> print(pandoc.utils.stringify(caption)) >>>> --elem.c[2] = nil >>>> --elem.c[2] = pandoc.Str('Test') >>>> --elem.caption = nil >>>> --elem = 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, 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/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-aab5-8577f1b82905n%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-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. ------=_Part_1599_1788558157.1610788998338 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks again for your answer.
I'm not sure whether I understood eve= rything correctly.

if FORMAT:match 'latex' then
  function Table (elem)
&= nbsp;   elem.caption =3D {}
    return {elem}  end
end

Gives me an error message.<= br>

BPJ schrieb am Donnerstag, 14. Januar 2021 um 23:00:07 UTC= +1:
You can just return the original table having replaced the captio= n with an empty list in place.


--
Better --help|less than helpless
Den tor= s 14 jan. 2021 13:29Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
Thanks a lot for your hin= t.

Then I would still have to fix the return statement.

BP schrieb am Don= nerstag, 14. Januar 2021 um 11:43:32 UTC+1:
I think you should use `elem.captio= n =3D {}`

--
Better --he= lp|less than helpless

Den tors 14 jan= . 2021 10:41Stephan Boltzmann <stephan2..= .@gmail.com> skrev:
Hello everybody out there using Pandoc,
=

I would like to remove the caption from tables in PDF o= utput and tried a couple of things without success:

if FORMAT:match 'latex' t= hen
=C2=A0 function Table (elem)
=C2=A0=C2=A0=C2=A0 --caption =3D ele= m.caption
=C2=A0=C2=A0=C2=A0 caption =3D elem.c[2] -- caption seems to b= e second element
=C2=A0=C2=A0=C2=A0 print(pandoc.utils.stringify(caption= ))
=C2=A0=C2=A0=C2=A0 --elem.c[2] =3D=C2=A0 nil
=C2=A0=C2=A0=C2=A0 --= elem.c[2] =3D=C2=A0 pandoc.Str('Test')
=C2=A0=C2=A0=C2=A0 --elem= .caption =3D=C2=A0 nil
=C2=A0=C2=A0=C2=A0 --elem =3D nil
=C2=A0=C2=A0= =C2=A0 --return {pandoc.Table(elem.c)}
=C2=A0=C2=A0=C2=A0 --return {elem= }
=C2=A0=C2=A0=C2=A0 --elem:remove(2)
=C2=A0=C2=A0=C2=A0 --table.remo= ve(elem.c,2)
--[[
=C2=A0=C2=A0=C2=A0 return {
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 pandoc.Para(pandoc.Str('test'))
=C2=A0=C2=A0=C2=A0 = }
--]]
=C2=A0=C2=A0=C2=A0 return {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = --pandoc.Table(elem.caption, elem.aligns, elem.widths, elem.headers, elem.r= ows)
=C2=A0=C2=A0=C2=A0 }
=C2=A0 end
end

The main problem coul= d 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 &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discus...@googlegr= oups.com.
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 &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to
pandoc-discus= ...@googlegroups.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/35c35036-590d-48d9-bddb-09e6e71b4982n%40googlegroups.= com.
------=_Part_1599_1788558157.1610788998338-- ------=_Part_1598_213283559.1610788998338--