All checks were successful
build / build (push) Successful in 1m1s

This commit is contained in:
2026-03-10 14:37:34 -06:00
parent a35453c2be
commit 777968cac5
2 changed files with 24 additions and 8 deletions

View File

@@ -50,25 +50,31 @@
(t/is (not (-> (parse-resource "first-paragraph-under-heading.org")
first-paragraph-belongs-to-first-section?)))))
(defn- first-paragraph-ends-with-latex? [doc]
(-> (sp/select-first [sut/postorder-walker
#(sut/of-type? % "paragraph")
(defn walk-types [type & types]
[sut/postorder-walker #(apply sut/of-type? % type types)])
(defn- paragraph-ends-with-latex? [doc]
(-> (sp/select-first [(walk-types "paragraph")
(sp/must :children)
sp/LAST]
doc)
(sut/of-type? "latex-environment")))
(defn- first-paragraph-has-latex? [doc]
(sp/select-first [sut/postorder-walker
#(sut/of-type? % "paragraph")
(defn- paragraph-has-latex? [doc]
(sp/select-first [(walk-types "paragraph")
(sp/must :children)
sp/ALL
#(sut/of-type? % "latex-environment")]
doc))
(defn- paragraph-has-multiple-latex? [doc]
(sp/select-first [(walk-types "paragraph") (sp/must :children)]
doc))
(t/deftest paragraph-separation
(t/testing "paragraph ending with latex"
(t/is (->> (parse-resource "paragraph-ending-with-latex.org")
first-paragraph-ends-with-latex?)))
paragraph-ends-with-latex?)))
(t/testing "paragraph surrounding latex"
(t/is (->> (parse-resource "paragraph-surrounding-latex.org")
first-paragraph-has-latex?))))
paragraph-has-latex?))))

View File

@@ -0,0 +1,10 @@
#+title: paragraph with multiple latex environments
first part of paragraph
\begin{equation*}
\text{first \LaTeX\ environment}
\end{equation*}
second part of paragraph
\begin{equation*}
\text{second \LaTeX\ environment}
\end{equation*}