Index: code-docs/pollen.scrbl ================================================================== --- code-docs/pollen.scrbl +++ code-docs/pollen.scrbl @@ -110,10 +110,31 @@ 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?])]{ Index: tags-html.rkt ================================================================== --- tags-html.rkt +++ tags-html.rkt @@ -244,15 +244,19 @@ [url (or (hash-ref link-urls url-ref #f) (format "Missing reference: ~a" url-ref))]) `(a [[href ,url]] ,@(get-elements tx)))] [else tx])) -;; Quick link to another article -(define (html-xref . elems) - `(a [[href ,(format "~aarticles/~a.html" web-root (first elems))] - [class "xref"]] - ,@(rest elems))) +;; 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)