This commit is contained in:
@@ -239,13 +239,13 @@
|
|||||||
rest)]
|
rest)]
|
||||||
(assoc node :children new-children)))
|
(assoc node :children new-children)))
|
||||||
|
|
||||||
(defn separated-by-explicit-paragraph-break?
|
(defn consequtive-elements?
|
||||||
"Returh truthy if each successive pair of elements is separated by
|
"Returh truthy if each successive pair of elements is NOT separated
|
||||||
at least one explicit paragraph break; i.e. a blank line."
|
by at least one explicit paragraph break; i.e. a blank line."
|
||||||
[& elements]
|
[& elements]
|
||||||
(match elements
|
(match elements
|
||||||
[e₁ e₂ & es]
|
[e₁ e₂ & es]
|
||||||
(and (< (-> e₁ :position :end :line)
|
(and (= (-> e₁ :position :end :line)
|
||||||
(-> e₂ :position :start :line))
|
(-> e₂ :position :start :line))
|
||||||
(recur es))
|
(recur es))
|
||||||
:else true))
|
:else true))
|
||||||
|
|||||||
@@ -79,6 +79,22 @@
|
|||||||
(t/is (= ts (sp/select [(sp/must :children)
|
(t/is (= ts (sp/select [(sp/must :children)
|
||||||
sp/ALL (sp/view sut/type)] p)))))))
|
sp/ALL (sp/view sut/type)] p)))))))
|
||||||
|
|
||||||
|
(defn- paragraph-has-separate-latex? [doc]
|
||||||
|
(let [cs (sp/select [(walk-types "section")
|
||||||
|
(sp/must :children)
|
||||||
|
sp/ALL
|
||||||
|
(sp/view sut/type)]
|
||||||
|
doc)]
|
||||||
|
(t/is (= cs ["paragraph" "latex-environment"]))))
|
||||||
|
|
||||||
|
(defn- paragraph-surrounding-separate-latex? [doc]
|
||||||
|
(let [cs (sp/select [(walk-types "section")
|
||||||
|
(sp/must :children)
|
||||||
|
sp/ALL
|
||||||
|
(sp/view sut/type)]
|
||||||
|
doc)]
|
||||||
|
(t/is (= cs ["paragraph" "latex-environment" "paragraph"]))))
|
||||||
|
|
||||||
(t/deftest paragraph-separation
|
(t/deftest paragraph-separation
|
||||||
(t/testing "paragraph ending with latex"
|
(t/testing "paragraph ending with latex"
|
||||||
(-> (parse-resource "paragraph-ending-with-latex.org")
|
(-> (parse-resource "paragraph-ending-with-latex.org")
|
||||||
@@ -88,4 +104,10 @@
|
|||||||
paragraph-has-latex?))
|
paragraph-has-latex?))
|
||||||
(t/testing "paragraph with interleaved latex"
|
(t/testing "paragraph with interleaved latex"
|
||||||
(-> (parse-resource "paragraph-with-multiple-latex.org")
|
(-> (parse-resource "paragraph-with-multiple-latex.org")
|
||||||
paragraph-has-multiple-latex?)))
|
paragraph-has-multiple-latex?))
|
||||||
|
(t/testing "paragraph with separate latex"
|
||||||
|
(-> (parse-resource "paragraph-with-separate-latex.org")
|
||||||
|
paragraph-has-separate-latex?))
|
||||||
|
(t/testing "paragraphs surrounding separate latex"
|
||||||
|
(-> (parse-resource "paragraph-surrounding-separate-latex.org")
|
||||||
|
paragraph-surrounding-separate-latex?)))
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#+title: paragraphs surrounding separate latex
|
||||||
|
|
||||||
|
a paragraph!
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\text{and now, an unrelated latex fragment}
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
more unrelated text
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#+title: paragraph with separate latex
|
||||||
|
|
||||||
|
a paragraph!
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\text{and now, an unrelated latex fragment}
|
||||||
|
\end{gather*}
|
||||||
Reference in New Issue
Block a user