Overview
Comment: | Make xref tag more convenient, update code docs |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
63baf30178776666331b3248a591dd3f |
User & Date: | joel on 2020-03-31 03:49:07 |
Other Links: | manifest | tags |
Context
2020-05-04
| ||
01:43 | Don't allow unbound ids to be used as tag functions check-in: 5cdf3aa9 user: joel tags: trunk | |
2020-03-31
| ||
03:49 | Make xref tag more convenient, update code docs check-in: 63baf301 user: joel tags: trunk | |
03:45 | Move normalize func into dust.rkt check-in: dc2a4bd0 user: joel tags: trunk | |
Changes
Modified code-docs/pollen.scrbl from [d72bbc57] to [6cb4d7b6].
︙ | ︙ | |||
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | }| The @code{url} tag for a given identifier may be placed anywhere in the document, even before it is referenced. If you create a @code{link} for an identifier that has no corresponding @code{url}, a @code{"Missing reference: [link-id]"} message will be substituted for the URL. Conversely, creating a @code{url} that is never referenced will produce no output and no warnings or errors. } @deftogether[(@defproc[(figure [image-file string?] [caption xexpr?] ...) txexpr?] @defproc[(figure-@2x [image-file string?] [caption xexpr?] ...) txexpr?])]{ Insert a block-level image. The @racket[_image-file] should be supplied as a filename only, with no folder names. It is assumed that the image is located inside an @racket[images-folder] within the | > > > > > > > > > > > > > > > > > > > > > | 108 109 110 111 112 113 114 115 116 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 | }| The @code{url} tag for a given identifier may be placed anywhere in the document, even before it is referenced. If you create a @code{link} for an identifier that has no corresponding @code{url}, a @code{"Missing reference: [link-id]"} message will be substituted for the URL. Conversely, creating a @code{url} that is never referenced will produce no output and no warnings or errors. } @defproc*[([(xref [title string?]) txexpr?] [(xref [article-base string?] [element xexpr?] ...) txexpr?])]{ Hyperlink to another article within @italic{The Local Yarn} using an @racket[_article-base], which is the base filename only of an @tech{article} within @racket[articles-folder] (without the @filepath{.poly.pm} extension). If a single argument is supplied (@racket[_title]) it is typeset italicized as the link text, and its @racket[normalize]d form is used as the article base to generate the link. If more than one argument is supplied, the first is used as the article base, and the rest are used as the contents of the link. @codeblock|{ #lang pollen A link to ◊xref{My Ultimate Article} will link to “my-ultimate-article.poly.pm”. A link using ◊xref["my-ultimate-article"]{this form} goes to the same place. }| } @deftogether[(@defproc[(figure [image-file string?] [caption xexpr?] ...) txexpr?] @defproc[(figure-@2x [image-file string?] [caption xexpr?] ...) txexpr?])]{ Insert a block-level image. The @racket[_image-file] should be supplied as a filename only, with no folder names. It is assumed that the image is located inside an @racket[images-folder] within the |
︙ | ︙ |
Modified tags-html.rkt from [d3cc0047] to [3c9c01a9].
︙ | ︙ | |||
242 243 244 245 246 247 248 | (cond [(eq? (get-tag tx) 'link&) (let* ([url-ref (attr-ref tx 'ref)] [url (or (hash-ref link-urls url-ref #f) (format "Missing reference: ~a" url-ref))]) `(a [[href ,url]] ,@(get-elements tx)))] [else tx])) | | | > > > > | | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | (cond [(eq? (get-tag tx) 'link&) (let* ([url-ref (attr-ref tx 'ref)] [url (or (hash-ref link-urls url-ref #f) (format "Missing reference: ~a" url-ref))]) `(a [[href ,url]] ,@(get-elements tx)))] [else tx])) ;; Fast link to another article (define html-xref (case-lambda [(title) `(a [[href ,(format "~aarticles/~a.html" web-root (normalize title))] [class "xref"]] (i ,title))] [elems `(a [[href ,(format "~aarticles/~a.html" web-root (first elems))] [class "xref"]] ,@(rest elems))])) ;; Footnotes ;; ;; Private use: (define fn-names null) (define fn-definitions (make-hash)) (define (fn-id x) (here-id (string-append x "_fn"))) |
︙ | ︙ |