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
| Variable | Type | Description |
|---|---|---|
annotationClassSuffix | String | Additional CSS class suffix for styling variants |
title | HTML | The title text/content of the annotated link |
titleLinkClass | String | CSS class(es) for the title link element |
titleLinkHref | URL | The target URL for the title link |
titleLinkDataAttributes | HTML | Custom data attributes for the link (e.g., data-popup-type) |
whichTab | String | Text description ("a new" or "this") for accessibility |
tabOrWindow | String | Text ("tab" or "window") for accessibility |
linkTarget | String | HTML target attribute (_self, _blank, etc.) |
authorDateAux | HTML | Combined author and date information |
author | String | Author 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:
- Author-date-aux class: The inner span gets class
author-date-auxif that field exists - Comma before author-date: A comma and space (
,\) is inserted before author/date info if theauthorfield exists - Author-date content: The entire author/date block is only rendered if
authorDateAuxexists
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
- annotation-blockquote-not.tmpl - Full annotation without blockquote wrapper
- Annotation.hs - Scrapes and processes annotation metadata
- LinkMetadata.hs - Builds annotation data structures
- Typography.hs - Applies template rendering during Pandoc processing
- popups.js - Popup system that displays annotations
- extracts.js - Coordinates annotation popup display
- content.js - Content type routing for annotations