Index: code-docs/pollen.scrbl ================================================================== --- code-docs/pollen.scrbl +++ code-docs/pollen.scrbl @@ -146,10 +146,16 @@ folder names. It is assumed that the image is located inside an @racket[images-folder] within the same folder as the source document. For web output, using @racket[figure-@2x] will produce an image hard-coded to display at half its actual size, or the width of the text block, whichever is smaller. + +@defproc[(image-link [image-file string?] [link-text xexpr?] ...) txexpr?] + +Adds a hyperlink to @racket[_image-file], supplied as a filename only with no folder names. It is +assumed that the image is located inside an @racket[images-folder] within the same folder as the +source document. @deftogether[(@defproc[(fn [fn-id stringish?]) txexpr?] @defproc[(fndef [fn-id stringish?] [elements xexpr?] ...) txexpr?])] As with hyperlinks, footnotes are specified reference-style. In the output, footnotes will be Index: pollen.rkt ================================================================== --- pollen.rkt +++ pollen.rkt @@ -97,10 +97,11 @@ (poly-branch-tag dialogue) (poly-branch-tag say) (poly-branch-kwargs-tag index) (poly-branch-tag figure) (poly-branch-tag figure-@2x) +(poly-branch-tag image-link) (poly-branch-kwargs-tag blockcode) (poly-branch-kwargs-tag verse) ; [#:title ""] [#:italic "no"] (poly-branch-tag link) (poly-branch-tag url) Index: tags-html.rkt ================================================================== --- tags-html.rkt +++ tags-html.rkt @@ -63,10 +63,11 @@ html-block html-blockcode html-index html-figure html-figure-@2x + html-image-link html-dialogue html-say html-verse html-link html-url @@ -155,10 +156,16 @@ (define alt-text (tx-strs `(span ,@(cdr elems)))) `(figure [[class "fullwidth"]] (img [[alt ,alt-text] [src ,src]]) (figcaption ,@(cdr elems)))) +;; Simple link to an image +(define (html-image-link . elems) + (define src (image-source (car elems))) + (define title (tx-strs `(span ,@(cdr elems)))) + `(a [[href ,(string-append web-root src)] [title ,title]] ,@(cdr elems))) + ;; There is no way in vanilla CSS to create a selector for “p tags that contain ;; a span of class ‘newthought’”. So we can handle it at the Pollen processing level. (define (detect-newthoughts block-xpr) (define (is-newthought? tx) ; Helper function (and (txexpr? tx)