From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/27465 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Lua filter to convert Markdown comment Date: Thu, 14 Jan 2021 10:51:53 -0800 Message-ID: References: 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="24143"; mail-complaints-to="usenet@ciao.gmane.io" To: Peter Matulis , pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBV5FQKAAMGQELOGIUZA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jan 14 19:52:10 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qk1-f184.google.com ([209.85.222.184]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l07j8-00068x-1H for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 14 Jan 2021 19:52:10 +0100 Original-Received: by mail-qk1-f184.google.com with SMTP id g5sf5548457qke.22 for ; Thu, 14 Jan 2021 10:52:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1610650329; cv=pass; d=google.com; s=arc-20160816; b=jQ07TX9cECk0nQLty27dekNfoWMfv1xF7u36lO33PIUVz1uNYLc/k1SKqTvwxT2tMz 3PrHZjffsyf1mHl70Xg5lnM7fXMhn60frj27uEnExeS/hxcTRbseJOXXhj5AGDMreYJi L+A3PUBfCXxYPXatGPcpxQi5vJ/75cCwKUPGhex5fobV+Ukxzkoe8M0XOMjT4ZHAAryY lVtujo3578tiJjMLHHoo7O7NyRBCsU4Ow3j9arXVUofNixDAsOpD3jEnjDhDEUBxlnO6 Qwp84ATWnT4wprWTsFz4HLPBznCiTEI22rbYZ2BjKGBJ2Gmz1QrDT5Tvd5iDeiRTjYaO Vrng== 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:references:in-reply-to:subject:to:from:sender:dkim-signature; bh=2/gkodID5TLn4zoBF5Z7MJ3Ka/H+5UxTl0XWKqh7FRg=; b=li7qp5hnZvOqALBe6VyBuo9TvRXKeqJ1pEgFx9w3QjCWziiv40ZJFPzEhO4mNUKj0A XHIx5Yr45Z04Qz1B+twqyQrPQTISXvbta8EA0ojSVMzxZKhzVYZ6rLoOket1gW8ua4eZ R2Ix0XMi052W/vw1rI33IlsWGKj7ErtZTp0EuOKNzTpRti26bH7fd+5J20s61kYvfHNH bPE1DKDpcRUxtUyzR26cBVT92VhBQOxkCcmIfcCwOdOmlLraR5WWt2q0vLLC1WHgDrnA FJxD26THsn4Fi0I3HskESVk1Q8ZHy1UO46OEz2O8iPhVVy0s+qRNlDl1CMZh6+cVitFj o0Rg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=nnjqJPWC; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::633 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:subject:in-reply-to:references: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=2/gkodID5TLn4zoBF5Z7MJ3Ka/H+5UxTl0XWKqh7FRg=; b=sF6V7Fg8ucnYYUqU7n/iAIMFw/1vZPOZQnMpqsfTHhJQPOqcQeapygDshO6IkBGu5N lFZXuaN9c2cQBzC3rhE4sPW5w5YJLJcfx4dE6QKocMrfKnE45Mwj613u0ou+CVB1G83r h9E9KJ8Qk7nXfSKVLfxTo3wHizZ/xKf3loSLSGXStwLcA+P7N6pA8UQuMYkd9UzvOB5b noLKSlzcWWpzS9mCSycQT8KZz3HFQiTVUS9WXQXJTwbAQp88zbad8nVF0PxjNSCB+/n+ t/n8sYskdJHLxMV8/gBGnl/P++4/k2Z9CmM8gBLO3xtpc+BP+nz5wZOs033u6pj6zGVN GOiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:subject:in-reply-to:references :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=2/gkodID5TLn4zoBF5Z7MJ3Ka/H+5UxTl0XWKqh7FRg=; b=BqiSHCHR4yqXk+Nt4h9KjjNNx/oV9xWBZee/hL9IN9X8tmhbVQTmy4/lRtnbt4l51P q2m4ayNROxWRfa4C/+IKsv26ETUhp4dnDRWzVaGXI30icqRANBVQOnv8qaqyfu4KdUg3 4yCj73FvkosCizdu7zK6vl6izmF6RTq7LhSsumhv7LpsaxMy7fKl2UzykoVw6hpAt3cU dWbt0XsxXUKNcTxdgSC3lmybdYzfXuVkPD0ySi4fdC68iqtnKC11eufqj6N4liPEVg97 M/gNtKOkFPzFWSQA9nRN9g2KRAHsRmnJOvWZpUG7DfYQlSDy7O+M4+tUWMcqzHhu70MV Zkhw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533P7PgQFkcNyYTiBWoKGxC3qrlYiqDObAUx03bCl+MBBRa4wB+Z y6bb7ZxU8C/EPuraWagP1fE= X-Google-Smtp-Source: ABdhPJxGpbjs2W7s+LbX2YL1S8BI6ukxt0ElBoq7fryqz8MaM0XqyjWmPw0s8+N7y89ypk1Bmk66uw== X-Received: by 2002:ac8:4e39:: with SMTP id d25mr8419507qtw.266.1610650329148; Thu, 14 Jan 2021 10:52:09 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a0c:b8a7:: with SMTP id y39ls929865qvf.5.gmail; Thu, 14 Jan 2021 10:52:07 -0800 (PST) X-Received: by 2002:ad4:46a1:: with SMTP id br1mr8586066qvb.28.1610650327259; Thu, 14 Jan 2021 10:52:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610650327; cv=none; d=google.com; s=arc-20160816; b=aBMi+P9KJgSGHcZPI+dNqqsy6BwHNjw8YI5B5YMFw+quXX2nJ4ZVGXSg4BQAciTqZd w8UpbKCsWp4LU+51eXYT7mS0RHA1rVg+C0E1br2VspnFUSwm3Id9fTkWq4iEVZh+Qvh6 fRan9mTbNVWu3RMghKSJumgP4rYeNTT2/gEsMbpHCiv3KtG8q/xzDXeg7ZNO2rreVNZy uLy4d8PXtJiSwCyh58TgztS16QvBNxtoS8BV0xOJlo9Bzz9LM8bV6b/sWSm6XLFabsij i8yjCBKTtMhtx77My/DNPqbGXNZcGjCxEY4Bbu3e6VidQDU0fjvBRUTdw3JX5iA1SGDs nLVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :dkim-signature; bh=98rsgG6kC2stOG2g/Fp53rQjMPpntdLlVpiTybJYBFw=; b=XrBgDik4MaFxWq/UBd64U046vr981lv5pd0vRYxLF7xD+foJu/NbsZcFOU6OHPnNfu cK+P0BnVRhL2Z7p2B8v8IfKphyMxuTuVT14ZhmOjpkXXZ+BtDJjni2BDgbcbROXj0BfS r2DwnRWpd8iLbK48YSZp1MQVxztx0JO2Amay8k/gICtdft/yDesuUQVRisZV5Mp2Ln+A i7k+60oRUOQbDZjAR3TYIBSl0wAchIijVzXO/G5rATA4iL/ThWud0bSIBu6trSQ+sY4O vJBq99MgVbRJZVeMogx/FL2sWc/lSZQlRM5UIR9ASNXm5dy66dwRjwxoYFd118ZjTxfM vuVA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=nnjqJPWC; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::633 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com. [2607:f8b0:4864:20::633]) by gmr-mx.google.com with ESMTPS id z94si747311qtc.0.2021.01.14.10.52.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Jan 2021 10:52:07 -0800 (PST) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::633 as permitted sender) client-ip=2607:f8b0:4864:20::633; Original-Received: by mail-pl1-x633.google.com with SMTP id g3so3387445plp.2 for ; Thu, 14 Jan 2021 10:52:07 -0800 (PST) X-Received: by 2002:a17:902:302:b029:db:fa52:2dd2 with SMTP id 2-20020a1709020302b02900dbfa522dd2mr8715864pld.62.1610650326130; Thu, 14 Jan 2021 10:52:06 -0800 (PST) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id x6sm5981164pfq.57.2021.01.14.10.52.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 10:52:05 -0800 (PST) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 3C5B0A268; Thu, 14 Jan 2021 13:51:54 -0500 (EST) In-Reply-To: X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=nnjqJPWC; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::633 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@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:27465 Archived-At: What you want to do is match on a RawBlock element. Something like function RawBlock(el) if el.text:match(" > > I simply want to convert this into an actual (second-level) MD header: > > ## blah > > From what I've read, I would ideally specify an "element" that will be > acted upon, but what is a comment considered? Anyway, I think I can specify > `Pandoc` to mean "check the entire document", and that's what I've done > here (I will eventually be iterating through multiple MD files so I should > really not be doing it like this; please advise!): > > function Pandoc (value) > comment = "" > comment = comment:gsub("%<%!%-%- blah %-%-%>", "## blah") > return value > end > > I've run the main logic through Lua on the terminal and it works: > > $ lua > Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-Rio >> comment = "" >> comment = comment:gsub("%<%!%-%- blah %-%-%>", "## blah") >> print (comment) > ## blah > > But I'm failing to integrate it with Pandoc (no change is registered in > file.html). It's probably due to my misunderstanding of functions (not a > programmer!). > > TIA. > > /pm > > -- > 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/CAMxYqzEvRHcFQ1BYsFODC-Bd36%3DLfO-UKcVYPNzR8i8rDZorXw%40mail.gmail.com.