Page Content Service/References

The references endpoint provides a structured output of reference lists found on a particular page (phab:T170690).

Structure
HTML and JSON are formatted for easier reading.

The output contains two main objects:
 * structure : a list of reference lists, useful to build a reference lists UI; potentially there could be more information about sections if the section was omitted due to being empty after the ref list was stripped
 * references : a map of reference details

The structure object
The structure object is included to build a native view of reference lists. It currently contains only references lists. In the future there could be other things added as well, like information about section headings and other text (HTML) objects. The latter could come if a section towards the end of the article would become empty after stripping a references list. See T170690#3467608.

The references object
The references object contains the reference details, each with an array of back_links, the HTML content , and an optional array for citation decorations.

citation decorations usually have one or more of the following values: book, journal , news , web. The citation decorations are derived from any cite elements in the HTML content.

Example 1: one ref list, one ref
{{markup
 * Bar.

Example 2: two simple ref lists, one ref with two backlinks
{{markup
 * Foo . Bar.

Open questions
Example:
 * Should we keep the bibliographic metadata? See also the COinS syntax. It's a machine-readable format for bibliographic metadata. They appear right after cite elements. It doesn't get displayed (see `style="display:none;`). Historically MCS has stripped this out.
 * How should citation types be exposed? Cite elements usually have some kind of type indicator in the class list, like "citation web" or "citation book". This happens on the <cite level directly, so it could be inside the reference content directly or inside a unordered list item part of the content.
 * Do we really want to structure the reference content?

Links

 * VisualEditor/Citation_tool