From a2a155c785cdf43c971b88db174c33ac1e867da3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 27 May 2026 15:21:45 -0500 Subject: feat(render): render issue titles and the view name verbatim The buffer should mirror Linear: a value on the page appears exactly as Linear stores it, so the heading title matches what you'd see opening the issue in Linear itself. I flipped pearl-title-case-headings to default nil so titles render verbatim. I also stopped running the view name in the #+title through the title-caser, which was coupled to the same flag. The smart-title-case path stays as opt-in tidying for anyone who wants it. Two transformations remain, both forced by Org's syntax rather than chosen: state names become TODO keywords (Org keywords can't contain spaces, so the real name stays in the LINEAR-STATE-NAME drawer), and descriptions and comments convert between Markdown and Org. Documented under "Fidelity to Linear" in the README. --- tests/test-pearl-format.el | 6 +++--- tests/test-pearl-heading.el | 14 ++++++++++++-- tests/test-pearl-output.el | 7 ++++--- tests/test-pearl-save.el | 4 ++++ 4 files changed, 23 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/test-pearl-format.el b/tests/test-pearl-format.el index 1119734..53af2e7 100644 --- a/tests/test-pearl-format.el +++ b/tests/test-pearl-format.el @@ -113,12 +113,12 @@ so these tests no longer need a state mapping bound." (let ((out (pearl--format-issue-as-org-entry '(:id "u" :identifier "ENG-1" :title "Fix [URGENT] bug" :priority 1 :state (:name "Todo"))))) - (should (string-match-p "^\\*\\* TODO \\[#A\\] ENG-1: Fix URGENT Bug$" out)) - ;; the title provenance hash is of the displayed (stripped + cased) title + (should (string-match-p "^\\*\\* TODO \\[#A\\] ENG-1: Fix URGENT bug$" out)) + ;; the title provenance hash is of the displayed (stripped, verbatim) title ;; without the identifier prefix, so a later no-op title sync matches the ;; heading and never clobbers brackets or pushes the prefix (should (string-match-p - (format "^:LINEAR-TITLE-SHA256: +%s$" (secure-hash 'sha256 "Fix URGENT Bug")) + (format "^:LINEAR-TITLE-SHA256: +%s$" (secure-hash 'sha256 "Fix URGENT bug")) out))))) ;;; build-org-content diff --git a/tests/test-pearl-heading.el b/tests/test-pearl-heading.el index 2675518..a780143 100644 --- a/tests/test-pearl-heading.el +++ b/tests/test-pearl-heading.el @@ -82,8 +82,18 @@ ;;; rendering on / off -(ert-deftest test-pearl-format-heading-defaults-prefix-and-title-case () - "By default the heading carries the identifier prefix and a title-cased title." +(ert-deftest test-pearl-format-heading-default-prefix-verbatim-title () + "By default the heading carries the identifier prefix and the verbatim title, +matching Linear's own capitalization." + (let ((pearl-show-identifier-in-heading t) + (pearl-title-case-headings nil)) + (let ((out (pearl--format-issue-as-org-entry + '(:id "u" :identifier "SE-401" :title "fix the refresh bug" + :priority 2 :state (:name "Todo"))))) + (should (string-match-p "^\\*\\* TODO \\[#B\\] SE-401: fix the refresh bug$" out))))) + +(ert-deftest test-pearl-format-heading-title-case-opt-in () + "With title-casing opted in, the title is smart-cased; the prefix is unaffected." (let ((pearl-show-identifier-in-heading t) (pearl-title-case-headings t)) (let ((out (pearl--format-issue-as-org-entry diff --git a/tests/test-pearl-output.el b/tests/test-pearl-output.el index 58cd446..a838bfb 100644 --- a/tests/test-pearl-output.el +++ b/tests/test-pearl-output.el @@ -68,12 +68,13 @@ (should (string-match-p "^#\\+title:" out)) (should-not (string-match-p "^\\*\\*\\* " out)))) -(ert-deftest test-pearl-build-org-content-title-cases-view-name () - "The view name in the file title is title-cased when title-casing is on, raw when off." +(ert-deftest test-pearl-build-org-content-title-uses-view-name-verbatim () + "The view name in the file title matches Linear's capitalization verbatim, +independent of `pearl-title-case-headings' (which governs issue headings only)." (let ((case-fold-search nil) ; strict so casing actually matters (source '(:type filter :name "my open bugs" :filter nil))) (let ((pearl-title-case-headings t)) - (should (string-match-p "^#\\+title: Linear — My Open Bugs$" + (should (string-match-p "^#\\+title: Linear — my open bugs$" (pearl--build-org-content '() source)))) (let ((pearl-title-case-headings nil)) (should (string-match-p "^#\\+title: Linear — my open bugs$" diff --git a/tests/test-pearl-save.el b/tests/test-pearl-save.el index 90e55cd..2f7b312 100644 --- a/tests/test-pearl-save.el +++ b/tests/test-pearl-save.el @@ -43,7 +43,11 @@ ;; `org-entry-put', which in batch makes the cache reconcile pathologically ;; (seconds per call). Disabling it keeps the suite fast and deterministic; ;; production never touches this binding. + ;; Title-case the rendered heading so these save-path tests can search for the + ;; cased title; the save logic hashes the rendered form regardless of casing, + ;; so the opt-in binding doesn't change what's under test. `(let ((pearl-comment-sort-order 'newest-first) + (pearl-title-case-headings t) (org-element-use-cache nil)) (with-temp-buffer (insert (pearl--format-issue-as-org-entry ,issue)) -- cgit v1.2.3