Template:Category/Publication/byline

From Miniscope
Jump to: navigation, search

Render the author byline for a Publication page. Walks all subobjects on the page (via the -Has subobject back-reference, same idiom as Template:Category/subobjects), orders by Has sort order (citation order), and formats each as "F. M. Last".

Called by Template:Category/Publication with page = Template:Category/Publication/byline; the explicit page param lets it be reused on index pages (e.g., showing the byline beneath each entry in a "Recent publications" feed) without inheriting the rendering page's identity.

Uses format=template with the Template:Category/Publication/byline.row partial so the byline renders as a comma-separated list. The first author (sort_order=1) triggers italic emphasis in the row template.

Why sort on Has sort order, not Is first author

The natural sort here is "first author first, then alphabetic" — i.e. sort=Is first author,Has last name with order=desc,asc. That's what the earlier version did, and it's broken in two compounding ways on the live wiki:

  1. SMW filters rows where the first sort property is empty. If
 Is first author is undefined on every subobject (see
 below), the whole query returns zero rows — even though the
 subobjects exist and are queryable without the sort. The byline
 div ends up empty on every Publication page despite ten authors
 being stored.
  1. The citations-sync pipeline writes the wrong parameter name.
 Sample wikitext on the live wiki:
{{Publication author/subobject
  |has_last_name=Guo
  |has_first_name=Changliang
  |has_is_first_author=true
  }}
 The auto-generated Publication author/subobject
 template reads  (no
 has_ prefix — SemanticSchemas's NamingHelper drops the
 leading "Is " when generating the parameter name). The two never
 meet, so Is first author is never set and every
 subobject sorts the same. Fix lives in the citations-sync repo, not
 here.

Has sort order is auto-assigned by the subobject template via #s2counter in declaration order, so it's always populated and always reflects citation order — which is what the byline wants anyway. Italic-first-author still works via sort_order=1, projected as {{{4}}} and checked in Template:Category/Publication/byline.row.

Why mainlabel=- is mandatory

Without mainlabel=-, format=template passes the result page name as {{{1}}} and shifts every projected property one slot right — the row template ends up trying to render the subobject ID as a surname and the actual surname as a first-name initial, so the byline silently renders as garbage (or empty, depending on the subobject ID shape). Keep it set, or migrate the row template to named args.