@@ -53,6 +53,9 @@
|
|||||||
(defn walk-types [type & types]
|
(defn walk-types [type & types]
|
||||||
[sut/postorder-walker #(apply sut/of-type? % type types)])
|
[sut/postorder-walker #(apply sut/of-type? % type types)])
|
||||||
|
|
||||||
|
(defn headline-matches? [re]
|
||||||
|
())
|
||||||
|
|
||||||
(defn- paragraph-ends-with-latex? [doc]
|
(defn- paragraph-ends-with-latex? [doc]
|
||||||
(-> (sp/select-first [(walk-types "paragraph")
|
(-> (sp/select-first [(walk-types "paragraph")
|
||||||
(sp/must :children)
|
(sp/must :children)
|
||||||
@@ -68,13 +71,22 @@
|
|||||||
doc))
|
doc))
|
||||||
|
|
||||||
(defn- paragraph-has-multiple-latex? [doc]
|
(defn- paragraph-has-multiple-latex? [doc]
|
||||||
(sp/select-first [(walk-types "paragraph") (sp/must :children)]
|
(let [[interleaved fenceposted]
|
||||||
doc))
|
(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/deftest paragraph-separation
|
||||||
(t/testing "paragraph ending with latex"
|
(t/testing "paragraph ending with latex"
|
||||||
(t/is (->> (parse-resource "paragraph-ending-with-latex.org")
|
(-> (parse-resource "paragraph-ending-with-latex.org")
|
||||||
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")
|
(-> (parse-resource "paragraph-surrounding-latex.org")
|
||||||
paragraph-has-latex?))))
|
paragraph-has-latex?))
|
||||||
|
(t/testing "paragraph with interleaved latex"
|
||||||
|
(let [(parse-resource "paragraph-with-multiple-latex.org")])
|
||||||
|
(t/is (-))))
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#+title: paragraph with multiple latex environments
|
#+title: paragraph with multiple latex environments
|
||||||
|
|
||||||
|
* interleaved
|
||||||
|
|
||||||
first part of paragraph
|
first part of paragraph
|
||||||
\begin{equation*}
|
\begin{equation*}
|
||||||
\text{first \LaTeX\ environment}
|
\text{first \LaTeX\ environment}
|
||||||
@@ -8,3 +10,15 @@ second part of paragraph
|
|||||||
\begin{equation*}
|
\begin{equation*}
|
||||||
\text{second \LaTeX\ environment}
|
\text{second \LaTeX\ environment}
|
||||||
\end{equation*}
|
\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
|
||||||
|
|||||||
Reference in New Issue
Block a user