Overview
Comment: | Correct and clarify display of articles that do not specify a title. |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5b2f378acade49a90e698474ebc8f13d |
User & Date: | joel on 2018-09-23 21:57:12 |
Other Links: | manifest | tags |
Context
2018-09-26
| ||
01:00 | Additional CSS styles for block-quotes. Omit article footer tag when no footer text is present. check-in: 3911576e user: joel tags: trunk | |
2018-09-23
| ||
21:57 | Correct and clarify display of articles that do not specify a title. check-in: 5b2f378a user: joel tags: trunk | |
21:04 | Add functions for storing/reading booleans in SQLite check-in: 53e02bf3 user: joel tags: trunk | |
Changes
Modified crystalize.rkt from [2ee97a67] to [04b300fe].
︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - - + + + | ;; data; a maliciously crafted input could bomb the database. This is acceptable ;; since the database is merely a disposable cache, and since all the input ;; will be coming from me. (require pollen/setup pollen/core pollen/template |
︙ | |||
116 117 118 119 120 121 122 123 | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | + - + - + + | (define (crystalize-article! pagenode doc) (define pubdate (select-from-metas 'published (current-metas))) (define-values (body-txpr note-txprs) (doc->body/notes doc)) (define doc-html (->html (cdr body-txpr))) (define-values (disposition disp-note-id) (notes->last-disposition-values note-txprs)) (define title-specified? (non-empty-string? (maybe-meta 'title))) (define-values (title-plain title-html-flow) |
︙ | |||
152 153 154 155 156 157 158 | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | - - + + + + + + + + + | (apply query! (make-insert/replace-query 'articles table_articles-fields) article-record) ◊string-append{◊header ◊doc-html ◊notes-section-html ◊footer}) ;; ~~~ Article-related helper functions ~~~ ;; |
︙ | |||
264 265 266 267 268 269 270 | 274 275 276 277 278 279 280 281 282 283 | + + + | " AND `note_id` = ?2), ~a)") (list->sql-fields table_notes-fields) (list->sql-parameters table_notes-fields))) (apply query! save-note-query note-record) ;; return html$ of note (html$-note-in-article note-id note-date content-html author author-url)) (define (article-plain-title pagenode) (query-value (sqltools:dbc) "SELECT `title_plain` FROM `articles` WHERE `pagenode` = ?1" (symbol->string pagenode))) |
Modified dust.rkt from [9b28a908] to [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 |
︙ |
Modified sqlite-tools.rkt from [8c6dcaa3] to [8bbac284].
︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | + | racket/function racket/contract sugar/coerce) (module+ test (require rackunit)) (provide (all-from-out db/base db/sqlite3)) (provide sqltools:dbc sqltools:log-queries?) (provide (contract-out ;; Utility functions [log-query (string? . -> . void?)] |
︙ |
Modified template-html.rkt from [259532dd] to [add48486].
︙ | |||
37 38 39 40 41 42 43 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | - - + - + - + | html$-note-title html$-note-contents html$-note-listing-full html$-note-in-article html$-notes-section) (define (html$-page-head [title #f]) |
︙ |
Modified template.html.p from [b0e9b3b5] to [406d1c49].
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | + + + + - + - - + | <!DOCTYPE html> <html> ◊spell-of-summoning![] ◊(define article-html (crystalize-article! here doc)) ◊(define page-title (article-plain-title here)) |