Local Yarn Code

Check-in [94c49607]
Overview
Comment:Provide index entry crystallization
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 94c49607f6904a2d2e6235297b28bb1a1dfbc8406754414b429b68a7bc2daa6b
User & Date: joel on 2019-07-10 01:37:26
Other Links: manifest | tags
Context
2019-07-12
04:31
Fix SQL query for articles+notes so series filtering will work check-in: b49b65af user: joel tags: trunk
2019-07-10
01:37
Provide index entry crystallization check-in: 94c49607 user: joel tags: trunk
01:29
Make parallel processing in Pollen setup explicit check-in: 7d4de0ec user: joel tags: trunk
Changes

Modified code-docs/crystalize.scrbl from [85f11db1] to [ff8f9919].

44
45
46
47
48
49
50







51
52
53
54
55
56
57
individually to the SQLite cache. If any of the notes use the @code{#:disposition} attribute,
information about the disposition is parsed out and used in the rendering of the article.

@defproc[(crystalize-series!) void?]

Saves metas for the current series page in the SQLite cache. Meant to be called from the HTML
template for β€œSeries” pages (Pollen documents located in @racket[series-folder]).








@deftogether[(@defproc[(list/articles [type (or/c 'listing_full_html 
                                                  'listing_short_html
                                                  'listing_excerpt_html)]
                                      [#:series series (or/c string? boolean?) #t]
                                      [#:limit limit stringish? -1]
                                      [order string? "DESC"]) (listof string?)]







>
>
>
>
>
>
>







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
individually to the SQLite cache. If any of the notes use the @code{#:disposition} attribute,
information about the disposition is parsed out and used in the rendering of the article.

@defproc[(crystalize-series!) void?]

Saves metas for the current series page in the SQLite cache. Meant to be called from the HTML
template for β€œSeries” pages (Pollen documents located in @racket[series-folder]).

@defproc[(crystalize-index-entries! [pagenode pagenode?] [doc txexpr?]) void?]

Saves any @racket[index] enries entries in @racket[_doc] to the SQLite cache. 

@margin-note{This function was originally private; I provided it out only so it could be called
manually from @tt{index.html.pp}.}

@deftogether[(@defproc[(list/articles [type (or/c 'listing_full_html 
                                                  'listing_short_html
                                                  'listing_excerpt_html)]
                                      [#:series series (or/c string? boolean?) #t]
                                      [#:limit limit stringish? -1]
                                      [order string? "DESC"]) (listof string?)]

Modified crystalize.rkt from [feaffe0a] to [db2e6817].

26
27
28
29
30
31
32

33
34
35
36
37
38
39
...
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
         "dust.rkt")

;; ~~~ Provides ~~~

(provide spell-of-summoning!
         crystalize-article!
         crystalize-series!

         article-plain-title
         list/articles
         list/articles+notes
         listing<>-short/articles
         listing<>-full/articles
         listing<>-full/articles+notes
         unfence
................................................................................
;;   "entry!sub" β†’ '("entry" "sub")
;;   "entry!sub!why?!? '("entry" "sub")
(define (split-entry str)
  (define splits (string-split str "!"))
  (list (car splits)
        (cadr (append splits (list "")))))

;; (private) Save any index entries in doc to the SQLite cache
;; Sub-entries are specified by "!" in the index key
(define (crystalize-index-entries! pagenode doc)
  (define (index-entry? tx)
    (and (txexpr? tx)
         (string=? "index-link" (attr-ref tx 'class "")) ; see definition of html-index
         (attr-ref tx 'data-index-entry #f)))
  (define-values (_ entries) (splitf-txexpr doc index-entry?))







>







 







|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
...
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
         "dust.rkt")

;; ~~~ Provides ~~~

(provide spell-of-summoning!
         crystalize-article!
         crystalize-series!
         crystalize-index-entries!
         article-plain-title
         list/articles
         list/articles+notes
         listing<>-short/articles
         listing<>-full/articles
         listing<>-full/articles+notes
         unfence
................................................................................
;;   "entry!sub" β†’ '("entry" "sub")
;;   "entry!sub!why?!? '("entry" "sub")
(define (split-entry str)
  (define splits (string-split str "!"))
  (list (car splits)
        (cadr (append splits (list "")))))

;; Save any index entries in doc to the SQLite cache.
;; Sub-entries are specified by "!" in the index key
(define (crystalize-index-entries! pagenode doc)
  (define (index-entry? tx)
    (and (txexpr? tx)
         (string=? "index-link" (attr-ref tx 'class "")) ; see definition of html-index
         (attr-ref tx 'data-index-entry #f)))
  (define-values (_ entries) (splitf-txexpr doc index-entry?))