◊(Local Yarn Code "Check-in [cffdbbee]")

Overview
Comment:Make ◊index tag syntax more concise
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cffdbbee275378bfac9aa26c4e877dff676b9f7d22e41b7f8809bbc86b5ef612
User & Date: joel on 2019-05-27 21:50:39
Other Links: manifest | tags
Context
2019-06-01
20:30
Support sub-entries in keyword index. Finishes [5daecde7] check-in: d7ebf012 user: joel tags: trunk
2019-05-27
21:50
Make ◊index tag syntax more concise check-in: cffdbbee user: joel tags: trunk
20:55
Implement figure tags check-in: e5a492af user: joel tags: trunk
Changes

Modified code-docs/pollen.scrbl from [308e939b] to [6a861144].

185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214

  ◊dialogue{
    ◊say["Tavi"]{You also write fiction, or you used to. Do you still?}
    ◊say["Lorde"]{The thing is, when I write now, it comes out as songs.}
  }
}|

@defproc[(index [heading string?] [elements xexpr?] ...) txexpr?]

Creates an entry in the keyword index under @racket[_heading] that points back to this spot in the
document. If @racket[_elements] is not empty, the web edition of the document will use it as the
contents of an understated hyperlink to back to @racket[_heading] in the keyword index.

The example below will create two index entries, one under the heading “compassion” and one under
the heading “cats”:

@codeblock|{
  #lang pollen

  “I have a theory which I suspect is rather immoral,” Smiley 
  went on, more lightly. “Each of us has only a quantum of 
  ◊index["compassion"]{compassion}. That if we lavish our concern
  on every stray ◊index["cats"] cat we never get to the centre of 
  things. What do you think of it?” 
}|

@defproc[(note [#:date date-str non-empty-string?]
               [#:author author string? ""]
               [#:author-url author-url string? ""]
               [#:disposition disp-str string? ""]) txexpr?]







|

|
|
|









|
|







185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214

  ◊dialogue{
    ◊say["Tavi"]{You also write fiction, or you used to. Do you still?}
    ◊say["Lorde"]{The thing is, when I write now, it comes out as songs.}
  }
}|

@defproc[(index [#:key key string? ""] [elements xexpr?] ...) txexpr?]

Creates a bidirectional link between this spot in the document and an entry in the keyword index
under @racket[_key]. If @racket[_key] is not supplied, the string contents of @racket[_elements] are
used as the key.

The example below will create two index entries, one under the heading “compassion” and one under
the heading “cats”:

@codeblock|{
  #lang pollen

  “I have a theory which I suspect is rather immoral,” Smiley 
  went on, more lightly. “Each of us has only a quantum of 
  ◊index{compassion}. That if we lavish our concern on every
  stray ◊index[#:key "cats"]{cat} we never get to the centre of 
  things. What do you think of it?” 
}|

@defproc[(note [#:date date-str non-empty-string?]
               [#:author author string? ""]
               [#:author-url author-url string? ""]
               [#:disposition disp-str string? ""]) txexpr?]

Modified pollen.rkt from [8f82b23e] to [b942e8fa].

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
(poly-branch-tag smallcaps)
(poly-branch-tag center)
(poly-branch-tag section)
(poly-branch-tag subsection)
(poly-branch-tag code)
(poly-branch-tag dialogue)
(poly-branch-tag say)
(poly-branch-tag index)
(poly-branch-tag figure)
(poly-branch-tag figure-@2x)
(poly-branch-kwargs-tag blockcode)
(poly-branch-kwargs-tag verse)          ; [#:title ""] [#:italic "no"]

(poly-branch-tag link)
(poly-branch-tag url)







|







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
(poly-branch-tag smallcaps)
(poly-branch-tag center)
(poly-branch-tag section)
(poly-branch-tag subsection)
(poly-branch-tag code)
(poly-branch-tag dialogue)
(poly-branch-tag say)
(poly-branch-kwargs-tag index)
(poly-branch-tag figure)
(poly-branch-tag figure-@2x)
(poly-branch-kwargs-tag blockcode)
(poly-branch-kwargs-tag verse)          ; [#:title ""] [#:italic "no"]

(poly-branch-tag link)
(poly-branch-tag url)

Modified tags-html.rkt from [8147764e] to [0c6322fb].

100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115
116
117
118
119

(define (html-blockcode attrs elems)
  (define file (or (assoc 'filename attrs) ""))
  (define codeblock `(pre [[class "code"]] (code ,@elems)))
  (cond [(string>? file "") `(@ (div [[class "listing-filename"]] 128196 " " ,file) ,codeblock)]
        [else codeblock]))

(define (html-index . elems)

  `(a [[id ,(here-id (list "_idx-" (uri-encode (car elems))))]
       [href ,(string-append "/keyword-index.html#" (uri-encode (string-downcase (car elems))))]
       [data-index-entry ,(car elems)]
       [class "index-link"]]
      ,@(cdr elems)))

(define (html-say . elems)
  `(@ (dt ,(car elems) (span [[class "x"]] ": ")) (dd ,@(cdr elems))))

(define (html-verse attrs elems)
  (let* ([title  (maybe-attr 'title attrs "")]
         [italic? (assoc 'italic attrs)]







|
>
|
|
|

|







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

(define (html-blockcode attrs elems)
  (define file (or (assoc 'filename attrs) ""))
  (define codeblock `(pre [[class "code"]] (code ,@elems)))
  (cond [(string>? file "") `(@ (div [[class "listing-filename"]] 128196 " " ,file) ,codeblock)]
        [else codeblock]))

(define (html-index attrs elems)
  (define index-key (maybe-attr 'key attrs (tx-strs `(span ,@elems))))
  `(a [[id ,(here-id (list "_idx-" (uri-encode index-key)))]
       [href ,(string-append "/keyword-index.html#" (uri-encode (string-downcase index-key)))]
       [data-index-entry ,index-key]
       [class "index-link"]]
      ,@elems))

(define (html-say . elems)
  `(@ (dt ,(car elems) (span [[class "x"]] ": ")) (dd ,@(cdr elems))))

(define (html-verse attrs elems)
  (let* ([title  (maybe-attr 'title attrs "")]
         [italic? (assoc 'italic attrs)]