Atlas Footnote OrganiserOpen the formatter

How the formatter works

Atlas Footnote Organiser converts through a source record. When a student changes Chicago to APA, the program renders the same authors, title, journal and publication date through a different style definition. The source's published page range and the passage cited in the paper have separate fields. A student can therefore cite page 194 in a footnote and retain pages 193–200 in the reference entry. For the student workflow, see the user manual. The white paper explains the design choices and the style guide documents the academic conventions.

Source record and input

The manual editor offers eight source types. Structured imports accept the wider set listed in cslTypes. The normaliser requires a recognised type and a non-empty title. It copies the supported fields into a new record, discarding unrecognised properties. A title alone can start a preview. The editor flags certain missing details, including a journal title, book publisher or web page URL. These checks cannot establish that the citation is complete. Record functions and field lists

Data Representation and use
People and organisations Names are ordered objects in arrays such as author, editor and translator. A person can have family, given, particles and a suffix. A corporate or undivided name can use literal. The manual form reads one name per line and recognises Family, Given and {Organisation}.
Publication Fields include container-title, volume, issue, page, publisher, publisher-place, DOI and URL. A structured date takes the form issued: {'date-parts': [[2013, 1]]}. A literal date can preserve wording such as “forthcoming”.
Editorial and legal detail The optional atlas object holds sentenceTitle, jurisdiction, court, neutral, fullReport and region. An explicitly supplied APA sentence-case title applies to a rendering copy. A verbatim fullReport preserves a report year that differs from the decision year.
Citation occurrence locator and label belong to the particular citation. The editor supports page, paragraph, section and chapter. paperNumber is the number already assigned to the source in a numbered reference system.

parseInput(raw) accepts one record. It recognises CSL-JSON first, then BibTeX and RIS, which it passes to Citation.js. Remaining text goes to parseText. The recogniser checks SSRN suggested citations for a byline, title, date and matching repository identifiers. It retains the supplied date and title, including an explicit withdrawal label. Other patterns cover cases, statutes, journals, books, APA-style edited chapters and dated or explicitly undated webpages, and selected Chinese GB/T forms. The parser checks punctuation, publication details and name structure. A successful parse is still a draft. Initials, missing publication details and an abbreviated author list may require consulting the work. When unrecognised prose returns null, the formatter keeps the pasted text. A single trailing DOI can offer an explicit registry lookup. Other unrecognised references open the source tools for manual entry. Malformed structured data and multiple records have explicit error paths. The input limits are 100,000 trimmed string units at entry and 12,000 for the prose recogniser. Input routing · Plain-text recognition

Pasting a standalone DOI shows the lookup notice. Selecting Convert now calls lookupDoi with a validated identifier. It requests CSL-JSON from DOI.org, with a Crossref fallback, omits credentials and the referrer, and checks a returned DOI against the requested one when present. Editing the identifier or switching modes cancels the pending request. The interface aborts a lookup after 20 seconds. Source details, the original paste and preview are held in the current tab's memory. The interface language is the preference persisted in local storage. Lookup · Browser state

For a recognised journal reference with an “et al.” byline, the app shows a lookup notice when the text is pasted. Convert now uses the supplied DOI or queries Crossref for the article title. Atlas compares the candidate title, journal, year, supplied author names and available publication details. It uses a single matching DOI whose deposited byline extends the supplied names. A failed or ambiguous lookup leaves the original paste available and explains how to retry in the result box. Author matching · Crossref REST API

Journal numbering and missing authors

Quoted articles accept labelled volumes and issues, a compound issue number and an author-date record with only journal and pages. A title, journal and year can identify a candidate in the reviewed publisher records. Atlas checks the printed pages, any supplied DOI, the numbering and the order of supplied authors before restoring missing fields. The publisher’s Thai title controls word spacing only after a match. Without sufficient evidence, missing bibliographic fields stay empty. An unlabelled numeric pair with two plausible readings requires a choice for full outputs. Publisher records

Conversion failure reports

Only an explicit conversion attempt in the public workspace can send a failure report. An attempt receives a fresh random identifier, independent of the visitor. The service stores its Singapore date, reason, target style and output. A retried report uses the same identifier. A separate submission carries a visitor-edited example only with express consent. The result panel distinguishes delivery, unavailability and optional example submission. The hosted write interface has no public log reader. The daily review checks recurring categories and independently verifies examples before incorporating a test. Browser reporting code

Function reference

Function Input Result or effect
parseInput(raw) One pasted string Returns {item} with optional recognition details such as locator and label. Returns null for unrecognised prose. Throws on invalid structured input or a multi-record export.
normalise(record) A supported CSL record Returns a fresh item containing recognised fields. A missing title or unrecognised type raises invalidData.
lookupDoi(input, signal) A DOI or DOI URL and an optional abort signal Returns a promise for a normalised record. Invalid input and failed retrieval have distinct errors.
fieldValue(item, key) and setField(item, key, value) A source, a field key and, for a change, the editor text The first reads the display string. The second updates the item in place, converting name and date text to structured values where applicable.
missingFields(item) A reviewed source Returns keys for details the editor can flag. An empty array does not certify the reference.
renderCitation(options) Source, style, XML, locales and occurrence settings Returns formatted HTML or a message key. The options and a runnable example appear below.
formatAsync(options) The same formatting request from the browser Resolves the result using the worker when available. A newer waiting request supersedes an older one, which resolves with {cancelled: true}.
safeFragment(html, doc) Formatted HTML and an optional browser document Returns a filtered DOM fragment for the preview and rich clipboard output.

Rendering a citation

renderCitation accepts a catalogue style, its XML, an object mapping locale tags to XML, and the source item. Its defaults are output: 'cite', locale: '', label: 'page', locator: '' and paperNumber: 1. It returns either {html} or a message key, such as {message: 'noBib'}. A direct caller must also handle exceptions from bad assets or a processor failure. The browser worker and UI convert exceptions into a visible formatting error. Formatter · Style catalogue

Run this example from the repository root with Node.js 20 or later. It reads the shipped assets locally and requires neither a DOM nor a network request.

node --input-type=module <<'JS'
import { readFile } from 'node:fs/promises';
import { styles } from './docs/assets/catalog.mjs';
import { parseInput } from './docs/assets/records.mjs';
import { renderCitation } from './docs/assets/format.mjs';

const source = 'Baron, N. S. (2013). Redefining reading: The impact of digital communication media. PMLA, 128(1), 193–200.';
const parsed = parseInput(source);
if (!parsed) throw new Error('Review and enter the source details.');
const style = styles.find(({ id }) => id === 'apa');
const xml = await readFile('./docs/styles/apa.csl', 'utf8');
const locales = { 'en-US': await readFile('./docs/locales/locales-en-US.xml', 'utf8') };
const result = renderCitation({ style, xml, locales, item: parsed.item, locator: '194' });
if (result.message) throw new Error(result.message);
console.log(result.html);
JS

Expected output is (Baron, 2013, p. 194).

For ordinary records, the formatter clones the item, sets a local ID and creates a new citeproc-js engine. It submits a citation cluster with no preceding or following citations. Note styles receive note position 1 and produce a first note. The word processor supplies the footnote number. Repeated-note forms, cross-references, grouped citations and paper-wide disambiguation require a document history. Requesting output: 'reference' returns the first bibliography entry where available. Bluebook Law Review lacks a bibliography layout. Processor call and bibliography handling

Numeric styles initially see a single source. The formatter substitutes the student's integer from 1 to 99,999 exclusively at the leading number in the rendered citation or entry. For the example above, IEEE can include the pinpoint inside [17, p. 194], NLM gives (17), and GB/T places the page after the brackets on the same superscript line, [17]194. An empty locale leaves the style's language choice in effect. An explicit locale asks citeproc-js to override that choice. Locale retrieval tries the exact tag, a bundled dictionary for the language, then US English. Wording embedded in a style and native legal abbreviations can remain fixed. Locale selection and numbering

Preview, clipboard and maintenance

Every change invalidates the last copyable result. A revision counter prevents a late render replacing a newer edit. The worker keeps at most one running and one waiting job. A new request replaces the waiting job, and a worker failure falls back to rendering on the main thread. The UI caches successfully loaded style and locale XML. Interface state · Job scheduling · Worker

safeFragment rebuilds the returned HTML in the browser using permitted elements, link schemes, classes and typographic properties. It preserves features such as italics and superscripts. Copy writes cleaned HTML and whitespace-normalised plain text. If rich copying fails, it attempts plain text, then selects the result for manual copying. HTML filtering · Clipboard handling

For a change in recognition, add a public or synthetic input to the parser tests and check the fields and locator independently. For rendering, add an assertion for the expected output to the formatter tests, citing the guide and edition that supply the rule. For a new preset, add an independent, pinned style file, preserve its rights metadata, record its checksum in the asset register and add its identifier, mode and guide to the catalogue. Test the citation and available reference entry, including the behaviour on an unsupported primary authority. Run npm test and node scripts/verify-assets.mjs from the repository root. Rebuilding modified vendor dependencies uses npm ci followed by npm run build. Build script · Third-party licences

Regression checks

The accuracy report explains the rules for preserving name metadata, merging RIS author tags, interpreting section identifiers, validating calendar dates and adapting DOI registry types. Each correction has an executable example.

Parenthetical recommendations

Set recommendations: true when calling renderCitation to request guidance for the current citation occurrence. The main html value remains the ordinary output. A supported recommendation supplies a mode and any copyable fragments. For author-in-prose forms, a preview cluster suppresses the author while retaining the selected style and language. APA derives the quotation locator from two previews and offers separate date and locator fragments when they can be identified unambiguously. For a supported Bluebook US case, an optional explanation supplies the writer’s own short phrase. The case metadata is unchanged. Recommendation rules · Student examples

The release build gives the browser entry, worker, citation engine, styles and locale files content-based addresses. That keeps different releases distinguishable in browser caches. Browser build