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