From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8GjQA8uWBGFxKAEAgWs5BA (envelope-from ) for ; Sat, 31 Jul 2021 02:18:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id iH4YO8qWBGFRRwAAB5/wlQ (envelope-from ) for ; Sat, 31 Jul 2021 00:18:18 +0000 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 2FE221CAAE for ; Sat, 31 Jul 2021 02:18:17 +0200 (CEST) Received: from localhost ([::1]:44196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m9chi-0000nX-U5 for larch@yhetil.org; Fri, 30 Jul 2021 20:18:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9chL-0000nH-I4 for emacs-orgmode@gnu.org; Fri, 30 Jul 2021 20:17:51 -0400 Received: from mail-vs1-xe2a.google.com ([2607:f8b0:4864:20::e2a]:44882) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m9chJ-0005Yo-Sv for emacs-orgmode@gnu.org; Fri, 30 Jul 2021 20:17:51 -0400 Received: by mail-vs1-xe2a.google.com with SMTP id t2so6337238vsa.11 for ; Fri, 30 Jul 2021 17:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=t2GG/pauRhB13w6e9i6dliDqFl7Bv8wyTec6YTy/RBU=; b=b3fIi6l9MDINi9FdhYotQPi4naUw3L16Fqutma6EJP0gq37i6FaMlnT6uYfnf870Vo h1FKyyU3BOCvrQNX0R59dixwz45J84Axp6YTEKdOzHx6nEggONYwWsRR7X2B6CrdEVzV 8leYw0NPAskV1tcg0g33i0LrydELSbHM1pk8FzCwE9SKeW42wGtXGu2lrakRqtQu+OrD 0Ygz6M3RZ1z+ig6jWnxm44nmNedvAD8XldDz/6+ZIAIg9NoRSLCV0nKANQtiCTQNQhAF NWhxpzO4vwsYtBQH8l0Lous0gl3KONs7ub3acSHqHdwhgrsicoEMEpAgtACY0buLGR0Q 5dMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=t2GG/pauRhB13w6e9i6dliDqFl7Bv8wyTec6YTy/RBU=; b=I3B30BGWsLOI8OhrI8oF8iggTXMbn9nbNNgNN//oMgxC3+xpuvn4uiMZGO7tMv8zA2 TBaU73dM18wU1vGHb8lsTR4LlFjP5CbEsQCWc7O0jTnKmpI8yItoS+SGOmQYlXp2eAx3 F+3kWf0IedQfBGPsPPUVoLxe8xUYhVSmvOTgjwIueIO/023FIWVE5PMxr2vM4mo5xy5n sZZlxhJOFEEGUNl/zAKx7BnYlR6NXEaPIrveFm///UfONeRuLeX/vphvYq+jF+zS1sPk JHztF2yjy68YKPZGf9HzT6HEeMwYMSarY+HaJ8cahp0838LVmBx1lH75nkG9jdxEPCTQ K8BQ== X-Gm-Message-State: AOAM532RhM7Kc7MH6jfq0uBdMZMw1ZVuHsc/HDuSchzqiQHaOpIndh7C BSofiyW6wiqG1hU2MfidTF5nR6Axyy2SuGBx74inrYrvirO2Vg== X-Google-Smtp-Source: ABdhPJyIGFZ0zvL2LGTi8O8se6hDNd3ep9Hsm6ux5kdM4etdGSdpVh8V65trM0nfrdx5hkfpCpwTREB9q0wdrim/AaE= X-Received: by 2002:a67:22c5:: with SMTP id i188mr4532722vsi.33.1627690668198; Fri, 30 Jul 2021 17:17:48 -0700 (PDT) MIME-Version: 1.0 From: Matt Price Date: Fri, 30 Jul 2021 20:17:37 -0400 Message-ID: Subject: add a heading w/ #+print_bibliography to parse tree on export To: Org Mode Content-Type: multipart/alternative; boundary="00000000000015263205c8604410" Received-SPF: pass client-ip=2607:f8b0:4864:20::e2a; envelope-from=moptop99@gmail.com; helo=mail-vs1-xe2a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1627690697; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=t2GG/pauRhB13w6e9i6dliDqFl7Bv8wyTec6YTy/RBU=; b=qPI+2/k2enDt0rbn99tgTV+QDbclmm6iWAxCROZijxKsyhrIezv4B6f6404yzSpte8+GAm cHtJ6sRGd0Je3TBeDWSFTghFELw3GUkpmDOKVuL4jbKVPC9rrr7Aarli51VfmSs5wfDCHW Vu3X+yk7vS5YWXfE/DJr+DKwFtgCghsAc2gOkHWpP+hQsjB6Rz5BXgXVOGdkLq36kRuj8C lWsXbf9jXO9dwAGEpViIfE8BIF644qSij7OGJOLf+QVhuw1r7HQm4xh/TCMuPHcfYGdqWy X30wUx32YBcuZ/PNj36h7v8ydudS2Vedw8Pxyo0WFX2fxxv2JTH3aRpx/QpXgQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1627690697; a=rsa-sha256; cv=none; b=mGeVUvV2vZpwZf6CfdHkJ/46aXEPasULie34IwaffkyJAeokK4Nzu+qbE2n/d0VPZYi9ZR MyEBds3Q/1hqV/Zn+oaxomuFJ4NUMAdu+oscEpuapmhKMgReQPg+hsSWhKArNi2SLQVUUC bmR3swZL2u5lM1R5QBsSCNZVC0xiNTS4yDeCa5XrbIpneMO853SnXlZUfI/djqlvfcvrKQ DqxVRFBkyEILhje8RhWsZqDy64XYErR9QQZQUmMlklE0vJDPIUw25FG9AmXi8E06MNY9bf XbMT+FtMRlVHnCmrruhb3HIUJpbfCVumG2I4mWHEksApNlmLDIWAqXOXc7drYg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=b3fIi6l9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=b3fIi6l9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2FE221CAAE X-Spam-Score: -3.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: DLukTDMs1oFB --00000000000015263205c8604410 Content-Type: text/plain; charset="UTF-8" Goal: conditionally add a headline with content to parse tree using either org-export-before-parsing-hook or org-export-filter-parse-tree-functions Explanation: I use org-re-reveal to make lecture slides from subtrees. Often I forget to add a heading with #+print_bibliography: and as a result org-cite does not generate the bibliography, and my citations are not wrapped in links. I'd like to search *either* the parse tree *or* the temporary export buffer for the #+print_bibliography keyword, and if it's not found, add a headline to the end of the subtree/parse-tree with the appropriate information. I can easily generate the proper lisp object with the org-ml package: (org-ml-build-headline :title '("Sources") (org-ml-build-section (org-ml-build-property-drawer (org-ml-build-node-property "CUSTOM_ID" "bibliography")) (org-ml-build-keyword "print_bibliography" "" ) )) And if I want I can turn that into a string by wrapping it in (org-ml-to-trimmed-string ...) However, I'm not sure how best to add it to the exported data. I believe I can add a function to either org-export-before-parsing-hook or org-export-filter-parse-tree-functions, but beyond that I'm a bit lost. It's not immediately obvious how to find the last headline and append another headline after that headline's section. Looking at the nesting confuses me somewhat and I'm afraid I'll break the data structure. Has anyone done something like this before and do you have ideas? Thank you! --00000000000015263205c8604410 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Goal:
conditionally add a headline wit= h content to parse tree using either org-export-before-parsing-hook or org-= export-filter-parse-tree-functions

Explanation:
I use org-re-reveal to make lecture slides from subtrees. Ofte= n I forget to add a heading with #+print_bibliography: and as a result org-= cite does not generate the bibliography, and my citations are not wrapped i= n links. I'd like to search *either* the parse tree=C2=A0 *or* the temp= orary export buffer for the #+print_bibliography keyword, and if it's n= ot found, add a headline to the end of the subtree/parse-tree with the appr= opriate information.=C2=A0

I can easily gener= ate the proper lisp object with the org-ml package:

(org-ml-build-headline :title '("Sources")
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(o= rg-ml-build-section
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-ml-build-property-drawer
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(org-ml-build-node-property "CUSTOM_ID" "bibliography&= quot;))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (org-ml-build-keyword "print_bibliography" &= quot;" )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 ))

And if I want I can= turn that into a string by wrapping it in (org-ml-to-trimmed-string ...)

However, I'm not sure how best to add it to the= exported data.=C2=A0 I believe I can add a function to either org-export-b= efore-parsing-hook or org-export-filter-parse-tree-functions, but beyond th= at I'm a bit lost. It's not immediately obvious how to find the las= t headline and append another headline after that headline's section. L= ooking at the nesting confuses me somewhat and I'm afraid I'll brea= k the data structure.

Has anyone done something li= ke this before and do you have ideas?

Thank you!
--00000000000015263205c8604410--