This commit is contained in:
@@ -57,28 +57,31 @@
|
||||
())
|
||||
|
||||
(defn- paragraph-ends-with-latex? [doc]
|
||||
(-> (sp/select-first [(walk-types "paragraph")
|
||||
(sp/must :children)
|
||||
sp/LAST]
|
||||
doc)
|
||||
(sut/of-type? "latex-environment")))
|
||||
(let [type (-> (sp/select-first [(walk-types "paragraph")
|
||||
(sp/must :children)
|
||||
sp/LAST]
|
||||
doc)
|
||||
sut/type)]
|
||||
(t/is type "latex-environment")))
|
||||
|
||||
(defn- paragraph-has-latex? [doc]
|
||||
(sp/select-first [(walk-types "paragraph")
|
||||
(sp/must :children)
|
||||
sp/ALL
|
||||
#(sut/of-type? % "latex-environment")]
|
||||
doc))
|
||||
(t/is (sp/select-first [(walk-types "paragraph")
|
||||
(sp/must :children)
|
||||
sp/ALL
|
||||
#(sut/of-type? % "latex-environment")]
|
||||
doc)))
|
||||
|
||||
(defn- paragraph-has-multiple-latex? [doc]
|
||||
(let [[interleaved fenceposted]
|
||||
(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)]))
|
||||
(let [paragraphs (sp/select (walk-types "paragraph") doc)]
|
||||
(t/is (= 2 (count paragraphs)))
|
||||
(let [[p₁ p₂] paragraphs]
|
||||
(t/are [p ts] (= ts
|
||||
(sp/select [(sp/must :children)
|
||||
sp/ALL (sp/view sut/type)] p))
|
||||
p₁ ["text" "latex-environment"
|
||||
"text" "latex-environment"]
|
||||
p₂ ["text" "latex-environment"
|
||||
"text" "latex-environment" "text"]))))
|
||||
|
||||
(t/deftest paragraph-separation
|
||||
(t/testing "paragraph ending with latex"
|
||||
@@ -88,5 +91,5 @@
|
||||
(-> (parse-resource "paragraph-surrounding-latex.org")
|
||||
paragraph-has-latex?))
|
||||
(t/testing "paragraph with interleaved latex"
|
||||
(let [(parse-resource "paragraph-with-multiple-latex.org")])
|
||||
(t/is (-))))
|
||||
(-> (parse-resource "paragraph-with-multiple-latex.org")
|
||||
paragraph-has-multiple-latex?)))
|
||||
|
||||
Reference in New Issue
Block a user