@@ -37,35 +37,39 @@ functions in separate files that have separate places in the dependency chain. So if only the HTML tag functions have changed and not those for PDF, the makefile can ensure only the HTML files are rebuilt. @defproc[#:kind "syntax" - (poly-branch-tag (id symbol?)) + (poly-branch-tag (tag symbol?)) (-> txexpr?)] -Define a new tag function (using @racket[define-tag-function]) for @racket[_id], which will -automatically pass all of its attributes and elements to a tag function whose name is the value -returned by @racket[current-poly-target], followed by a hyphen, followed by @racket[_id]. So -whenever the current output format is @racket['html], the function defined by -@racket[(poly-branch-tag _p)] will branch to a function named @racket[html-p]; when the current -format is @racket['pdf], it will branch to @racket[pdf-p], and so forth. + +Defines a new function @racket[_tag] which will automatically pass all of its arguments to a +function whose name is the value returned by @racket[current-poly-target], followed by a hyphen, +followed by @racket[_tag]. So whenever the current output format is @racket['html], the function +defined by @racket[(poly-branch-tag _p)] will branch to a function named @racket[html-p]; when the +current format is @racket['pdf], it will branch to @racket[pdf-p], and so forth. You @emph{must} define these branch functions separately, and you must define one for @emph{every} output format included in the definition of @racket[poly-targets] in this file’s @racket[setup] -submodule. If you do not, you will get “unbound identifier” errors at expansion time. +submodule. If you do not, you will get “unbound identifier” errors at expansion time. The convention in this project is to define and provide these branch functions in separate files: see, e.g., @filepath{tags-html.rkt}. +Functions defined with this macro @emph{do not} accept keyword arguments. If you need keyword +arguments, see @racket[poly-branch-kwargs-tag]. + @defproc[#:kind "syntax" - (poly-branch-func (id symbol?)) + (poly-branch-kwargs-tag (id symbol?)) (-> txexpr?)] -@margin-note{In writing this documentation it dawned on me that I only need one of these macros. So -at some point the current @code{poly-branch-tag} will be eliminated, and @code{poly-branch-func} -then renamed to @code{poly-branch-tag}. See @ticket{fbbb5ed9}.} +Works just like @racket[poly-branch-tag], but uses Pollen’s @racket[define-tag-function] so that +keyword arguments will automatically be parsed as X-expression attributes. -Like @racket[poly-branch-tag], but uses @racket[define] instead of @racket[define-tag-function]. +@margin-note{The thought behind having two macros so similar is that, by cutting out handling for keyword +arguments, @racket[poly-branch-tag] could produce simpler and faster code. I have not verified if +this intuition is meaningful or correct.} @section{Markup reference} These are the tags that can be used in any of @italic{The Local Yarn}’s Pollen documents (articles, etc).