From 8c572ad354fa99bca4f36699638ec2c1d6bfa5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madeleine=20Sydney=20=C5=9Alaga?= Date: Thu, 19 Mar 2026 14:41:11 -0600 Subject: [PATCH] --- .../net/deertopia/doerg/tuftesque.css | 7 +++ doerg/src/net/deertopia/doerg/element.clj | 3 +- doerg/src/net/deertopia/doerg/render.clj | 2 - .../test/net/deertopia/doerg/element_test.clj | 46 ++++++++----------- ...graph-ending-in-bold-surrounding-latex.org | 7 +++ 5 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 doerg/test/net/deertopia/doerg/element_test/paragraph-ending-in-bold-surrounding-latex.org diff --git a/doerg/resources/net/deertopia/doerg/tuftesque.css b/doerg/resources/net/deertopia/doerg/tuftesque.css index 6fa781d..3291395 100644 --- a/doerg/resources/net/deertopia/doerg/tuftesque.css +++ b/doerg/resources/net/deertopia/doerg/tuftesque.css @@ -554,4 +554,11 @@ figure.fullwidth figcaption { ; align-items: center ; justify-content: center ; display: flex +; max-width: 55% +; width: 55% +} + +p > .latex-fragment.display-math +{ max-width: 100% +; width: 100% } diff --git a/doerg/src/net/deertopia/doerg/element.clj b/doerg/src/net/deertopia/doerg/element.clj index 5a06a98..c14ca51 100644 --- a/doerg/src/net/deertopia/doerg/element.clj +++ b/doerg/src/net/deertopia/doerg/element.clj @@ -243,7 +243,8 @@ "Is `e` a paragraph, and does it end with a newline?" [e] (and (of-type? e "paragraph") - (some-> e :children last :value (str/ends-with? "\n")))) + (some-> (-> e :position :end :column) + (= 1)))) (defn consequtive-elements? "Returh truthy if each successive pair of elements is NOT separated diff --git a/doerg/src/net/deertopia/doerg/render.clj b/doerg/src/net/deertopia/doerg/render.clj index c025f7a..1ec5d96 100644 --- a/doerg/src/net/deertopia/doerg/render.clj +++ b/doerg/src/net/deertopia/doerg/render.clj @@ -9,9 +9,7 @@ [net.deertopia.doerg.html :as doerg-html] [hiccup2.core :as hiccup] [clojure.pprint] - ;; #_ [net.deertopia.doerg.tex :as tex] - ;; [net.deertopia.doerg.tex.native :as tex-native] [net.deertopia.doerg.tex.temml :as tex-temml] [clojure.zip :as z] [babashka.fs :as fs])) diff --git a/doerg/test/net/deertopia/doerg/element_test.clj b/doerg/test/net/deertopia/doerg/element_test.clj index 395c2b6..c917aad 100644 --- a/doerg/test/net/deertopia/doerg/element_test.clj +++ b/doerg/test/net/deertopia/doerg/element_test.clj @@ -63,15 +63,25 @@ sp/LAST] doc) sut/type)] - (t/is type "latex-environment"))) + (t/is (= "latex-environment" type)))) (t/deftest paragraph-surrounding-latex - (let [doc (parse-resource "paragraph-surrounding-latex.org")] - (t/is (sp/select-first [(walk-types "paragraph") - (sp/must :children) - sp/ALL - #(sut/of-type? % "latex-environment")] - doc)))) + (let [doc (parse-resource "paragraph-surrounding-latex.org") + children (->> doc + (sp/select-first [(walk-types "paragraph")]) + :children + (map sut/type))] + (t/is (= ["text" "latex-environment" "text"] + children)))) + +(t/deftest paragraph-ending-in-bold-surrounding-latex + (let [doc (parse-resource "paragraph-ending-in-bold-surrounding-latex.org") + children (->> doc + (sp/select-first [(walk-types "paragraph")]) + :children + (map sut/type))] + (t/is (= ["text" "bold" "latex-environment" "text"] + children)))) (t/deftest paragraph-with-multiple-latex (let [doc (parse-resource "paragraph-with-multiple-latex.org") @@ -82,9 +92,8 @@ "text" "latex-environment"]] [p₂ ["text" "latex-environment" "text" "latex-environment" "text"]]]] - (t/is (= (sp/select [(sp/must :children) - sp/ALL (sp/view sut/type)] p) - ts)))))) + (t/is (= ts (sp/select [(sp/must :children) + sp/ALL (sp/view sut/type)] p))))))) (t/deftest paragraph-with-separate-latex (let [doc (parse-resource "paragraph-with-separate-latex.org") @@ -104,20 +113,3 @@ doc)] (t/is (= ["paragraph" "latex-environment" "paragraph"] cs)))) -#_ -(t/deftest paragraph-separation - (t/testing "paragraph ending with latex" - (-> (parse-resource "paragraph-ending-with-latex.org") - paragraph-ends-with-latex?)) - (t/testing "paragraph surrounding latex" - (-> (parse-resource "paragraph-surrounding-latex.org") - paragraph-has-latex?)) - (t/testing "paragraph with interleaved latex" - (-> (parse-resource "paragraph-with-multiple-latex.org") - 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?))) diff --git a/doerg/test/net/deertopia/doerg/element_test/paragraph-ending-in-bold-surrounding-latex.org b/doerg/test/net/deertopia/doerg/element_test/paragraph-ending-in-bold-surrounding-latex.org new file mode 100644 index 0000000..f0731d6 --- /dev/null +++ b/doerg/test/net/deertopia/doerg/element_test/paragraph-ending-in-bold-surrounding-latex.org @@ -0,0 +1,7 @@ +#+title: bold-final paragraph surrounding latex + +first part of *paragraph* +\begin{equation*} +\text{some \LaTeX \}:)} +\end{equation*} +last part of paragraph