From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id qJ2gN+111GEmMgAAgWs5BA (envelope-from ) for ; Tue, 04 Jan 2022 17:29:33 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id QEsINe111GGAeAAA9RJhRA (envelope-from ) for ; Tue, 04 Jan 2022 17:29:33 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 97EE132F50 for ; Tue, 4 Jan 2022 17:29:33 +0100 (CET) Received: from localhost ([::1]:47070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4mgl-0000Mx-On for larch@yhetil.org; Tue, 04 Jan 2022 11:29:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4mgA-0000Kt-Cw for emacs-orgmode@gnu.org; Tue, 04 Jan 2022 11:28:54 -0500 Received: from gproxy4-pub.mail.unifiedlayer.com ([69.89.23.142]:51039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4mg7-0003g2-Mx for emacs-orgmode@gnu.org; Tue, 04 Jan 2022 11:28:54 -0500 Received: from cmgw12.mail.unifiedlayer.com (unknown [10.0.90.127]) by progateway6.mail.pro1.eigbox.com (Postfix) with ESMTP id CB6F610044F56 for ; Tue, 4 Jan 2022 16:28:38 +0000 (UTC) Received: from box2035.bluehost.com ([74.220.219.237]) by cmsmtp with ESMTP id 4mfunaU3eXOyf4mfunW6Pn; Tue, 04 Jan 2022 16:28:38 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=Ot6Kdwzt c=1 sm=1 tr=0 ts=61d475b6 a=VozZY++RX3oc2UgfNhVfaA==:117 a=VozZY++RX3oc2UgfNhVfaA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10:nop_charset_1 a=MKtGQD3n3ToA:10:nop_fastflux_from_domain_1 a=1oJP67jkp3AA:10:nop_fastflux_mid_domain_1 a=DghFqjY3_ZEA:10:nop_rcvd_month_year a=DPR-AOO6AYYA:10:endurance_base64_authed_username_1 a=A2tt7buDTgEA:10:from_fastflux_domain1 a=ZZnuYtJkoWoA:10:nop_header_rescan a=uChsZFC9AAAA:8 a=o9zw6IYYAAAA:8 a=D7NL1tYNveYR507HqOIA:9 a=QEXdDO2ut3YA:10:nop_charset_2 a=-FEs8UIgK8oA:10:nop_fastflux_domain_1 a=NWVoK91CQyQA:10:nop_rescan a=ULtXvzFHYWHLyBAuiDia:22 a=BtxB1_lq3pBo68oZtZ_9:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tsdye.online; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:In-reply-to:Subject:To:From:References:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Nsj7b+0IixnzN4NjeGrXIQ1zM8ri09xBEaDXLv6gZLE=; b=V8wPDrGPGcC3reab6fz5yqxyCr BXmCgjvkPVaPBYWhoaRGIXolAFaC6DsgT2BXYY2+K32kDu7K9yoePMwKYPTX9bmXwAgbnjncjw/1a ih+ZtVkylXG16/9voLyDb9lwgTQtGbeGKHtLXxGwOlNuiOi05VMQV77OK5M/A6tyM+Vx1mXci9DRk 8LHQTaFPgtsTPoIPSuYx/ivGwWeFXZjOZ4Vkq/mPbfplrBcYk+j9HGT5/AMEt231VN2LsbDweX8il DcyZnSf+qn29ECjWwQJYGOd+UOtoO3EKjXOhlSRr6T2Dh9Bk9XbaWEZiJ1akszj7MH6/HORmnh4Uc FTFDP7jQ==; Received: from cpe-50-113-36-248.hawaii.res.rr.com ([50.113.36.248]:52948 helo=poto-foou.tsdye.online) by box2035.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n4mfu-003pZB-6F for emacs-orgmode@gnu.org; Tue, 04 Jan 2022 09:28:38 -0700 References: <875yqzu7rx.fsf@posteo.net> User-agent: mu4e 1.2.0; emacs 27.1 From: "Thomas S. Dye" To: emacs-orgmode@gnu.org Subject: Re: A simple Lua filter for Pandoc In-reply-to: <875yqzu7rx.fsf@posteo.net> Date: Tue, 04 Jan 2022 06:28:36 -1000 Message-ID: <8735m3a2iz.fsf@tsdye.online> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box2035.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tsdye.online X-BWhitelist: no X-Source-IP: 50.113.36.248 X-Source-L: No X-Exim-ID: 1n4mfu-003pZB-6F X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-50-113-36-248.hawaii.res.rr.com (poto-foou.tsdye.online) [50.113.36.248]:52948 X-Source-Auth: tsd@tsdye.online X-Email-Count: 1 X-Source-Cap: dHNkeWVvbmw7dHNkeWVvbmw7Ym94MjAzNS5ibHVlaG9zdC5jb20= X-Local-Domain: yes Received-SPF: pass client-ip=69.89.23.142; envelope-from=tsd@tsdye.online; helo=gproxy4-pub.mail.unifiedlayer.com X-Spam_score_int: 23 X-Spam_score: 2.3 X-Spam_bar: ++ X-Spam_report: (2.3 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641313773; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Nsj7b+0IixnzN4NjeGrXIQ1zM8ri09xBEaDXLv6gZLE=; b=F9H5BdSrauZ7sj9hYCPVbAV5PcihxXKisjMTf3RkkyxgINADXqJj+pMGkzfchn0X3WRgx7 yVI8VEI0bNi0Xxb3gTy4CoZZgQ9G3LPpJx7FiuhoQjlmbiNbrYKmyRBxF01WMFRBg5GXLn oX8hU2boHfv1uiZIbVggwIpuA97m+2olwfkBpyCz/y0064S3lE7W7Y/bvWfHfle7ncxqrB k2IKgszoV7lnkaF7GytxRouvYjKIl5GCY9GDughnz3uJtT/7o0ehQXXJVwRqDbHUYctEJR bt5SP3IoW7Adcp5eUjuFYST3LB7zyLJYkcSBrG4UhvljZSv+ioGC+i30c9R3Aw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641313773; a=rsa-sha256; cv=none; b=QqXHwQHcGXabsHh5z0b8NqFMWAOzxGsWfg0knRUAKB2TrivvfGfdRqCH+VyPA1u5+CmZWh qCijLZdC5x4CJFij5v1eWUD7YbFoAa2PNdvF12VPSoBFigRABjVqG5qqUWQ1OaUcYLEGuT XXOs9CgGwdMDGsNuEdsddXXMJ26w7D3hWIa+rvzLyvBqHpN9NH3AQ9wEd7T91aN/GpWxjK etzQ0WFdTr2C2vVG+Sa1+8H+bqYztC1urgazqyqHiaKhAqANoglJhBpLY/x70z5WoKTqwk BA3uw/N6APaOvkF/OhjJby67spI6d7nkNxf9tsW4Q1BkWHmS28XVoqjE1DwIVg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tsdye.online header.s=default header.b=V8wPDrGP; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.09 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tsdye.online header.s=default header.b=V8wPDrGP; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 97EE132F50 X-Spam-Score: -2.09 X-Migadu-Scanner: scn1.migadu.com X-TUID: dUCyV67b5xnG Juan Manuel Mac=C3=ADas writes: > Hi, > > Very often I need to convert docx documents to Org. There are a=20 > series > of characters that I prefer to be passed to Org as Org entities=20 > and not > literally, so I have written this little filter in Lua for=20 > Pandoc. I > share it here in case it could be useful to someone. Of course,=20 > the > associative table can be expanded with more replacement cases: > > #+begin_src lua :tangle entities.lua > local chars =3D {["/"] =3D "\\slash{}", ["*"] =3D "\\lowast{}",=20 > ["<"] =3D "\\lt{}", > [">"] =3D "\\gt{}", ["=E2=80=A0"] =3D "\\dagger{}", [utf8.char(0x00A0)= ]=20 > =3D "\\nbsp{}"} > > function Str (elem) > x =3D elem.text:match 'http[^%s]' > if not x then > for i in pairs(chars) do > elem =3D pandoc.Str(elem.text:gsub (i, chars[i])) > end > return elem > end > end > #+end_src Neat! Converting Word documents is no fun at all. BTW, Babel support for Lua isn't very good AFAICT. I poked around=20 ob-lua.el recently and concluded that one problem is that the Lua=20 interpreter prints pointers for some data types instead of a=20 human-readable form that might be parsed. All the best, Tom --=20 Thomas S. Dye https://tsdye.online/tsdye