◊(Local Yarn Code "Diff")

Differences From Artifact [9b28a908]:

To Artifact [27351ca1]:


38
39
40
41
42
43
44

45
46
47
48
49
50
51
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52







+







         attr-present?  ; Test if an attribute is present
         disposition-values
         ymd->english
         ymd->dateformat
         default-authorname
         default-title
         tx-strs
         first-words
         build-note-id
         notes->last-disposition-values
         )

(define default-authorname "Joel Dueck")

(define (default-title date)
78
79
80
81
82
83
84







85
86
87
88
89
90
91
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99







+
+
+
+
+
+
+








(define (tx-strs xpr)
  (cond
    [(txexpr? xpr) (apply string-append (map tx-strs (get-elements xpr)))]
    [(string? xpr) xpr]
    [else ""]))

(define (first-words str n)
  (define trunc
    (apply string-append
         (add-between (take (string-split str) n) " ")))
  ;; Remove trailing punctuation (commas, etc.)
  (regexp-replace #px"\\W+$" trunc ""))

(module+ test
  (require rackunit)
  (define test-metas (hash 'name "Fiver" 'size "Small"))
  (define test-attrs '([name "Hazel"] [rank "Chief"]))

  (parameterize ([current-metas test-metas])
    (check-equal? (maybe-meta 'name) "Fiver") ; present meta