This commit is contained in:
2026-03-10 14:30:29 -06:00
parent e20dcf591d
commit a35453c2be
4 changed files with 81 additions and 48 deletions

View File

@@ -49,3 +49,26 @@
first-paragraph-belongs-to-first-section?))
(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")
(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")
(sp/must :children)
#(sut/of-type? % "latex-environment")]
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?)))
(t/testing "paragraph surrounding latex"
(t/is (->> (parse-resource "paragraph-surrounding-latex.org")
first-paragraph-has-latex?))))

View File

@@ -0,0 +1,7 @@
#+title: paragraph ending with latex
here is the paragraph,
\begin{align*}
\text{and here} &
\\ & \text{is the \LaTeX}
\end{align*}

View File

@@ -0,0 +1,7 @@
#+title: paragraph surrounding latex
first part of paragraph
\begin{equation*}
\text{some \LaTeX \}:)}
\end{equation*}
last part of paragraph