@@ -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?))))
|
||||
|
||||
@@ -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*}
|
||||
Reference in New Issue
Block a user