Skip to main content

annotation-partial-inline.tmpl

Path: template/include/annotation-partial-inline.tmpl | Language: HTML5/Pandoc | Lines: ~11

Template for rendering minimal inline annotations containing only title and author/date information.

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 layout is generated by the Haskell build system (particularly Annotation.hs and LinkMetadata.hs) when rendering annotations in contexts that require inline treatment, such as within paragraphs or list items 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 description ("a new" or "this") for accessibility
tabOrWindowStringText ("tab" or "window") for accessibility
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 Hakyll's conditional syntax:

  • <[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