Skip to main content

annotation-partial-inline.tmpl

This template produces a compact, inline annotation format suitable for embedding within text flow.

Pathtemplate/include/annotation-partial-inline.tmpl
LanguageHTML5/Pandoc
Lines12

Read this when Use this page when tracing the HTML/Pandoc templates and include fragments that shape rendered gwern.net pages around annotation-partial-inline.tmpl.

Overview

This template produces a compact, inline annotation format suitable for embedding within text flow. Unlike the full annotation templates, it contains only the essential metadata - the title link and optional author/date information - without abstracts, thumbnails, or file includes. The entire annotation is wrapped in <span> elements to preserve inline text flow.

The template is part of gwern.net's annotation system and is used when full annotation data would be too visually heavy or disruptive for the context. This commonly occurs in running text where a link needs annotation metadata but should not break the reading flow with a large block-level element.

This template is not rendered by the Haskell build system. All template/include/*.tmpl files are bundled into js/transclude-templates-GENERATED.js by build/build_unified_assets.php, and filled at runtime in the browser by the JavaScript transclusion system (fillTemplate() in transclude.js). It is selected for include-links carrying the include-annotation-partial-inline alias class (defined in transclude.js), which expands to include-annotation-partial plus data-include-template="annotation-partial-inline" — used in contexts that require inline treatment, such as within paragraphs where block-level annotations would be inappropriate.

Template Variables

VariableTypeDescription
annotationClassSuffixStringAdditional CSS class suffix for styling variants
titleHTMLThe title text/content of the annotated link
titleLinkClassStringCSS class(es) for the title link element
titleLinkHrefURLThe target URL for the title link
titleLinkDataAttributesHTMLCustom data attributes for the link (e.g., data-popup-type)
whichTabStringText ("new" on desktop, "current" on mobile) for the link tooltip
tabOrWindowStringText ("window" on desktop, "tab" on mobile) for the link tooltip
linkTargetStringHTML target attribute (_self, _blank, etc.)
authorDateAuxHTMLCombined author and date information
authorStringAuthor name (used in conditional logic for comma placement)

Output Structure

The template generates a minimal inline structure:

<span class="annotation[suffix]">
<span class="data-field title [author-date-aux]">
<a class="..." href="..." target="..." data-...>Title</a>
[, if author present][author-date-aux content]
</span>
</span>

Key structural features:

  • Double-span wrapper: Outer span for annotation context, inner span for title/metadata
  • Inline-only elements: Uses only <span> elements to maintain text flow
  • Conditional author-date-aux class: Added to inner span when author/date present
  • Comma separator: Inserted between title and author/date when author is present
  • No abstract/thumbnail/files: Only title and metadata are rendered

Conditional Logic

The template uses the conditional syntax of the JavaScript template system (implemented by fillTemplate() in transclude.js — not Hakyll):

  • <[IF condition]>...<[IFEND]> - First-level conditional
  • <[IF2 condition]>...<[IF2END]> - Nested conditional

Applied to:

  1. Author-date-aux class: The inner span gets class author-date-aux if that field exists
  2. Comma before author-date: A comma and space (,\ ) is inserted before author/date info if the author field exists
  3. Author-date content: The entire author/date block is only rendered if authorDateAux exists

The backslash after the comma (,\ ) preserves the space in the template output.

Use Cases

This template is ideal for:

  • In-paragraph citations: Links within running text that need metadata without breaking flow
  • List items: Annotated links in ordered or unordered lists
  • Table cells: Links in table content where block elements would break layout
  • Navigation elements: Menu items or breadcrumbs with annotation metadata
  • Compact contexts: Any situation where the full annotation would be too large

Comparison with Other Variants

  • vs. blockquote- templates*: Those use block-level elements and include abstract/thumbnail
  • Unique feature: Only template using <span> for fully inline treatment
  • Minimal data: Only renders title and author/date, omits abstract/thumbnail/files
  • Flow preservation: Designed to sit within text without disrupting paragraph flow

See Also