From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id aMmAGzk6imXAGwEAkFu2QA (envelope-from ) for ; Tue, 26 Dec 2023 03:28:09 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id uJXcFjk6imWYQwEA62LTzQ (envelope-from ) for ; Tue, 26 Dec 2023 03:28:09 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1703557689; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=Xu3f/5u7a+RaBwSLVEW4RcHHvgxu/7snP5AP+U6Gm4U=; b=YPZKDdg7TwLLPRoTLh/FmzvcxF4LsGkbtMxOSxh3+/ubnrt1z/6r/AKn60rQiGqZkcDqWT VMQAybdxA75SArMwg8tmG0I1KFKpcQRDag5g4JMfjvuBfBPzJKfF0MQr2CbVyYOTixSnFg iF7IBdor69xAgHLHJBBlGcIfyTca06ETfuFRENB/VIPxoYOsNyXknDJ0gDDtBefsZqqdZV 3uJKZKhyLzEIO7HAfrUUS1JY50OSzPc+fmOUwDwDgRp+FTWxes+O1KUgo9rHbpJyTiiYoR jZuxaYc9Oq5N8Kr/CwvxZkySmy06qpi5n9eezWWAhvqdCItFA6AEUeK6129e7A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1703557689; a=rsa-sha256; cv=none; b=ryun0OaGb6CTknsVnqIdnD9Pqc8h/XXkM69mGhD3VN7TvY8aU4g9yI8JKXtOMTrSaH94M3 wQsRQPDK1q1AW3PCCvi4qIZVZ58i4pHbM8Z9U/4+A9u2yI7a1tCyIWspt+Vdo87OeQWtFH anTKGqmmV7fVktoaiVM5xHMedKL+lv8ffG3BRXtfeeQkzXJqagMH6r7bo2QIAnf7xI0894 afEKE/ZsemtsV008tjgUMX3MQOCgiCPlIL1HrNtHk9Mqnw5q/3JwPTBOqbpNWUGTrEYd9Q BcBdAO81Wec7RB+6z12wKtQzQavi6s9qEV1kxAGapADP+2QjN6iZEf+W/pHlUA== 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 CB56C34835 for ; Tue, 26 Dec 2023 03:28:08 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rHx9j-0007wC-S1; Mon, 25 Dec 2023 21:26:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rHx9h-0007ta-4K for emacs-orgmode@gnu.org; Mon, 25 Dec 2023 21:26:53 -0500 Received: from phubs.tethera.net ([192.99.9.157]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rHx9e-0000a2-Sd for emacs-orgmode@gnu.org; Mon, 25 Dec 2023 21:26:52 -0500 Received: from tethera.net (node-1w7jr9sq6r285hb4jzty0djso.ipv6.telus.net [IPv6:2001:569:bbf1:a00:6170:61c6:96ed:fd78]) by phubs.tethera.net (Postfix) with ESMTPS id 70794180066; Mon, 25 Dec 2023 22:26:47 -0400 (AST) Received: (nullmailer pid 1480061 invoked by uid 1000); Tue, 26 Dec 2023 02:26:45 -0000 From: David Bremner To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: custom function for org-babel src block export In-Reply-To: <877cl2lzcz.fsf@localhost> References: <87r0jagdg1.fsf@tethera.net> <877cl2lzcz.fsf@localhost> Date: Mon, 25 Dec 2023 18:26:45 -0800 Message-ID: <87jzp1hf6i.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=192.99.9.157; envelope-from=david@tethera.net; helo=phubs.tethera.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.62 X-Spam-Score: -3.62 X-Migadu-Queue-Id: CB56C34835 X-Migadu-Scanner: mx10.migadu.com X-TUID: 8iEleLGUIHAF Ihor Radchenko writes: > David Bremner writes: > >> I am generating slides using org-beamer. I would like certain code >> blocks to export as links containing URL-encoded content of the >> block. > > Check out https://orgmode.org/manual/Advanced-Export-Configuration.html > You may use export filter or extend ox-beamer backend, creating a new > custom backend that will export your code blocks as desired. > Thanks for the suggestion(s). I tried defining org-export-filter-src-block-functions (see end) but I encountered two issues 1) The text already includes the latex environment (in my case listings). This is solvable, but did make me wonder if I was using the right filter. 2) I could not figure out how to cleanly access the source language (e.g. "stacker" in my example). It didn't seem to be in "info". I guess I can recover it from the text using e.g. regex, but this seems fragile, since it would break when switching backends. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun db-ox-src-filter (text backend info) (when (org-export-derived-backend-p backend 'latex) (db-stacker-link text))) (add-to-list 'org-export-filter-src-block-functions #'db-ox-src-filter)