From 2c755422a7831f593bd37a9934db3baf73f60df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madeleine=20Sydney=20=C5=9Alaga?= Date: Tue, 10 Mar 2026 20:28:46 -0600 Subject: [PATCH] a --- .../test/net/deertopia/doerg/element_test.clj | 24 ++++++++++++++----- .../paragraph-with-multiple-latex.org | 14 +++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/doerg/test/net/deertopia/doerg/element_test.clj b/doerg/test/net/deertopia/doerg/element_test.clj index 2c1a97b..d1288da 100644 --- a/doerg/test/net/deertopia/doerg/element_test.clj +++ b/doerg/test/net/deertopia/doerg/element_test.clj @@ -53,6 +53,9 @@ (defn walk-types [type & types] [sut/postorder-walker #(apply sut/of-type? % type types)]) +(defn headline-matches? [re] + ()) + (defn- paragraph-ends-with-latex? [doc] (-> (sp/select-first [(walk-types "paragraph") (sp/must :children) @@ -68,13 +71,22 @@ doc)) (defn- paragraph-has-multiple-latex? [doc] - (sp/select-first [(walk-types "paragraph") (sp/must :children)] - doc)) + (let [[interleaved fenceposted] + (sp/select [(walk-types "section") + (sp/must :children) + #(some-> % first (sut/of-type? "headline")) + (sp/subselect (sp/view #(drop 1 %)) + sp/ALL (sp/must :children) sp/ALL + (sp/must :type))] + doc)])) (t/deftest paragraph-separation (t/testing "paragraph ending with latex" - (t/is (->> (parse-resource "paragraph-ending-with-latex.org") - paragraph-ends-with-latex?))) + (-> (parse-resource "paragraph-ending-with-latex.org") + paragraph-ends-with-latex?)) (t/testing "paragraph surrounding latex" - (t/is (->> (parse-resource "paragraph-surrounding-latex.org") - paragraph-has-latex?)))) + (-> (parse-resource "paragraph-surrounding-latex.org") + paragraph-has-latex?)) + (t/testing "paragraph with interleaved latex" + (let [(parse-resource "paragraph-with-multiple-latex.org")]) + (t/is (-)))) diff --git a/doerg/test/net/deertopia/doerg/element_test/paragraph-with-multiple-latex.org b/doerg/test/net/deertopia/doerg/element_test/paragraph-with-multiple-latex.org index 025cdda..99b96bc 100644 --- a/doerg/test/net/deertopia/doerg/element_test/paragraph-with-multiple-latex.org +++ b/doerg/test/net/deertopia/doerg/element_test/paragraph-with-multiple-latex.org @@ -1,5 +1,7 @@ #+title: paragraph with multiple latex environments +* interleaved + first part of paragraph \begin{equation*} \text{first \LaTeX\ environment} @@ -8,3 +10,15 @@ second part of paragraph \begin{equation*} \text{second \LaTeX\ environment} \end{equation*} + +* fenceposted + +first fencepost +\begin{equation*} +\text{first fenceposted \LaTeX\ environment} +\end{equation*} +second fencepost +\begin{equation*} +\text{second fenceposted \LaTeX\ environment} +\end{equation*} +third fencepost