This commit is contained in:
@@ -239,13 +239,13 @@
|
||||
rest)]
|
||||
(assoc node :children new-children)))
|
||||
|
||||
(defn separated-by-explicit-paragraph-break?
|
||||
"Returh truthy if each successive pair of elements is separated by
|
||||
at least one explicit paragraph break; i.e. a blank line."
|
||||
(defn consequtive-elements?
|
||||
"Returh truthy if each successive pair of elements is NOT separated
|
||||
by at least one explicit paragraph break; i.e. a blank line."
|
||||
[& elements]
|
||||
(match elements
|
||||
[e₁ e₂ & es]
|
||||
(and (< (-> e₁ :position :end :line)
|
||||
(and (= (-> e₁ :position :end :line)
|
||||
(-> e₂ :position :start :line))
|
||||
(recur es))
|
||||
:else true))
|
||||
|
||||
@@ -79,6 +79,22 @@
|
||||
(t/is (= ts (sp/select [(sp/must :children)
|
||||
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/testing "paragraph ending with latex"
|
||||
(-> (parse-resource "paragraph-ending-with-latex.org")
|
||||
@@ -88,4 +104,10 @@
|
||||
paragraph-has-latex?))
|
||||
(t/testing "paragraph with interleaved latex"
|
||||
(-> (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