From b73359a3e1c4b6d292217c98c3102fe7b645b8ea Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 10:39:51 -0600 Subject: [PATCH] Demo: an example of in-text citations and annotations The Playground demo had no example of the Cite format or of annotations. Add one after the Chicago example: three annotated books with Show annotations on, and a paragraph citing them with Cite links (one with a locator), saved as the format saves them. demo-content.php renders an example's optional "prose" paragraphs before its block. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WPtgA1cnwP9mYKwaWniaFS --- .wordpress-org/blueprints/blueprint.json | 2 +- playground/blueprint-main.json | 2 +- playground/blueprint-write-api.json | 2 +- playground/blueprint.json | 2 +- playground/demo-content.json | 77 ++++++++++++++++++++++++ playground/demo-content.php | 7 +++ 6 files changed, 88 insertions(+), 4 deletions(-) diff --git a/.wordpress-org/blueprints/blueprint.json b/.wordpress-org/blueprints/blueprint.json index 362038c..f4cde06 100644 --- a/.wordpress-org/blueprints/blueprint.json +++ b/.wordpress-org/blueprints/blueprint.json @@ -26,7 +26,7 @@ }, { "step": "runPHP", - "code": "Welcome to Borges Bibliography Builder. This Playground runs the latest release. It is a sandbox: nothing here is kept after you close the tab.';\n$borges_demo_json = <<<'JSON'\n{\"title\":\"Borges Bibliography Builder demo\",\"sampleGroups\":[{\"title\":\"DOIs\",\"description\":\"A bare DOI, a doi: prefix, or a doi.org link. Metadata comes from Crossref.\",\"samples\":[{\"format\":\"doi\",\"input\":\"10.1038/s41586-020-2649-2\"},{\"format\":\"doi\",\"input\":\"doi:10.1038/nature14539\"},{\"format\":\"doi\",\"input\":\"https://doi.org/10.1145/3368089.3409742\"}]},{\"title\":\"PubMed and PubMed Central\",\"description\":\"A PMID needs its PMID: label. A PMCID starts with PMC, with or without a PMCID: label.\",\"samples\":[{\"format\":\"pmid\",\"input\":\"PMID:26673779\"},{\"format\":\"pmcid\",\"input\":\"PMC3531190\"}]},{\"title\":\"arXiv\",\"description\":\"An arXiv: ID (modern or legacy), an arxiv.org link, or an arXiv DOI.\",\"samples\":[{\"format\":\"arxiv\",\"input\":\"arXiv:1706.03762\"},{\"format\":\"arxiv\",\"input\":\"https://arxiv.org/abs/1810.04805\"},{\"format\":\"arxiv\",\"input\":\"arXiv:hep-th/9711200\"},{\"format\":\"arxiv\",\"input\":\"10.48550/arXiv.2005.14165\"}]},{\"title\":\"ISBNs\",\"description\":\"A labeled ISBN-13 or ISBN-10, or a bare ISBN-13 starting with 978 or 979. Books come from Open Library, with Google Books as a fallback.\",\"samples\":[{\"format\":\"isbn\",\"input\":\"ISBN 978-0-14-032872-1\"},{\"format\":\"isbn\",\"input\":\"9780262033848\"},{\"format\":\"isbn\",\"input\":\"ISBN-10: 0-8112-0012-4\"}]},{\"title\":\"Library catalogs and the Internet Archive\",\"description\":\"An OCLC number or LCCN needs its label (or its WorldCat or lccn.loc.gov link); an Open Library edition ID (OL…M) works on its own. An archive.org item link, ia: identifier, or ARK cites the edition the item names and keeps the archive.org page as the link. Records come from Open Library and the Internet Archive.\",\"samples\":[{\"format\":\"catalog\",\"input\":\"OCLC 297222669\"},{\"format\":\"catalog\",\"input\":\"LCCN 76-28766\"},{\"format\":\"archive\",\"input\":\"https://archive.org/details/limitstomedicine00illi\"}]},{\"title\":\"BibTeX and BibLaTeX\",\"description\":\"Whole entries, one or many. BibLaTeX fields such as date and location are understood.\",\"samples\":[{\"format\":\"bibtex\",\"input\":\"@article{knuth1984literate,\\n author = {Knuth, Donald E.},\\n title = {Literate Programming},\\n journal = {The Computer Journal},\\n year = {1984},\\n volume = {27},\\n number = {2},\\n pages = {97--111},\\n doi = {10.1093/comjnl/27.2.97}\\n}\"},{\"format\":\"bibtex\",\"input\":\"@book{borges1962labyrinths,\\n author = {Borges, Jorge Luis},\\n title = {Labyrinths: Selected Stories and Other Writings},\\n editor = {Yates, Donald A. and Irby, James E.},\\n date = {1962},\\n publisher = {New Directions},\\n location = {New York}\\n}\"}]},{\"title\":\"RIS\",\"description\":\"Records exported from Zotero, Mendeley, EndNote, or another reference manager, one or many. Each record runs from TY - to ER -.\",\"samples\":[{\"format\":\"ris\",\"input\":\"TY - BOOK\\nAU - Kuhn, Thomas S.\\nTI - The Structure of Scientific Revolutions\\nPY - 1962\\nPB - University of Chicago Press\\nCY - Chicago\\nER - \"},{\"format\":\"ris\",\"input\":\"TY - CHAP\\nAU - Geertz, Clifford\\nTI - Thick Description: Toward an Interpretive Theory of Culture\\nT2 - The Interpretation of Cultures\\nPY - 1973\\nSP - 3\\nEP - 30\\nPB - Basic Books\\nCY - New York\\nER - \"}]},{\"title\":\"CSL-JSON\",\"description\":\"A reference manager’s CSL JSON export, or a CSL-JSON file downloaded from Borges. Paste a CSL-JSON document on its own, not mixed with other samples.\",\"samples\":[{\"format\":\"csl-json\",\"input\":\"[{\\\"type\\\": \\\"book\\\", \\\"title\\\": \\\"Orientalism\\\", \\\"author\\\": [{\\\"family\\\": \\\"Said\\\", \\\"given\\\": \\\"Edward W.\\\"}], \\\"publisher\\\": \\\"Pantheon Books\\\", \\\"publisher-place\\\": \\\"New York\\\", \\\"issued\\\": {\\\"date-parts\\\": [[1978]]}}]\"}]},{\"title\":\"Formatted citations\",\"description\":\"Plain-text citations for books, journal articles, chapters, and webpages, in Chicago or APA shape. A citation that contains a DOI, PMID, PMCID, or arXiv ID is looked up by that identifier instead.\",\"samples\":[{\"format\":\"freetext\",\"input\":\"Binder, Amy J., and Jeffrey L. Kidder. The Channels of Student Activism: How the Left and Right Are Winning (and Losing) in Campus Politics Today. University of Chicago Press, 2022.\"},{\"format\":\"freetext\",\"input\":\"Ostrom, Elinor. Governing the Commons. Cambridge: Cambridge University Press, 1990.\"},{\"format\":\"freetext\",\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85.\"},{\"format\":\"freetext\",\"input\":\"Doyle, Kathleen. “The Queen Mary Psalter.” In The Book by Design: The Remarkable Story of the World’s Greatest Invention, edited by P. J. M. Marks and Stephen Parkin. University of Chicago Press, 2023.\"},{\"format\":\"freetext\",\"input\":\"Yale University. “About Yale: Yale Facts.” Accessed March 8, 2022. https://www.yale.edu/about-yale/yale-facts.\"},{\"format\":\"doi\",\"embedded\":true,\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85. https://doi.org/10.1086/725865.\"}]}],\"features\":[\"Citation Style (block sidebar): nine styles, Chicago Notes-Bibliography and Author-Date, APA 7, MLA 9, Harvard, IEEE, Vancouver, OSCOLA, and ABNT. Section 3 has an example of each. Switching reformats the generated text and keeps your manual edits.\",\"Heading: type the heading in the block, and choose its level in the sidebar: H2 (where a new block starts) to H6, or Paragraph for styled text that stays out of the page outline. Leave it empty for no heading.\",\"Edit fields: click any citation to correct its authors, title, year, DOI, and other fields; only the fields you change are saved. The pencil edits the displayed text instead, and Reset edits restores the generated text.\",\"Manual Entry: next to Paste / Import, add a citation field by field when there is nothing to paste.\",\"Duplicates: paste a DOI that is already in the list; it is skipped, not added twice.\",\"Order: notes and author-date styles sort alphabetically. Numeric styles (IEEE, Vancouver) keep your order; use Move citation up/down.\",\"Exports (block toolbar): copy the bibliography as text, or download BibTeX, BibLaTeX, RIS, or CSL-JSON.\",\"Per-entry Cite / Export (sidebar, off by default): gives readers copy and download links under each entry on the published page. The Chicago Notes-Bibliography example in section 3 has it on.\",\"Machine-readable output (sidebar): JSON-LD for search engines (on by default), COinS for Zotero, and embedded CSL-JSON. The examples in section 3 show each on and off.\",\"Block settings: like other blocks, a bibliography takes an HTML anchor and extra CSS classes (Advanced), a font size, and top and bottom margin and padding.\",\"Front end: use View Post to see the published bibliography, then open its read-only REST data.\"],\"examples\":[{\"title\":\"Chicago Notes-Bibliography: per-entry Cite / Export\",\"description\":\"A book, a chapter, a journal article, and a webpage, sorted alphabetically. View the published page and open Cite / Export under any entry to copy it or download it as RIS, BibTeX, BibLaTeX, or CSL-JSON. Settings: Per-entry Cite / Export on, and every machine-readable layer on (JSON-LD, COinS, embedded CSL-JSON); heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-notes\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"anchor\":\"demo-chicago-notes\",\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":true,\"outputCiteExport\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"chapter\",\"title\":\"The Library of Babel\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Irby\",\"given\":\"James E.\"}],\"container-title\":\"Labyrinths: Selected Stories and Other Writings\",\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}},{\"type\":\"webpage\",\"title\":\"Block Editor Handbook\",\"author\":[{\"literal\":\"WordPress.org\"}],\"container-title\":\"WordPress Developer Resources\",\"URL\":\"https://developer.wordpress.org/block-editor/\"}],\"exports\":[{\"exportBibtex\":\"@book{Borges1962Labyrinths,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@book{Borges1962Labyrinths,\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@inbook{Borges1962Library,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@inbook{Borges1962Library,\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n\\ttranslator = {Irby, James E.},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournal = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tyear = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournaltitle = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tdate = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@misc{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n\\thowpublished = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@online{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\tbooktitle = {WordPress {Developer} {Resources}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\"}]},{\"title\":\"Chicago Author-Date: same author, same year\",\"description\":\"Three of Einstein’s 1905 papers. Author-date styles letter works by one author in one year (1905a, 1905b, 1905c) so in-text citations stay unambiguous. Settings: the default output (JSON-LD only); heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-author-date\",\"citationStyle\":\"chicago-author-date\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Zur Elektrodynamik bewegter Körper\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"10\",\"page\":\"891-921\",\"DOI\":\"10.1002/andp.19053221004\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Über einen die Erzeugung und Verwandlung des Lichtes betreffenden heuristischen Gesichtspunkt\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"6\",\"page\":\"132-148\",\"DOI\":\"10.1002/andp.19053220607\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"323\",\"issue\":\"13\",\"page\":\"639-641\",\"DOI\":\"10.1002/andp.19053231314\",\"issued\":{\"date-parts\":[[1905]]}}]},{\"title\":\"APA 7\",\"description\":\"Journal articles and an arXiv preprint, with DOIs as links. Settings: the default output (JSON-LD only), with the heading at the Paragraph level, so it is styled text rather than a heading.\",\"attributes\":{\"bibliographyId\":\"demo-apa-7\",\"citationStyle\":\"apa-7\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Deep learning\",\"author\":[{\"family\":\"LeCun\",\"given\":\"Yann\"},{\"family\":\"Bengio\",\"given\":\"Yoshua\"},{\"family\":\"Hinton\",\"given\":\"Geoffrey\"}],\"container-title\":\"Nature\",\"volume\":\"521\",\"issue\":\"7553\",\"page\":\"436-444\",\"DOI\":\"10.1038/nature14539\",\"issued\":{\"date-parts\":[[2015]]}},{\"type\":\"article\",\"title\":\"Attention is all you need\",\"author\":[{\"family\":\"Vaswani\",\"given\":\"Ashish\"},{\"family\":\"Shazeer\",\"given\":\"Noam\"},{\"family\":\"Parmar\",\"given\":\"Niki\"},{\"family\":\"Uszkoreit\",\"given\":\"Jakob\"},{\"family\":\"Jones\",\"given\":\"Llion\"},{\"family\":\"Gomez\",\"given\":\"Aidan N.\"},{\"family\":\"Kaiser\",\"given\":\"Łukasz\"},{\"family\":\"Polosukhin\",\"given\":\"Illia\"}],\"publisher\":\"arXiv\",\"number\":\"1706.03762\",\"DOI\":\"10.48550/arXiv.1706.03762\",\"issued\":{\"date-parts\":[[2017]]}},{\"type\":\"article-journal\",\"title\":\"Computing machinery and intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}}]},{\"title\":\"MLA 9: repeated authors\",\"description\":\"Works by one author list the name once, then three hyphens, as MLA asks. Settings: COinS on, so Zotero’s browser connector can save every entry; heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-mla-9\",\"citationStyle\":\"mla-9\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Ficciones\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Kerrigan\",\"given\":\"Anthony\"}],\"publisher\":\"Grove Press\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Other Inquisitions, 1937–1952\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Simms\",\"given\":\"Ruth L. C.\"}],\"publisher\":\"University of Texas Press\",\"publisher-place\":\"Austin\",\"issued\":{\"date-parts\":[[1964]]}},{\"type\":\"book\",\"title\":\"Borges: A Life\",\"author\":[{\"family\":\"Woodall\",\"given\":\"James\"}],\"publisher\":\"Basic Books\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1996]]}}]},{\"title\":\"Harvard: a bare list\",\"description\":\"No heading and no machine-readable output: just the entries. Settings: heading left empty, JSON-LD off, and the block’s Typography font size set to Small.\",\"attributes\":{\"bibliographyId\":\"demo-harvard\",\"citationStyle\":\"harvard\",\"headingText\":\"\",\"fontSize\":\"small\",\"outputJsonLd\":false,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Governing the Commons: The Evolution of Institutions for Collective Action\",\"author\":[{\"family\":\"Ostrom\",\"given\":\"Elinor\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1990]]}},{\"type\":\"book\",\"title\":\"The Structure of Scientific Revolutions\",\"author\":[{\"family\":\"Kuhn\",\"given\":\"Thomas S.\"}],\"publisher\":\"University of Chicago Press\",\"publisher-place\":\"Chicago\",\"issued\":{\"date-parts\":[[1962]]}}]},{\"title\":\"IEEE\",\"description\":\"Numbered entries keep the order you give them. Select the block and use Move citation up/down to renumber. Journals print by their abbreviated titles, from each record's short title. Settings: the defaults, in a numbered list.\",\"attributes\":{\"bibliographyId\":\"demo-ieee\",\"citationStyle\":\"ieee\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"A Mathematical Theory of Communication\",\"author\":[{\"family\":\"Shannon\",\"given\":\"Claude E.\"}],\"container-title\":\"Bell System Technical Journal\",\"container-title-short\":\"Bell Syst. Tech. J.\",\"volume\":\"27\",\"issue\":\"3\",\"page\":\"379-423\",\"DOI\":\"10.1002/j.1538-7305.1948.tb01338.x\",\"issued\":{\"date-parts\":[[1948]]}},{\"type\":\"article-journal\",\"title\":\"Computing Machinery and Intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"container-title-short\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"container-title-short\":\"Comput. J.\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}}]},{\"title\":\"Vancouver: biomedical references\",\"description\":\"Numbered entries with PubMed IDs; authors after the sixth become “et al.” Settings: embedded CSL-JSON on (a script tag other tools can read), beside the default JSON-LD; heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-vancouver\",\"citationStyle\":\"vancouver\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":true,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid\",\"author\":[{\"family\":\"Watson\",\"given\":\"J. D.\"},{\"family\":\"Crick\",\"given\":\"F. H. C.\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"171\",\"issue\":\"4356\",\"page\":\"737-738\",\"DOI\":\"10.1038/171737a0\",\"PMID\":\"13054692\",\"issued\":{\"date-parts\":[[1953,4,25]]}},{\"type\":\"article-journal\",\"title\":\"Highly accurate protein structure prediction with AlphaFold\",\"author\":[{\"family\":\"Jumper\",\"given\":\"John\"},{\"family\":\"Evans\",\"given\":\"Richard\"},{\"family\":\"Pritzel\",\"given\":\"Alexander\"},{\"family\":\"Green\",\"given\":\"Tim\"},{\"family\":\"Figurnov\",\"given\":\"Michael\"},{\"family\":\"Ronneberger\",\"given\":\"Olaf\"},{\"family\":\"Tunyasuvunakool\",\"given\":\"Kathryn\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"596\",\"issue\":\"7873\",\"page\":\"583-589\",\"DOI\":\"10.1038/s41586-021-03819-2\",\"PMID\":\"34265844\",\"issued\":{\"date-parts\":[[2021,8]]}}]},{\"title\":\"OSCOLA: tables of cases, legislation, and treaties\",\"description\":\"OSCOLA 5 lists primary sources in their own tables before the secondary sources. Each table’s label sits one level below the block heading. Settings: the default output; heading Bibliography at level H4, so the tables are labeled at H5.\",\"attributes\":{\"bibliographyId\":\"demo-oscola\",\"citationStyle\":\"oscola\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"legal_case\",\"title\":\"Donoghue v Stevenson\",\"container-title\":\"AC\",\"issued\":{\"date-parts\":[[1932]]},\"number\":\"562\"},{\"type\":\"legal_case\",\"title\":\"Carlill v Carbolic Smoke Ball Co\",\"container-title\":\"1 QB\",\"issued\":{\"date-parts\":[[1893]]},\"number\":\"256\"},{\"type\":\"legislation\",\"title\":\"Human Rights Act\",\"issued\":{\"date-parts\":[[1998]]}},{\"type\":\"regulation\",\"title\":\"Air Navigation Order 2016\",\"number\":\"SI 2016/765\"},{\"type\":\"treaty\",\"title\":\"Convention for the Protection of Human Rights and Fundamental Freedoms\",\"container-title\":\"213 UNTS\",\"page\":\"221\",\"issued\":{\"date-parts\":[[1950,11,4]]}},{\"type\":\"book\",\"title\":\"Constitutional and Administrative Law\",\"author\":[{\"family\":\"Bradley\",\"given\":\"A. W.\"},{\"family\":\"Ewing\",\"given\":\"K. D.\"},{\"family\":\"Knight\",\"given\":\"C. J. S.\"}],\"edition\":\"17\",\"publisher\":\"Pearson\",\"issued\":{\"date-parts\":[[2018]]}},{\"type\":\"article-journal\",\"title\":\"The Rule of Law\",\"author\":[{\"family\":\"Bingham\",\"given\":\"Tom\"}],\"container-title\":\"Cambridge Law Journal\",\"container-title-short\":\"CLJ\",\"volume\":\"66\",\"page\":\"67\",\"issued\":{\"date-parts\":[[2007]]}}]},{\"title\":\"ABNT: Brazilian references\",\"description\":\"Surnames in capitals, with particles such as “de” after the given name, sorted by surname. Settings: the default output; heading Referências at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-abnt\",\"citationStyle\":\"abnt\",\"headingText\":\"Referências\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"O alienista\",\"author\":[{\"family\":\"Assis\",\"given\":\"Machado\",\"dropping-particle\":\"de\"}],\"publisher\":\"Ática\",\"publisher-place\":\"São Paulo\",\"issued\":{\"date-parts\":[[1997]]}},{\"type\":\"book\",\"title\":\"Raízes do Brasil\",\"author\":[{\"family\":\"Holanda\",\"given\":\"Sérgio Buarque\",\"dropping-particle\":\"de\"}],\"publisher\":\"José Olympio\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1936]]}},{\"type\":\"book\",\"title\":\"Casa-grande & senzala\",\"author\":[{\"family\":\"Freyre\",\"given\":\"Gilberto\"}],\"publisher\":\"Maia & Schmidt\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1933]]}}]}]}\nJSON;\n/**\n * Playground demo page builder.\n *\n * `npm run playground:build` inlines this file into each demo blueprint's\n * runPHP step, after defining:\n *\n * - $borges_demo_json The contents of playground/demo-content.json.\n * - $borges_demo_intro An HTML lead paragraph for that blueprint.\n *\n * It rewrites post 1 as the demo page the blueprint lands on, and turns off\n * the editor's Welcome Guide so the page is visible straight away. Example\n * bibliographies are formatted with the plugin's own citeproc formatter and\n * rendered with its PHP port of save(), so they validate against whatever\n * version is installed. A release without that port (before 1.7.0) gets a\n * note instead.\n *\n * Not part of the plugin package (playground/ is in .distignore).\n *\n * @package BibliographyBuilder\n */\n\nrequire_once '/wordpress/wp-load.php';\n\n// Write as the admin, and keep kses from stripping the blocks' JSON-LD\n// scripts and data attributes: kses_init() ran before any user was set.\nwp_set_current_user( 1 );\nkses_remove_filters();\n\n$borges_demo = json_decode( $borges_demo_json, true );\n\n$borges_demo_block = static function ( $name, $attrs, $html ) {\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => $name,\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$borges_demo_paragraph = static function ( $html ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block( 'core/paragraph', array(), '

' . $html . '

' );\n};\n\n$borges_demo_heading = static function ( $text, $level ) use ( $borges_demo_block ) {\n\t$attrs = 2 === $level ? array() : array( 'level' => $level );\n\t$tag = 'h' . $level;\n\n\treturn $borges_demo_block( 'core/heading', $attrs, '<' . $tag . ' class=\"wp-block-heading\">' . esc_html( $text ) . '' );\n};\n\n$borges_demo_code = static function ( $text ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block(\n\t\t'core/code',\n\t\tarray(),\n\t\t'
' . htmlspecialchars( $text, ENT_NOQUOTES, 'UTF-8' ) . '
'\n\t);\n};\n\n$borges_demo_list = static function ( $items ) {\n\t$html = \"\\n\\n\\n\\n\";\n};\n\n$borges_demo_can_prebuild = function_exists( 'bibliography_builder_render_save_markup' )\n\t&& function_exists( 'bibliography_builder_format_csl_items' )\n\t&& bibliography_builder_can_render_save_markup();\n\n// Returns the serialized block, or '' when this install cannot build it.\n$borges_demo_bibliography = static function ( $example ) use ( $borges_demo_can_prebuild ) {\n\tif ( ! $borges_demo_can_prebuild ) {\n\t\treturn '';\n\t}\n\n\t$csl_items = bibliography_builder_validate_and_sanitize_csl_items( $example['citations'] );\n\n\tif ( is_wp_error( $csl_items ) ) {\n\t\treturn '';\n\t}\n\n\t$formatted = bibliography_builder_format_csl_items( $csl_items, $example['attributes']['citationStyle'] );\n\n\tif ( is_wp_error( $formatted ) ) {\n\t\treturn '';\n\t}\n\n\t$citations = array();\n\n\tforeach ( array_values( $csl_items ) as $index => $csl ) {\n\t\t$citation = array(\n\t\t\t'id' => $example['attributes']['bibliographyId'] . '-' . ( $index + 1 ),\n\t\t\t'csl' => $csl,\n\t\t\t'formattedText' => $formatted[ $index ],\n\t\t);\n\n\t\t// The editor stores these for Cite / Export; without them it adds\n\t\t// them on load and the untouched demo opens with unsaved changes.\n\t\tforeach ( array( 'exportBibtex', 'exportBiblatex' ) as $export_key ) {\n\t\t\tif ( isset( $example['exports'][ $index ][ $export_key ] ) ) {\n\t\t\t\t$citation[ $export_key ] = $example['exports'][ $index ][ $export_key ];\n\t\t\t}\n\t\t}\n\n\t\t$citations[] = $citation;\n\t}\n\n\t$attrs = $example['attributes'];\n\t// Stored in display order, as the editor stores them.\n\t$attrs['citations'] = bibliography_builder_sort_citations_for_save( $citations, $attrs['citationStyle'] );\n\t// Render from the attributes as the editor will parse them back.\n\t$html = bibliography_builder_render_save_markup(\n\t\tbibliography_builder_decode_save_attributes( wp_json_encode( $attrs ) )\n\t);\n\n\tif ( '' === $html ) {\n\t\treturn '';\n\t}\n\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => 'bibliography-builder/bibliography',\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$content = $borges_demo_paragraph( $borges_demo_intro );\n\n$content .= $borges_demo_heading( '1. Paste any supported format', 2 );\n$content .= $borges_demo_paragraph(\n\t'Select the empty Bibliography block at the end of this section, open Paste / Import, paste one or more samples, and choose Add. Separate entries with a blank line; up to 50 go in one paste, so you can copy several groups at once. A CSL-JSON document goes in a paste of its own.'\n);\n\nforeach ( $borges_demo['sampleGroups'] as $group ) {\n\t$content .= $borges_demo_heading( $group['title'], 3 );\n\t$content .= $borges_demo_paragraph( $group['description'] );\n\t$content .= $borges_demo_code( implode( \"\\n\\n\", wp_list_pluck( $group['samples'], 'input' ) ) );\n}\n\n$content .= $borges_demo_block(\n\t'bibliography-builder/bibliography',\n\tarray(\n\t\t'bibliographyId' => 'demo-try-it',\n\t\t'headingText' => 'References',\n\t),\n\t''\n);\n\n$content .= $borges_demo_heading( '2. Key features to try', 2 );\n$content .= $borges_demo_list( $borges_demo['features'] );\n\n$content .= $borges_demo_heading( '3. Example bibliographies', 2 );\n\n$borges_demo_examples = '';\n\nforeach ( $borges_demo['examples'] as $example ) {\n\t$block = $borges_demo_bibliography( $example );\n\n\tif ( '' === $block ) {\n\t\tcontinue;\n\t}\n\n\t$borges_demo_examples .= $borges_demo_heading( $example['title'], 3 );\n\t$borges_demo_examples .= $borges_demo_paragraph( $example['description'] );\n\t$borges_demo_examples .= $block;\n}\n\n$content .= '' !== $borges_demo_examples\n\t? $borges_demo_paragraph( 'One example per citation style, each built from CSL-JSON. Under each title, Settings names the block settings it shows. Select a block to change them, or view the published page to see them as readers do.' ) . $borges_demo_examples\n\t: $borges_demo_paragraph( 'Pre-built examples need Borges 1.7.0 or later. Paste a few samples from section 1 to build your own.' );\n\nwp_update_post(\n\tarray(\n\t\t'ID' => 1,\n\t\t'post_title' => $borges_demo['title'],\n\t\t'post_content' => wp_slash( $content ),\n\t)\n);\n\n// Skip the block editor's Welcome Guide so the demo page is what opens.\n$borges_demo_meta_key = $GLOBALS['wpdb']->get_blog_prefix() . 'persisted_preferences';\n$borges_demo_preferences = get_user_meta( 1, $borges_demo_meta_key, true );\n$borges_demo_preferences = is_array( $borges_demo_preferences ) ? $borges_demo_preferences : array();\n\n$borges_demo_preferences['core/edit-post'] = array_merge(\n\tisset( $borges_demo_preferences['core/edit-post'] ) && is_array( $borges_demo_preferences['core/edit-post'] )\n\t\t? $borges_demo_preferences['core/edit-post']\n\t\t: array(),\n\tarray( 'welcomeGuide' => false )\n);\n$borges_demo_preferences['_modified'] = gmdate( 'c' );\n\nupdate_user_meta( 1, $borges_demo_meta_key, $borges_demo_preferences );\n" + "code": "Welcome to Borges Bibliography Builder. This Playground runs the latest release. It is a sandbox: nothing here is kept after you close the tab.';\n$borges_demo_json = <<<'JSON'\n{\"title\":\"Borges Bibliography Builder demo\",\"sampleGroups\":[{\"title\":\"DOIs\",\"description\":\"A bare DOI, a doi: prefix, or a doi.org link. Metadata comes from Crossref.\",\"samples\":[{\"format\":\"doi\",\"input\":\"10.1038/s41586-020-2649-2\"},{\"format\":\"doi\",\"input\":\"doi:10.1038/nature14539\"},{\"format\":\"doi\",\"input\":\"https://doi.org/10.1145/3368089.3409742\"}]},{\"title\":\"PubMed and PubMed Central\",\"description\":\"A PMID needs its PMID: label. A PMCID starts with PMC, with or without a PMCID: label.\",\"samples\":[{\"format\":\"pmid\",\"input\":\"PMID:26673779\"},{\"format\":\"pmcid\",\"input\":\"PMC3531190\"}]},{\"title\":\"arXiv\",\"description\":\"An arXiv: ID (modern or legacy), an arxiv.org link, or an arXiv DOI.\",\"samples\":[{\"format\":\"arxiv\",\"input\":\"arXiv:1706.03762\"},{\"format\":\"arxiv\",\"input\":\"https://arxiv.org/abs/1810.04805\"},{\"format\":\"arxiv\",\"input\":\"arXiv:hep-th/9711200\"},{\"format\":\"arxiv\",\"input\":\"10.48550/arXiv.2005.14165\"}]},{\"title\":\"ISBNs\",\"description\":\"A labeled ISBN-13 or ISBN-10, or a bare ISBN-13 starting with 978 or 979. Books come from Open Library, with Google Books as a fallback.\",\"samples\":[{\"format\":\"isbn\",\"input\":\"ISBN 978-0-14-032872-1\"},{\"format\":\"isbn\",\"input\":\"9780262033848\"},{\"format\":\"isbn\",\"input\":\"ISBN-10: 0-8112-0012-4\"}]},{\"title\":\"Library catalogs and the Internet Archive\",\"description\":\"An OCLC number or LCCN needs its label (or its WorldCat or lccn.loc.gov link); an Open Library edition ID (OL…M) works on its own. An archive.org item link, ia: identifier, or ARK cites the edition the item names and keeps the archive.org page as the link. Records come from Open Library and the Internet Archive.\",\"samples\":[{\"format\":\"catalog\",\"input\":\"OCLC 297222669\"},{\"format\":\"catalog\",\"input\":\"LCCN 76-28766\"},{\"format\":\"archive\",\"input\":\"https://archive.org/details/limitstomedicine00illi\"}]},{\"title\":\"BibTeX and BibLaTeX\",\"description\":\"Whole entries, one or many. BibLaTeX fields such as date and location are understood.\",\"samples\":[{\"format\":\"bibtex\",\"input\":\"@article{knuth1984literate,\\n author = {Knuth, Donald E.},\\n title = {Literate Programming},\\n journal = {The Computer Journal},\\n year = {1984},\\n volume = {27},\\n number = {2},\\n pages = {97--111},\\n doi = {10.1093/comjnl/27.2.97}\\n}\"},{\"format\":\"bibtex\",\"input\":\"@book{borges1962labyrinths,\\n author = {Borges, Jorge Luis},\\n title = {Labyrinths: Selected Stories and Other Writings},\\n editor = {Yates, Donald A. and Irby, James E.},\\n date = {1962},\\n publisher = {New Directions},\\n location = {New York}\\n}\"}]},{\"title\":\"RIS\",\"description\":\"Records exported from Zotero, Mendeley, EndNote, or another reference manager, one or many. Each record runs from TY - to ER -.\",\"samples\":[{\"format\":\"ris\",\"input\":\"TY - BOOK\\nAU - Kuhn, Thomas S.\\nTI - The Structure of Scientific Revolutions\\nPY - 1962\\nPB - University of Chicago Press\\nCY - Chicago\\nER - \"},{\"format\":\"ris\",\"input\":\"TY - CHAP\\nAU - Geertz, Clifford\\nTI - Thick Description: Toward an Interpretive Theory of Culture\\nT2 - The Interpretation of Cultures\\nPY - 1973\\nSP - 3\\nEP - 30\\nPB - Basic Books\\nCY - New York\\nER - \"}]},{\"title\":\"CSL-JSON\",\"description\":\"A reference manager’s CSL JSON export, or a CSL-JSON file downloaded from Borges. Paste a CSL-JSON document on its own, not mixed with other samples.\",\"samples\":[{\"format\":\"csl-json\",\"input\":\"[{\\\"type\\\": \\\"book\\\", \\\"title\\\": \\\"Orientalism\\\", \\\"author\\\": [{\\\"family\\\": \\\"Said\\\", \\\"given\\\": \\\"Edward W.\\\"}], \\\"publisher\\\": \\\"Pantheon Books\\\", \\\"publisher-place\\\": \\\"New York\\\", \\\"issued\\\": {\\\"date-parts\\\": [[1978]]}}]\"}]},{\"title\":\"Formatted citations\",\"description\":\"Plain-text citations for books, journal articles, chapters, and webpages, in Chicago or APA shape. A citation that contains a DOI, PMID, PMCID, or arXiv ID is looked up by that identifier instead.\",\"samples\":[{\"format\":\"freetext\",\"input\":\"Binder, Amy J., and Jeffrey L. Kidder. The Channels of Student Activism: How the Left and Right Are Winning (and Losing) in Campus Politics Today. University of Chicago Press, 2022.\"},{\"format\":\"freetext\",\"input\":\"Ostrom, Elinor. Governing the Commons. Cambridge: Cambridge University Press, 1990.\"},{\"format\":\"freetext\",\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85.\"},{\"format\":\"freetext\",\"input\":\"Doyle, Kathleen. “The Queen Mary Psalter.” In The Book by Design: The Remarkable Story of the World’s Greatest Invention, edited by P. J. M. Marks and Stephen Parkin. University of Chicago Press, 2023.\"},{\"format\":\"freetext\",\"input\":\"Yale University. “About Yale: Yale Facts.” Accessed March 8, 2022. https://www.yale.edu/about-yale/yale-facts.\"},{\"format\":\"doi\",\"embedded\":true,\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85. https://doi.org/10.1086/725865.\"}]}],\"features\":[\"Citation Style (block sidebar): nine styles, Chicago Notes-Bibliography and Author-Date, APA 7, MLA 9, Harvard, IEEE, Vancouver, OSCOLA, and ABNT. Section 3 has an example of each. Switching reformats the generated text and keeps your manual edits.\",\"Heading: type the heading in the block, and choose its level in the sidebar: H2 (where a new block starts) to H6, or Paragraph for styled text that stays out of the page outline. Leave it empty for no heading.\",\"Edit fields: click any citation to correct its authors, title, year, DOI, and other fields; only the fields you change are saved. The pencil edits the displayed text instead, and Reset edits restores the generated text.\",\"Manual Entry: next to Paste / Import, add a citation field by field when there is nothing to paste.\",\"Duplicates: paste a DOI that is already in the list; it is skipped, not added twice.\",\"Order: notes and author-date styles sort alphabetically. Numeric styles (IEEE, Vancouver) keep your order; use Move citation up/down.\",\"Exports (block toolbar): copy the bibliography as text, or download BibTeX, BibLaTeX, RIS, or CSL-JSON.\",\"Per-entry Cite / Export (sidebar, off by default): gives readers copy and download links under each entry on the published page. The Chicago Notes-Bibliography example in section 3 has it on.\",\"Machine-readable output (sidebar): JSON-LD for search engines (on by default), COinS for Zotero, and embedded CSL-JSON. The examples in section 3 show each on and off.\",\"Block settings: like other blocks, a bibliography takes an HTML anchor and extra CSS classes (Advanced), a font size, and top and bottom margin and padding.\",\"Front end: use View Post to see the published bibliography, then open its read-only REST data.\"],\"examples\":[{\"title\":\"Chicago Notes-Bibliography: per-entry Cite / Export\",\"description\":\"A book, a chapter, a journal article, and a webpage, sorted alphabetically. View the published page and open Cite / Export under any entry to copy it or download it as RIS, BibTeX, BibLaTeX, or CSL-JSON. Settings: Per-entry Cite / Export on, and every machine-readable layer on (JSON-LD, COinS, embedded CSL-JSON); heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-notes\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"anchor\":\"demo-chicago-notes\",\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":true,\"outputCiteExport\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"chapter\",\"title\":\"The Library of Babel\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Irby\",\"given\":\"James E.\"}],\"container-title\":\"Labyrinths: Selected Stories and Other Writings\",\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}},{\"type\":\"webpage\",\"title\":\"Block Editor Handbook\",\"author\":[{\"literal\":\"WordPress.org\"}],\"container-title\":\"WordPress Developer Resources\",\"URL\":\"https://developer.wordpress.org/block-editor/\"}],\"exports\":[{\"exportBibtex\":\"@book{Borges1962Labyrinths,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@book{Borges1962Labyrinths,\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@inbook{Borges1962Library,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@inbook{Borges1962Library,\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n\\ttranslator = {Irby, James E.},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournal = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tyear = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournaltitle = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tdate = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@misc{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n\\thowpublished = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@online{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\tbooktitle = {WordPress {Developer} {Resources}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\"}]},{\"title\":\"In-text citations and an annotated bibliography\",\"description\":\"Three books with the compiler's own notes, and a paragraph that cites them. Settings: Show annotations on, Chicago Notes-Bibliography. Select a citation in the paragraph and choose Cite in the toolbar to see its entry and page, or select any text and cite it yourself. Then switch the style to IEEE in the block's sidebar and choose Update citations in its Citations in this post panel: every citation becomes a numbered one, pages kept. A theme's margin-note style turns the same citations into sidenotes.\",\"prose\":[\"The footnote is how a historian shows the work: Grafton, The Footnote. Print made that kind of checking possible at scale, by fixing texts so that every reader saw the same page: Eisenstein, The Printing Press as an Agent of Change. A citation is also a tool in Ivan Illich's sense, one that serves the reader only while it stays small enough to follow: Illich, Tools for Conviviality, chap. 3.\"],\"attributes\":{\"bibliographyId\":\"demo-cite-annotate\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"anchor\":\"demo-cite-annotate\",\"showAnnotations\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Tools for Conviviality\",\"author\":[{\"family\":\"Illich\",\"given\":\"Ivan\"}],\"publisher\":\"Harper & Row\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1973]]},\"annote\":\"Argues that past a certain scale, tools begin to serve themselves rather than the people who use them, and proposes limits that keep them convivial.\\n\\nThe source of the idea of counterfoil research.\"},{\"type\":\"book\",\"title\":\"The Footnote: A Curious History\",\"author\":[{\"family\":\"Grafton\",\"given\":\"Anthony\"}],\"publisher\":\"Harvard University Press\",\"publisher-place\":\"Cambridge, MA\",\"issued\":{\"date-parts\":[[1997]]},\"annote\":\"A history of the scholarly footnote, from Ranke and Gibbon back to the early modern antiquaries: how notes became the way historians make their work checkable.\"},{\"type\":\"book\",\"title\":\"The Printing Press as an Agent of Change: Communications and Cultural Transformations in Early-Modern Europe\",\"author\":[{\"family\":\"Eisenstein\",\"given\":\"Elizabeth L.\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1979]]},\"annote\":\"Argues that printing changed how knowledge was preserved, standardized, and spread, and so helped shape the Renaissance, the Reformation, and the Scientific Revolution.\"}]},{\"title\":\"Chicago Author-Date: same author, same year\",\"description\":\"Three of Einstein’s 1905 papers. Author-date styles letter works by one author in one year (1905a, 1905b, 1905c) so in-text citations stay unambiguous. Settings: the default output (JSON-LD only); heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-author-date\",\"citationStyle\":\"chicago-author-date\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Zur Elektrodynamik bewegter Körper\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"10\",\"page\":\"891-921\",\"DOI\":\"10.1002/andp.19053221004\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Über einen die Erzeugung und Verwandlung des Lichtes betreffenden heuristischen Gesichtspunkt\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"6\",\"page\":\"132-148\",\"DOI\":\"10.1002/andp.19053220607\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"323\",\"issue\":\"13\",\"page\":\"639-641\",\"DOI\":\"10.1002/andp.19053231314\",\"issued\":{\"date-parts\":[[1905]]}}]},{\"title\":\"APA 7\",\"description\":\"Journal articles and an arXiv preprint, with DOIs as links. Settings: the default output (JSON-LD only), with the heading at the Paragraph level, so it is styled text rather than a heading.\",\"attributes\":{\"bibliographyId\":\"demo-apa-7\",\"citationStyle\":\"apa-7\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Deep learning\",\"author\":[{\"family\":\"LeCun\",\"given\":\"Yann\"},{\"family\":\"Bengio\",\"given\":\"Yoshua\"},{\"family\":\"Hinton\",\"given\":\"Geoffrey\"}],\"container-title\":\"Nature\",\"volume\":\"521\",\"issue\":\"7553\",\"page\":\"436-444\",\"DOI\":\"10.1038/nature14539\",\"issued\":{\"date-parts\":[[2015]]}},{\"type\":\"article\",\"title\":\"Attention is all you need\",\"author\":[{\"family\":\"Vaswani\",\"given\":\"Ashish\"},{\"family\":\"Shazeer\",\"given\":\"Noam\"},{\"family\":\"Parmar\",\"given\":\"Niki\"},{\"family\":\"Uszkoreit\",\"given\":\"Jakob\"},{\"family\":\"Jones\",\"given\":\"Llion\"},{\"family\":\"Gomez\",\"given\":\"Aidan N.\"},{\"family\":\"Kaiser\",\"given\":\"Łukasz\"},{\"family\":\"Polosukhin\",\"given\":\"Illia\"}],\"publisher\":\"arXiv\",\"number\":\"1706.03762\",\"DOI\":\"10.48550/arXiv.1706.03762\",\"issued\":{\"date-parts\":[[2017]]}},{\"type\":\"article-journal\",\"title\":\"Computing machinery and intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}}]},{\"title\":\"MLA 9: repeated authors\",\"description\":\"Works by one author list the name once, then three hyphens, as MLA asks. Settings: COinS on, so Zotero’s browser connector can save every entry; heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-mla-9\",\"citationStyle\":\"mla-9\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Ficciones\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Kerrigan\",\"given\":\"Anthony\"}],\"publisher\":\"Grove Press\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Other Inquisitions, 1937–1952\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Simms\",\"given\":\"Ruth L. C.\"}],\"publisher\":\"University of Texas Press\",\"publisher-place\":\"Austin\",\"issued\":{\"date-parts\":[[1964]]}},{\"type\":\"book\",\"title\":\"Borges: A Life\",\"author\":[{\"family\":\"Woodall\",\"given\":\"James\"}],\"publisher\":\"Basic Books\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1996]]}}]},{\"title\":\"Harvard: a bare list\",\"description\":\"No heading and no machine-readable output: just the entries. Settings: heading left empty, JSON-LD off, and the block’s Typography font size set to Small.\",\"attributes\":{\"bibliographyId\":\"demo-harvard\",\"citationStyle\":\"harvard\",\"headingText\":\"\",\"fontSize\":\"small\",\"outputJsonLd\":false,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Governing the Commons: The Evolution of Institutions for Collective Action\",\"author\":[{\"family\":\"Ostrom\",\"given\":\"Elinor\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1990]]}},{\"type\":\"book\",\"title\":\"The Structure of Scientific Revolutions\",\"author\":[{\"family\":\"Kuhn\",\"given\":\"Thomas S.\"}],\"publisher\":\"University of Chicago Press\",\"publisher-place\":\"Chicago\",\"issued\":{\"date-parts\":[[1962]]}}]},{\"title\":\"IEEE\",\"description\":\"Numbered entries keep the order you give them. Select the block and use Move citation up/down to renumber. Journals print by their abbreviated titles, from each record's short title. Settings: the defaults, in a numbered list.\",\"attributes\":{\"bibliographyId\":\"demo-ieee\",\"citationStyle\":\"ieee\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"A Mathematical Theory of Communication\",\"author\":[{\"family\":\"Shannon\",\"given\":\"Claude E.\"}],\"container-title\":\"Bell System Technical Journal\",\"container-title-short\":\"Bell Syst. Tech. J.\",\"volume\":\"27\",\"issue\":\"3\",\"page\":\"379-423\",\"DOI\":\"10.1002/j.1538-7305.1948.tb01338.x\",\"issued\":{\"date-parts\":[[1948]]}},{\"type\":\"article-journal\",\"title\":\"Computing Machinery and Intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"container-title-short\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"container-title-short\":\"Comput. J.\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}}]},{\"title\":\"Vancouver: biomedical references\",\"description\":\"Numbered entries with PubMed IDs; authors after the sixth become “et al.” Settings: embedded CSL-JSON on (a script tag other tools can read), beside the default JSON-LD; heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-vancouver\",\"citationStyle\":\"vancouver\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":true,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid\",\"author\":[{\"family\":\"Watson\",\"given\":\"J. D.\"},{\"family\":\"Crick\",\"given\":\"F. H. C.\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"171\",\"issue\":\"4356\",\"page\":\"737-738\",\"DOI\":\"10.1038/171737a0\",\"PMID\":\"13054692\",\"issued\":{\"date-parts\":[[1953,4,25]]}},{\"type\":\"article-journal\",\"title\":\"Highly accurate protein structure prediction with AlphaFold\",\"author\":[{\"family\":\"Jumper\",\"given\":\"John\"},{\"family\":\"Evans\",\"given\":\"Richard\"},{\"family\":\"Pritzel\",\"given\":\"Alexander\"},{\"family\":\"Green\",\"given\":\"Tim\"},{\"family\":\"Figurnov\",\"given\":\"Michael\"},{\"family\":\"Ronneberger\",\"given\":\"Olaf\"},{\"family\":\"Tunyasuvunakool\",\"given\":\"Kathryn\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"596\",\"issue\":\"7873\",\"page\":\"583-589\",\"DOI\":\"10.1038/s41586-021-03819-2\",\"PMID\":\"34265844\",\"issued\":{\"date-parts\":[[2021,8]]}}]},{\"title\":\"OSCOLA: tables of cases, legislation, and treaties\",\"description\":\"OSCOLA 5 lists primary sources in their own tables before the secondary sources. Each table’s label sits one level below the block heading. Settings: the default output; heading Bibliography at level H4, so the tables are labeled at H5.\",\"attributes\":{\"bibliographyId\":\"demo-oscola\",\"citationStyle\":\"oscola\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"legal_case\",\"title\":\"Donoghue v Stevenson\",\"container-title\":\"AC\",\"issued\":{\"date-parts\":[[1932]]},\"number\":\"562\"},{\"type\":\"legal_case\",\"title\":\"Carlill v Carbolic Smoke Ball Co\",\"container-title\":\"1 QB\",\"issued\":{\"date-parts\":[[1893]]},\"number\":\"256\"},{\"type\":\"legislation\",\"title\":\"Human Rights Act\",\"issued\":{\"date-parts\":[[1998]]}},{\"type\":\"regulation\",\"title\":\"Air Navigation Order 2016\",\"number\":\"SI 2016/765\"},{\"type\":\"treaty\",\"title\":\"Convention for the Protection of Human Rights and Fundamental Freedoms\",\"container-title\":\"213 UNTS\",\"page\":\"221\",\"issued\":{\"date-parts\":[[1950,11,4]]}},{\"type\":\"book\",\"title\":\"Constitutional and Administrative Law\",\"author\":[{\"family\":\"Bradley\",\"given\":\"A. W.\"},{\"family\":\"Ewing\",\"given\":\"K. D.\"},{\"family\":\"Knight\",\"given\":\"C. J. S.\"}],\"edition\":\"17\",\"publisher\":\"Pearson\",\"issued\":{\"date-parts\":[[2018]]}},{\"type\":\"article-journal\",\"title\":\"The Rule of Law\",\"author\":[{\"family\":\"Bingham\",\"given\":\"Tom\"}],\"container-title\":\"Cambridge Law Journal\",\"container-title-short\":\"CLJ\",\"volume\":\"66\",\"page\":\"67\",\"issued\":{\"date-parts\":[[2007]]}}]},{\"title\":\"ABNT: Brazilian references\",\"description\":\"Surnames in capitals, with particles such as “de” after the given name, sorted by surname. Settings: the default output; heading Referências at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-abnt\",\"citationStyle\":\"abnt\",\"headingText\":\"Referências\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"O alienista\",\"author\":[{\"family\":\"Assis\",\"given\":\"Machado\",\"dropping-particle\":\"de\"}],\"publisher\":\"Ática\",\"publisher-place\":\"São Paulo\",\"issued\":{\"date-parts\":[[1997]]}},{\"type\":\"book\",\"title\":\"Raízes do Brasil\",\"author\":[{\"family\":\"Holanda\",\"given\":\"Sérgio Buarque\",\"dropping-particle\":\"de\"}],\"publisher\":\"José Olympio\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1936]]}},{\"type\":\"book\",\"title\":\"Casa-grande & senzala\",\"author\":[{\"family\":\"Freyre\",\"given\":\"Gilberto\"}],\"publisher\":\"Maia & Schmidt\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1933]]}}]}]}\nJSON;\n/**\n * Playground demo page builder.\n *\n * `npm run playground:build` inlines this file into each demo blueprint's\n * runPHP step, after defining:\n *\n * - $borges_demo_json The contents of playground/demo-content.json.\n * - $borges_demo_intro An HTML lead paragraph for that blueprint.\n *\n * It rewrites post 1 as the demo page the blueprint lands on, and turns off\n * the editor's Welcome Guide so the page is visible straight away. Example\n * bibliographies are formatted with the plugin's own citeproc formatter and\n * rendered with its PHP port of save(), so they validate against whatever\n * version is installed. A release without that port (before 1.7.0) gets a\n * note instead.\n *\n * Not part of the plugin package (playground/ is in .distignore).\n *\n * @package BibliographyBuilder\n */\n\nrequire_once '/wordpress/wp-load.php';\n\n// Write as the admin, and keep kses from stripping the blocks' JSON-LD\n// scripts and data attributes: kses_init() ran before any user was set.\nwp_set_current_user( 1 );\nkses_remove_filters();\n\n$borges_demo = json_decode( $borges_demo_json, true );\n\n$borges_demo_block = static function ( $name, $attrs, $html ) {\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => $name,\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$borges_demo_paragraph = static function ( $html ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block( 'core/paragraph', array(), '

' . $html . '

' );\n};\n\n$borges_demo_heading = static function ( $text, $level ) use ( $borges_demo_block ) {\n\t$attrs = 2 === $level ? array() : array( 'level' => $level );\n\t$tag = 'h' . $level;\n\n\treturn $borges_demo_block( 'core/heading', $attrs, '<' . $tag . ' class=\"wp-block-heading\">' . esc_html( $text ) . '' );\n};\n\n$borges_demo_code = static function ( $text ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block(\n\t\t'core/code',\n\t\tarray(),\n\t\t'
' . htmlspecialchars( $text, ENT_NOQUOTES, 'UTF-8' ) . '
'\n\t);\n};\n\n$borges_demo_list = static function ( $items ) {\n\t$html = \"\\n\\n\\n\\n\";\n};\n\n$borges_demo_can_prebuild = function_exists( 'bibliography_builder_render_save_markup' )\n\t&& function_exists( 'bibliography_builder_format_csl_items' )\n\t&& bibliography_builder_can_render_save_markup();\n\n// Returns the serialized block, or '' when this install cannot build it.\n$borges_demo_bibliography = static function ( $example ) use ( $borges_demo_can_prebuild ) {\n\tif ( ! $borges_demo_can_prebuild ) {\n\t\treturn '';\n\t}\n\n\t$csl_items = bibliography_builder_validate_and_sanitize_csl_items( $example['citations'] );\n\n\tif ( is_wp_error( $csl_items ) ) {\n\t\treturn '';\n\t}\n\n\t$formatted = bibliography_builder_format_csl_items( $csl_items, $example['attributes']['citationStyle'] );\n\n\tif ( is_wp_error( $formatted ) ) {\n\t\treturn '';\n\t}\n\n\t$citations = array();\n\n\tforeach ( array_values( $csl_items ) as $index => $csl ) {\n\t\t$citation = array(\n\t\t\t'id' => $example['attributes']['bibliographyId'] . '-' . ( $index + 1 ),\n\t\t\t'csl' => $csl,\n\t\t\t'formattedText' => $formatted[ $index ],\n\t\t);\n\n\t\t// The editor stores these for Cite / Export; without them it adds\n\t\t// them on load and the untouched demo opens with unsaved changes.\n\t\tforeach ( array( 'exportBibtex', 'exportBiblatex' ) as $export_key ) {\n\t\t\tif ( isset( $example['exports'][ $index ][ $export_key ] ) ) {\n\t\t\t\t$citation[ $export_key ] = $example['exports'][ $index ][ $export_key ];\n\t\t\t}\n\t\t}\n\n\t\t$citations[] = $citation;\n\t}\n\n\t$attrs = $example['attributes'];\n\t// Stored in display order, as the editor stores them.\n\t$attrs['citations'] = bibliography_builder_sort_citations_for_save( $citations, $attrs['citationStyle'] );\n\t// Render from the attributes as the editor will parse them back.\n\t$html = bibliography_builder_render_save_markup(\n\t\tbibliography_builder_decode_save_attributes( wp_json_encode( $attrs ) )\n\t);\n\n\tif ( '' === $html ) {\n\t\treturn '';\n\t}\n\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => 'bibliography-builder/bibliography',\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$content = $borges_demo_paragraph( $borges_demo_intro );\n\n$content .= $borges_demo_heading( '1. Paste any supported format', 2 );\n$content .= $borges_demo_paragraph(\n\t'Select the empty Bibliography block at the end of this section, open Paste / Import, paste one or more samples, and choose Add. Separate entries with a blank line; up to 50 go in one paste, so you can copy several groups at once. A CSL-JSON document goes in a paste of its own.'\n);\n\nforeach ( $borges_demo['sampleGroups'] as $group ) {\n\t$content .= $borges_demo_heading( $group['title'], 3 );\n\t$content .= $borges_demo_paragraph( $group['description'] );\n\t$content .= $borges_demo_code( implode( \"\\n\\n\", wp_list_pluck( $group['samples'], 'input' ) ) );\n}\n\n$content .= $borges_demo_block(\n\t'bibliography-builder/bibliography',\n\tarray(\n\t\t'bibliographyId' => 'demo-try-it',\n\t\t'headingText' => 'References',\n\t),\n\t''\n);\n\n$content .= $borges_demo_heading( '2. Key features to try', 2 );\n$content .= $borges_demo_list( $borges_demo['features'] );\n\n$content .= $borges_demo_heading( '3. Example bibliographies', 2 );\n\n$borges_demo_examples = '';\n\nforeach ( $borges_demo['examples'] as $example ) {\n\t$block = $borges_demo_bibliography( $example );\n\n\tif ( '' === $block ) {\n\t\tcontinue;\n\t}\n\n\t$borges_demo_examples .= $borges_demo_heading( $example['title'], 3 );\n\t$borges_demo_examples .= $borges_demo_paragraph( $example['description'] );\n\n\t// Paragraphs that cite the example's entries with the \"Cite\" format, as\n\t// it saves them: links to `#ref-{bibliographyId}-{n}`, the IDs given above.\n\tforeach ( isset( $example['prose'] ) ? $example['prose'] : array() as $prose ) {\n\t\t$borges_demo_examples .= $borges_demo_paragraph( $prose );\n\t}\n\n\t$borges_demo_examples .= $block;\n}\n\n$content .= '' !== $borges_demo_examples\n\t? $borges_demo_paragraph( 'One example per citation style, each built from CSL-JSON. Under each title, Settings names the block settings it shows. Select a block to change them, or view the published page to see them as readers do.' ) . $borges_demo_examples\n\t: $borges_demo_paragraph( 'Pre-built examples need Borges 1.7.0 or later. Paste a few samples from section 1 to build your own.' );\n\nwp_update_post(\n\tarray(\n\t\t'ID' => 1,\n\t\t'post_title' => $borges_demo['title'],\n\t\t'post_content' => wp_slash( $content ),\n\t)\n);\n\n// Skip the block editor's Welcome Guide so the demo page is what opens.\n$borges_demo_meta_key = $GLOBALS['wpdb']->get_blog_prefix() . 'persisted_preferences';\n$borges_demo_preferences = get_user_meta( 1, $borges_demo_meta_key, true );\n$borges_demo_preferences = is_array( $borges_demo_preferences ) ? $borges_demo_preferences : array();\n\n$borges_demo_preferences['core/edit-post'] = array_merge(\n\tisset( $borges_demo_preferences['core/edit-post'] ) && is_array( $borges_demo_preferences['core/edit-post'] )\n\t\t? $borges_demo_preferences['core/edit-post']\n\t\t: array(),\n\tarray( 'welcomeGuide' => false )\n);\n$borges_demo_preferences['_modified'] = gmdate( 'c' );\n\nupdate_user_meta( 1, $borges_demo_meta_key, $borges_demo_preferences );\n" } ] } diff --git a/playground/blueprint-main.json b/playground/blueprint-main.json index 5a62325..953860b 100644 --- a/playground/blueprint-main.json +++ b/playground/blueprint-main.json @@ -48,7 +48,7 @@ }, { "step": "runPHP", - "code": "Welcome to the Borges Bibliography Builder development build. This Playground runs the current main branch, not a stable release. It is a sandbox: nothing here is kept after you close the tab.';\n$borges_demo_json = <<<'JSON'\n{\"title\":\"Borges Bibliography Builder demo\",\"sampleGroups\":[{\"title\":\"DOIs\",\"description\":\"A bare DOI, a doi: prefix, or a doi.org link. Metadata comes from Crossref.\",\"samples\":[{\"format\":\"doi\",\"input\":\"10.1038/s41586-020-2649-2\"},{\"format\":\"doi\",\"input\":\"doi:10.1038/nature14539\"},{\"format\":\"doi\",\"input\":\"https://doi.org/10.1145/3368089.3409742\"}]},{\"title\":\"PubMed and PubMed Central\",\"description\":\"A PMID needs its PMID: label. A PMCID starts with PMC, with or without a PMCID: label.\",\"samples\":[{\"format\":\"pmid\",\"input\":\"PMID:26673779\"},{\"format\":\"pmcid\",\"input\":\"PMC3531190\"}]},{\"title\":\"arXiv\",\"description\":\"An arXiv: ID (modern or legacy), an arxiv.org link, or an arXiv DOI.\",\"samples\":[{\"format\":\"arxiv\",\"input\":\"arXiv:1706.03762\"},{\"format\":\"arxiv\",\"input\":\"https://arxiv.org/abs/1810.04805\"},{\"format\":\"arxiv\",\"input\":\"arXiv:hep-th/9711200\"},{\"format\":\"arxiv\",\"input\":\"10.48550/arXiv.2005.14165\"}]},{\"title\":\"ISBNs\",\"description\":\"A labeled ISBN-13 or ISBN-10, or a bare ISBN-13 starting with 978 or 979. Books come from Open Library, with Google Books as a fallback.\",\"samples\":[{\"format\":\"isbn\",\"input\":\"ISBN 978-0-14-032872-1\"},{\"format\":\"isbn\",\"input\":\"9780262033848\"},{\"format\":\"isbn\",\"input\":\"ISBN-10: 0-8112-0012-4\"}]},{\"title\":\"Library catalogs and the Internet Archive\",\"description\":\"An OCLC number or LCCN needs its label (or its WorldCat or lccn.loc.gov link); an Open Library edition ID (OL…M) works on its own. An archive.org item link, ia: identifier, or ARK cites the edition the item names and keeps the archive.org page as the link. Records come from Open Library and the Internet Archive.\",\"samples\":[{\"format\":\"catalog\",\"input\":\"OCLC 297222669\"},{\"format\":\"catalog\",\"input\":\"LCCN 76-28766\"},{\"format\":\"archive\",\"input\":\"https://archive.org/details/limitstomedicine00illi\"}]},{\"title\":\"BibTeX and BibLaTeX\",\"description\":\"Whole entries, one or many. BibLaTeX fields such as date and location are understood.\",\"samples\":[{\"format\":\"bibtex\",\"input\":\"@article{knuth1984literate,\\n author = {Knuth, Donald E.},\\n title = {Literate Programming},\\n journal = {The Computer Journal},\\n year = {1984},\\n volume = {27},\\n number = {2},\\n pages = {97--111},\\n doi = {10.1093/comjnl/27.2.97}\\n}\"},{\"format\":\"bibtex\",\"input\":\"@book{borges1962labyrinths,\\n author = {Borges, Jorge Luis},\\n title = {Labyrinths: Selected Stories and Other Writings},\\n editor = {Yates, Donald A. and Irby, James E.},\\n date = {1962},\\n publisher = {New Directions},\\n location = {New York}\\n}\"}]},{\"title\":\"RIS\",\"description\":\"Records exported from Zotero, Mendeley, EndNote, or another reference manager, one or many. Each record runs from TY - to ER -.\",\"samples\":[{\"format\":\"ris\",\"input\":\"TY - BOOK\\nAU - Kuhn, Thomas S.\\nTI - The Structure of Scientific Revolutions\\nPY - 1962\\nPB - University of Chicago Press\\nCY - Chicago\\nER - \"},{\"format\":\"ris\",\"input\":\"TY - CHAP\\nAU - Geertz, Clifford\\nTI - Thick Description: Toward an Interpretive Theory of Culture\\nT2 - The Interpretation of Cultures\\nPY - 1973\\nSP - 3\\nEP - 30\\nPB - Basic Books\\nCY - New York\\nER - \"}]},{\"title\":\"CSL-JSON\",\"description\":\"A reference manager’s CSL JSON export, or a CSL-JSON file downloaded from Borges. Paste a CSL-JSON document on its own, not mixed with other samples.\",\"samples\":[{\"format\":\"csl-json\",\"input\":\"[{\\\"type\\\": \\\"book\\\", \\\"title\\\": \\\"Orientalism\\\", \\\"author\\\": [{\\\"family\\\": \\\"Said\\\", \\\"given\\\": \\\"Edward W.\\\"}], \\\"publisher\\\": \\\"Pantheon Books\\\", \\\"publisher-place\\\": \\\"New York\\\", \\\"issued\\\": {\\\"date-parts\\\": [[1978]]}}]\"}]},{\"title\":\"Formatted citations\",\"description\":\"Plain-text citations for books, journal articles, chapters, and webpages, in Chicago or APA shape. A citation that contains a DOI, PMID, PMCID, or arXiv ID is looked up by that identifier instead.\",\"samples\":[{\"format\":\"freetext\",\"input\":\"Binder, Amy J., and Jeffrey L. Kidder. The Channels of Student Activism: How the Left and Right Are Winning (and Losing) in Campus Politics Today. University of Chicago Press, 2022.\"},{\"format\":\"freetext\",\"input\":\"Ostrom, Elinor. Governing the Commons. Cambridge: Cambridge University Press, 1990.\"},{\"format\":\"freetext\",\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85.\"},{\"format\":\"freetext\",\"input\":\"Doyle, Kathleen. “The Queen Mary Psalter.” In The Book by Design: The Remarkable Story of the World’s Greatest Invention, edited by P. J. M. Marks and Stephen Parkin. University of Chicago Press, 2023.\"},{\"format\":\"freetext\",\"input\":\"Yale University. “About Yale: Yale Facts.” Accessed March 8, 2022. https://www.yale.edu/about-yale/yale-facts.\"},{\"format\":\"doi\",\"embedded\":true,\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85. https://doi.org/10.1086/725865.\"}]}],\"features\":[\"Citation Style (block sidebar): nine styles, Chicago Notes-Bibliography and Author-Date, APA 7, MLA 9, Harvard, IEEE, Vancouver, OSCOLA, and ABNT. Section 3 has an example of each. Switching reformats the generated text and keeps your manual edits.\",\"Heading: type the heading in the block, and choose its level in the sidebar: H2 (where a new block starts) to H6, or Paragraph for styled text that stays out of the page outline. Leave it empty for no heading.\",\"Edit fields: click any citation to correct its authors, title, year, DOI, and other fields; only the fields you change are saved. The pencil edits the displayed text instead, and Reset edits restores the generated text.\",\"Manual Entry: next to Paste / Import, add a citation field by field when there is nothing to paste.\",\"Duplicates: paste a DOI that is already in the list; it is skipped, not added twice.\",\"Order: notes and author-date styles sort alphabetically. Numeric styles (IEEE, Vancouver) keep your order; use Move citation up/down.\",\"Exports (block toolbar): copy the bibliography as text, or download BibTeX, BibLaTeX, RIS, or CSL-JSON.\",\"Per-entry Cite / Export (sidebar, off by default): gives readers copy and download links under each entry on the published page. The Chicago Notes-Bibliography example in section 3 has it on.\",\"Machine-readable output (sidebar): JSON-LD for search engines (on by default), COinS for Zotero, and embedded CSL-JSON. The examples in section 3 show each on and off.\",\"Block settings: like other blocks, a bibliography takes an HTML anchor and extra CSS classes (Advanced), a font size, and top and bottom margin and padding.\",\"Front end: use View Post to see the published bibliography, then open its read-only REST data.\"],\"examples\":[{\"title\":\"Chicago Notes-Bibliography: per-entry Cite / Export\",\"description\":\"A book, a chapter, a journal article, and a webpage, sorted alphabetically. View the published page and open Cite / Export under any entry to copy it or download it as RIS, BibTeX, BibLaTeX, or CSL-JSON. Settings: Per-entry Cite / Export on, and every machine-readable layer on (JSON-LD, COinS, embedded CSL-JSON); heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-notes\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"anchor\":\"demo-chicago-notes\",\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":true,\"outputCiteExport\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"chapter\",\"title\":\"The Library of Babel\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Irby\",\"given\":\"James E.\"}],\"container-title\":\"Labyrinths: Selected Stories and Other Writings\",\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}},{\"type\":\"webpage\",\"title\":\"Block Editor Handbook\",\"author\":[{\"literal\":\"WordPress.org\"}],\"container-title\":\"WordPress Developer Resources\",\"URL\":\"https://developer.wordpress.org/block-editor/\"}],\"exports\":[{\"exportBibtex\":\"@book{Borges1962Labyrinths,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@book{Borges1962Labyrinths,\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@inbook{Borges1962Library,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@inbook{Borges1962Library,\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n\\ttranslator = {Irby, James E.},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournal = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tyear = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournaltitle = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tdate = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@misc{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n\\thowpublished = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@online{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\tbooktitle = {WordPress {Developer} {Resources}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\"}]},{\"title\":\"Chicago Author-Date: same author, same year\",\"description\":\"Three of Einstein’s 1905 papers. Author-date styles letter works by one author in one year (1905a, 1905b, 1905c) so in-text citations stay unambiguous. Settings: the default output (JSON-LD only); heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-author-date\",\"citationStyle\":\"chicago-author-date\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Zur Elektrodynamik bewegter Körper\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"10\",\"page\":\"891-921\",\"DOI\":\"10.1002/andp.19053221004\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Über einen die Erzeugung und Verwandlung des Lichtes betreffenden heuristischen Gesichtspunkt\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"6\",\"page\":\"132-148\",\"DOI\":\"10.1002/andp.19053220607\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"323\",\"issue\":\"13\",\"page\":\"639-641\",\"DOI\":\"10.1002/andp.19053231314\",\"issued\":{\"date-parts\":[[1905]]}}]},{\"title\":\"APA 7\",\"description\":\"Journal articles and an arXiv preprint, with DOIs as links. Settings: the default output (JSON-LD only), with the heading at the Paragraph level, so it is styled text rather than a heading.\",\"attributes\":{\"bibliographyId\":\"demo-apa-7\",\"citationStyle\":\"apa-7\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Deep learning\",\"author\":[{\"family\":\"LeCun\",\"given\":\"Yann\"},{\"family\":\"Bengio\",\"given\":\"Yoshua\"},{\"family\":\"Hinton\",\"given\":\"Geoffrey\"}],\"container-title\":\"Nature\",\"volume\":\"521\",\"issue\":\"7553\",\"page\":\"436-444\",\"DOI\":\"10.1038/nature14539\",\"issued\":{\"date-parts\":[[2015]]}},{\"type\":\"article\",\"title\":\"Attention is all you need\",\"author\":[{\"family\":\"Vaswani\",\"given\":\"Ashish\"},{\"family\":\"Shazeer\",\"given\":\"Noam\"},{\"family\":\"Parmar\",\"given\":\"Niki\"},{\"family\":\"Uszkoreit\",\"given\":\"Jakob\"},{\"family\":\"Jones\",\"given\":\"Llion\"},{\"family\":\"Gomez\",\"given\":\"Aidan N.\"},{\"family\":\"Kaiser\",\"given\":\"Łukasz\"},{\"family\":\"Polosukhin\",\"given\":\"Illia\"}],\"publisher\":\"arXiv\",\"number\":\"1706.03762\",\"DOI\":\"10.48550/arXiv.1706.03762\",\"issued\":{\"date-parts\":[[2017]]}},{\"type\":\"article-journal\",\"title\":\"Computing machinery and intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}}]},{\"title\":\"MLA 9: repeated authors\",\"description\":\"Works by one author list the name once, then three hyphens, as MLA asks. Settings: COinS on, so Zotero’s browser connector can save every entry; heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-mla-9\",\"citationStyle\":\"mla-9\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Ficciones\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Kerrigan\",\"given\":\"Anthony\"}],\"publisher\":\"Grove Press\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Other Inquisitions, 1937–1952\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Simms\",\"given\":\"Ruth L. C.\"}],\"publisher\":\"University of Texas Press\",\"publisher-place\":\"Austin\",\"issued\":{\"date-parts\":[[1964]]}},{\"type\":\"book\",\"title\":\"Borges: A Life\",\"author\":[{\"family\":\"Woodall\",\"given\":\"James\"}],\"publisher\":\"Basic Books\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1996]]}}]},{\"title\":\"Harvard: a bare list\",\"description\":\"No heading and no machine-readable output: just the entries. Settings: heading left empty, JSON-LD off, and the block’s Typography font size set to Small.\",\"attributes\":{\"bibliographyId\":\"demo-harvard\",\"citationStyle\":\"harvard\",\"headingText\":\"\",\"fontSize\":\"small\",\"outputJsonLd\":false,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Governing the Commons: The Evolution of Institutions for Collective Action\",\"author\":[{\"family\":\"Ostrom\",\"given\":\"Elinor\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1990]]}},{\"type\":\"book\",\"title\":\"The Structure of Scientific Revolutions\",\"author\":[{\"family\":\"Kuhn\",\"given\":\"Thomas S.\"}],\"publisher\":\"University of Chicago Press\",\"publisher-place\":\"Chicago\",\"issued\":{\"date-parts\":[[1962]]}}]},{\"title\":\"IEEE\",\"description\":\"Numbered entries keep the order you give them. Select the block and use Move citation up/down to renumber. Journals print by their abbreviated titles, from each record's short title. Settings: the defaults, in a numbered list.\",\"attributes\":{\"bibliographyId\":\"demo-ieee\",\"citationStyle\":\"ieee\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"A Mathematical Theory of Communication\",\"author\":[{\"family\":\"Shannon\",\"given\":\"Claude E.\"}],\"container-title\":\"Bell System Technical Journal\",\"container-title-short\":\"Bell Syst. Tech. J.\",\"volume\":\"27\",\"issue\":\"3\",\"page\":\"379-423\",\"DOI\":\"10.1002/j.1538-7305.1948.tb01338.x\",\"issued\":{\"date-parts\":[[1948]]}},{\"type\":\"article-journal\",\"title\":\"Computing Machinery and Intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"container-title-short\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"container-title-short\":\"Comput. J.\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}}]},{\"title\":\"Vancouver: biomedical references\",\"description\":\"Numbered entries with PubMed IDs; authors after the sixth become “et al.” Settings: embedded CSL-JSON on (a script tag other tools can read), beside the default JSON-LD; heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-vancouver\",\"citationStyle\":\"vancouver\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":true,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid\",\"author\":[{\"family\":\"Watson\",\"given\":\"J. D.\"},{\"family\":\"Crick\",\"given\":\"F. H. C.\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"171\",\"issue\":\"4356\",\"page\":\"737-738\",\"DOI\":\"10.1038/171737a0\",\"PMID\":\"13054692\",\"issued\":{\"date-parts\":[[1953,4,25]]}},{\"type\":\"article-journal\",\"title\":\"Highly accurate protein structure prediction with AlphaFold\",\"author\":[{\"family\":\"Jumper\",\"given\":\"John\"},{\"family\":\"Evans\",\"given\":\"Richard\"},{\"family\":\"Pritzel\",\"given\":\"Alexander\"},{\"family\":\"Green\",\"given\":\"Tim\"},{\"family\":\"Figurnov\",\"given\":\"Michael\"},{\"family\":\"Ronneberger\",\"given\":\"Olaf\"},{\"family\":\"Tunyasuvunakool\",\"given\":\"Kathryn\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"596\",\"issue\":\"7873\",\"page\":\"583-589\",\"DOI\":\"10.1038/s41586-021-03819-2\",\"PMID\":\"34265844\",\"issued\":{\"date-parts\":[[2021,8]]}}]},{\"title\":\"OSCOLA: tables of cases, legislation, and treaties\",\"description\":\"OSCOLA 5 lists primary sources in their own tables before the secondary sources. Each table’s label sits one level below the block heading. Settings: the default output; heading Bibliography at level H4, so the tables are labeled at H5.\",\"attributes\":{\"bibliographyId\":\"demo-oscola\",\"citationStyle\":\"oscola\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"legal_case\",\"title\":\"Donoghue v Stevenson\",\"container-title\":\"AC\",\"issued\":{\"date-parts\":[[1932]]},\"number\":\"562\"},{\"type\":\"legal_case\",\"title\":\"Carlill v Carbolic Smoke Ball Co\",\"container-title\":\"1 QB\",\"issued\":{\"date-parts\":[[1893]]},\"number\":\"256\"},{\"type\":\"legislation\",\"title\":\"Human Rights Act\",\"issued\":{\"date-parts\":[[1998]]}},{\"type\":\"regulation\",\"title\":\"Air Navigation Order 2016\",\"number\":\"SI 2016/765\"},{\"type\":\"treaty\",\"title\":\"Convention for the Protection of Human Rights and Fundamental Freedoms\",\"container-title\":\"213 UNTS\",\"page\":\"221\",\"issued\":{\"date-parts\":[[1950,11,4]]}},{\"type\":\"book\",\"title\":\"Constitutional and Administrative Law\",\"author\":[{\"family\":\"Bradley\",\"given\":\"A. W.\"},{\"family\":\"Ewing\",\"given\":\"K. D.\"},{\"family\":\"Knight\",\"given\":\"C. J. S.\"}],\"edition\":\"17\",\"publisher\":\"Pearson\",\"issued\":{\"date-parts\":[[2018]]}},{\"type\":\"article-journal\",\"title\":\"The Rule of Law\",\"author\":[{\"family\":\"Bingham\",\"given\":\"Tom\"}],\"container-title\":\"Cambridge Law Journal\",\"container-title-short\":\"CLJ\",\"volume\":\"66\",\"page\":\"67\",\"issued\":{\"date-parts\":[[2007]]}}]},{\"title\":\"ABNT: Brazilian references\",\"description\":\"Surnames in capitals, with particles such as “de” after the given name, sorted by surname. Settings: the default output; heading Referências at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-abnt\",\"citationStyle\":\"abnt\",\"headingText\":\"Referências\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"O alienista\",\"author\":[{\"family\":\"Assis\",\"given\":\"Machado\",\"dropping-particle\":\"de\"}],\"publisher\":\"Ática\",\"publisher-place\":\"São Paulo\",\"issued\":{\"date-parts\":[[1997]]}},{\"type\":\"book\",\"title\":\"Raízes do Brasil\",\"author\":[{\"family\":\"Holanda\",\"given\":\"Sérgio Buarque\",\"dropping-particle\":\"de\"}],\"publisher\":\"José Olympio\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1936]]}},{\"type\":\"book\",\"title\":\"Casa-grande & senzala\",\"author\":[{\"family\":\"Freyre\",\"given\":\"Gilberto\"}],\"publisher\":\"Maia & Schmidt\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1933]]}}]}]}\nJSON;\n/**\n * Playground demo page builder.\n *\n * `npm run playground:build` inlines this file into each demo blueprint's\n * runPHP step, after defining:\n *\n * - $borges_demo_json The contents of playground/demo-content.json.\n * - $borges_demo_intro An HTML lead paragraph for that blueprint.\n *\n * It rewrites post 1 as the demo page the blueprint lands on, and turns off\n * the editor's Welcome Guide so the page is visible straight away. Example\n * bibliographies are formatted with the plugin's own citeproc formatter and\n * rendered with its PHP port of save(), so they validate against whatever\n * version is installed. A release without that port (before 1.7.0) gets a\n * note instead.\n *\n * Not part of the plugin package (playground/ is in .distignore).\n *\n * @package BibliographyBuilder\n */\n\nrequire_once '/wordpress/wp-load.php';\n\n// Write as the admin, and keep kses from stripping the blocks' JSON-LD\n// scripts and data attributes: kses_init() ran before any user was set.\nwp_set_current_user( 1 );\nkses_remove_filters();\n\n$borges_demo = json_decode( $borges_demo_json, true );\n\n$borges_demo_block = static function ( $name, $attrs, $html ) {\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => $name,\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$borges_demo_paragraph = static function ( $html ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block( 'core/paragraph', array(), '

' . $html . '

' );\n};\n\n$borges_demo_heading = static function ( $text, $level ) use ( $borges_demo_block ) {\n\t$attrs = 2 === $level ? array() : array( 'level' => $level );\n\t$tag = 'h' . $level;\n\n\treturn $borges_demo_block( 'core/heading', $attrs, '<' . $tag . ' class=\"wp-block-heading\">' . esc_html( $text ) . '' );\n};\n\n$borges_demo_code = static function ( $text ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block(\n\t\t'core/code',\n\t\tarray(),\n\t\t'
' . htmlspecialchars( $text, ENT_NOQUOTES, 'UTF-8' ) . '
'\n\t);\n};\n\n$borges_demo_list = static function ( $items ) {\n\t$html = \"\\n\\n\\n\\n\";\n};\n\n$borges_demo_can_prebuild = function_exists( 'bibliography_builder_render_save_markup' )\n\t&& function_exists( 'bibliography_builder_format_csl_items' )\n\t&& bibliography_builder_can_render_save_markup();\n\n// Returns the serialized block, or '' when this install cannot build it.\n$borges_demo_bibliography = static function ( $example ) use ( $borges_demo_can_prebuild ) {\n\tif ( ! $borges_demo_can_prebuild ) {\n\t\treturn '';\n\t}\n\n\t$csl_items = bibliography_builder_validate_and_sanitize_csl_items( $example['citations'] );\n\n\tif ( is_wp_error( $csl_items ) ) {\n\t\treturn '';\n\t}\n\n\t$formatted = bibliography_builder_format_csl_items( $csl_items, $example['attributes']['citationStyle'] );\n\n\tif ( is_wp_error( $formatted ) ) {\n\t\treturn '';\n\t}\n\n\t$citations = array();\n\n\tforeach ( array_values( $csl_items ) as $index => $csl ) {\n\t\t$citation = array(\n\t\t\t'id' => $example['attributes']['bibliographyId'] . '-' . ( $index + 1 ),\n\t\t\t'csl' => $csl,\n\t\t\t'formattedText' => $formatted[ $index ],\n\t\t);\n\n\t\t// The editor stores these for Cite / Export; without them it adds\n\t\t// them on load and the untouched demo opens with unsaved changes.\n\t\tforeach ( array( 'exportBibtex', 'exportBiblatex' ) as $export_key ) {\n\t\t\tif ( isset( $example['exports'][ $index ][ $export_key ] ) ) {\n\t\t\t\t$citation[ $export_key ] = $example['exports'][ $index ][ $export_key ];\n\t\t\t}\n\t\t}\n\n\t\t$citations[] = $citation;\n\t}\n\n\t$attrs = $example['attributes'];\n\t// Stored in display order, as the editor stores them.\n\t$attrs['citations'] = bibliography_builder_sort_citations_for_save( $citations, $attrs['citationStyle'] );\n\t// Render from the attributes as the editor will parse them back.\n\t$html = bibliography_builder_render_save_markup(\n\t\tbibliography_builder_decode_save_attributes( wp_json_encode( $attrs ) )\n\t);\n\n\tif ( '' === $html ) {\n\t\treturn '';\n\t}\n\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => 'bibliography-builder/bibliography',\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$content = $borges_demo_paragraph( $borges_demo_intro );\n\n$content .= $borges_demo_heading( '1. Paste any supported format', 2 );\n$content .= $borges_demo_paragraph(\n\t'Select the empty Bibliography block at the end of this section, open Paste / Import, paste one or more samples, and choose Add. Separate entries with a blank line; up to 50 go in one paste, so you can copy several groups at once. A CSL-JSON document goes in a paste of its own.'\n);\n\nforeach ( $borges_demo['sampleGroups'] as $group ) {\n\t$content .= $borges_demo_heading( $group['title'], 3 );\n\t$content .= $borges_demo_paragraph( $group['description'] );\n\t$content .= $borges_demo_code( implode( \"\\n\\n\", wp_list_pluck( $group['samples'], 'input' ) ) );\n}\n\n$content .= $borges_demo_block(\n\t'bibliography-builder/bibliography',\n\tarray(\n\t\t'bibliographyId' => 'demo-try-it',\n\t\t'headingText' => 'References',\n\t),\n\t''\n);\n\n$content .= $borges_demo_heading( '2. Key features to try', 2 );\n$content .= $borges_demo_list( $borges_demo['features'] );\n\n$content .= $borges_demo_heading( '3. Example bibliographies', 2 );\n\n$borges_demo_examples = '';\n\nforeach ( $borges_demo['examples'] as $example ) {\n\t$block = $borges_demo_bibliography( $example );\n\n\tif ( '' === $block ) {\n\t\tcontinue;\n\t}\n\n\t$borges_demo_examples .= $borges_demo_heading( $example['title'], 3 );\n\t$borges_demo_examples .= $borges_demo_paragraph( $example['description'] );\n\t$borges_demo_examples .= $block;\n}\n\n$content .= '' !== $borges_demo_examples\n\t? $borges_demo_paragraph( 'One example per citation style, each built from CSL-JSON. Under each title, Settings names the block settings it shows. Select a block to change them, or view the published page to see them as readers do.' ) . $borges_demo_examples\n\t: $borges_demo_paragraph( 'Pre-built examples need Borges 1.7.0 or later. Paste a few samples from section 1 to build your own.' );\n\nwp_update_post(\n\tarray(\n\t\t'ID' => 1,\n\t\t'post_title' => $borges_demo['title'],\n\t\t'post_content' => wp_slash( $content ),\n\t)\n);\n\n// Skip the block editor's Welcome Guide so the demo page is what opens.\n$borges_demo_meta_key = $GLOBALS['wpdb']->get_blog_prefix() . 'persisted_preferences';\n$borges_demo_preferences = get_user_meta( 1, $borges_demo_meta_key, true );\n$borges_demo_preferences = is_array( $borges_demo_preferences ) ? $borges_demo_preferences : array();\n\n$borges_demo_preferences['core/edit-post'] = array_merge(\n\tisset( $borges_demo_preferences['core/edit-post'] ) && is_array( $borges_demo_preferences['core/edit-post'] )\n\t\t? $borges_demo_preferences['core/edit-post']\n\t\t: array(),\n\tarray( 'welcomeGuide' => false )\n);\n$borges_demo_preferences['_modified'] = gmdate( 'c' );\n\nupdate_user_meta( 1, $borges_demo_meta_key, $borges_demo_preferences );\n" + "code": "Welcome to the Borges Bibliography Builder development build. This Playground runs the current main branch, not a stable release. It is a sandbox: nothing here is kept after you close the tab.';\n$borges_demo_json = <<<'JSON'\n{\"title\":\"Borges Bibliography Builder demo\",\"sampleGroups\":[{\"title\":\"DOIs\",\"description\":\"A bare DOI, a doi: prefix, or a doi.org link. Metadata comes from Crossref.\",\"samples\":[{\"format\":\"doi\",\"input\":\"10.1038/s41586-020-2649-2\"},{\"format\":\"doi\",\"input\":\"doi:10.1038/nature14539\"},{\"format\":\"doi\",\"input\":\"https://doi.org/10.1145/3368089.3409742\"}]},{\"title\":\"PubMed and PubMed Central\",\"description\":\"A PMID needs its PMID: label. A PMCID starts with PMC, with or without a PMCID: label.\",\"samples\":[{\"format\":\"pmid\",\"input\":\"PMID:26673779\"},{\"format\":\"pmcid\",\"input\":\"PMC3531190\"}]},{\"title\":\"arXiv\",\"description\":\"An arXiv: ID (modern or legacy), an arxiv.org link, or an arXiv DOI.\",\"samples\":[{\"format\":\"arxiv\",\"input\":\"arXiv:1706.03762\"},{\"format\":\"arxiv\",\"input\":\"https://arxiv.org/abs/1810.04805\"},{\"format\":\"arxiv\",\"input\":\"arXiv:hep-th/9711200\"},{\"format\":\"arxiv\",\"input\":\"10.48550/arXiv.2005.14165\"}]},{\"title\":\"ISBNs\",\"description\":\"A labeled ISBN-13 or ISBN-10, or a bare ISBN-13 starting with 978 or 979. Books come from Open Library, with Google Books as a fallback.\",\"samples\":[{\"format\":\"isbn\",\"input\":\"ISBN 978-0-14-032872-1\"},{\"format\":\"isbn\",\"input\":\"9780262033848\"},{\"format\":\"isbn\",\"input\":\"ISBN-10: 0-8112-0012-4\"}]},{\"title\":\"Library catalogs and the Internet Archive\",\"description\":\"An OCLC number or LCCN needs its label (or its WorldCat or lccn.loc.gov link); an Open Library edition ID (OL…M) works on its own. An archive.org item link, ia: identifier, or ARK cites the edition the item names and keeps the archive.org page as the link. Records come from Open Library and the Internet Archive.\",\"samples\":[{\"format\":\"catalog\",\"input\":\"OCLC 297222669\"},{\"format\":\"catalog\",\"input\":\"LCCN 76-28766\"},{\"format\":\"archive\",\"input\":\"https://archive.org/details/limitstomedicine00illi\"}]},{\"title\":\"BibTeX and BibLaTeX\",\"description\":\"Whole entries, one or many. BibLaTeX fields such as date and location are understood.\",\"samples\":[{\"format\":\"bibtex\",\"input\":\"@article{knuth1984literate,\\n author = {Knuth, Donald E.},\\n title = {Literate Programming},\\n journal = {The Computer Journal},\\n year = {1984},\\n volume = {27},\\n number = {2},\\n pages = {97--111},\\n doi = {10.1093/comjnl/27.2.97}\\n}\"},{\"format\":\"bibtex\",\"input\":\"@book{borges1962labyrinths,\\n author = {Borges, Jorge Luis},\\n title = {Labyrinths: Selected Stories and Other Writings},\\n editor = {Yates, Donald A. and Irby, James E.},\\n date = {1962},\\n publisher = {New Directions},\\n location = {New York}\\n}\"}]},{\"title\":\"RIS\",\"description\":\"Records exported from Zotero, Mendeley, EndNote, or another reference manager, one or many. Each record runs from TY - to ER -.\",\"samples\":[{\"format\":\"ris\",\"input\":\"TY - BOOK\\nAU - Kuhn, Thomas S.\\nTI - The Structure of Scientific Revolutions\\nPY - 1962\\nPB - University of Chicago Press\\nCY - Chicago\\nER - \"},{\"format\":\"ris\",\"input\":\"TY - CHAP\\nAU - Geertz, Clifford\\nTI - Thick Description: Toward an Interpretive Theory of Culture\\nT2 - The Interpretation of Cultures\\nPY - 1973\\nSP - 3\\nEP - 30\\nPB - Basic Books\\nCY - New York\\nER - \"}]},{\"title\":\"CSL-JSON\",\"description\":\"A reference manager’s CSL JSON export, or a CSL-JSON file downloaded from Borges. Paste a CSL-JSON document on its own, not mixed with other samples.\",\"samples\":[{\"format\":\"csl-json\",\"input\":\"[{\\\"type\\\": \\\"book\\\", \\\"title\\\": \\\"Orientalism\\\", \\\"author\\\": [{\\\"family\\\": \\\"Said\\\", \\\"given\\\": \\\"Edward W.\\\"}], \\\"publisher\\\": \\\"Pantheon Books\\\", \\\"publisher-place\\\": \\\"New York\\\", \\\"issued\\\": {\\\"date-parts\\\": [[1978]]}}]\"}]},{\"title\":\"Formatted citations\",\"description\":\"Plain-text citations for books, journal articles, chapters, and webpages, in Chicago or APA shape. A citation that contains a DOI, PMID, PMCID, or arXiv ID is looked up by that identifier instead.\",\"samples\":[{\"format\":\"freetext\",\"input\":\"Binder, Amy J., and Jeffrey L. Kidder. The Channels of Student Activism: How the Left and Right Are Winning (and Losing) in Campus Politics Today. University of Chicago Press, 2022.\"},{\"format\":\"freetext\",\"input\":\"Ostrom, Elinor. Governing the Commons. Cambridge: Cambridge University Press, 1990.\"},{\"format\":\"freetext\",\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85.\"},{\"format\":\"freetext\",\"input\":\"Doyle, Kathleen. “The Queen Mary Psalter.” In The Book by Design: The Remarkable Story of the World’s Greatest Invention, edited by P. J. M. Marks and Stephen Parkin. University of Chicago Press, 2023.\"},{\"format\":\"freetext\",\"input\":\"Yale University. “About Yale: Yale Facts.” Accessed March 8, 2022. https://www.yale.edu/about-yale/yale-facts.\"},{\"format\":\"doi\",\"embedded\":true,\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85. https://doi.org/10.1086/725865.\"}]}],\"features\":[\"Citation Style (block sidebar): nine styles, Chicago Notes-Bibliography and Author-Date, APA 7, MLA 9, Harvard, IEEE, Vancouver, OSCOLA, and ABNT. Section 3 has an example of each. Switching reformats the generated text and keeps your manual edits.\",\"Heading: type the heading in the block, and choose its level in the sidebar: H2 (where a new block starts) to H6, or Paragraph for styled text that stays out of the page outline. Leave it empty for no heading.\",\"Edit fields: click any citation to correct its authors, title, year, DOI, and other fields; only the fields you change are saved. The pencil edits the displayed text instead, and Reset edits restores the generated text.\",\"Manual Entry: next to Paste / Import, add a citation field by field when there is nothing to paste.\",\"Duplicates: paste a DOI that is already in the list; it is skipped, not added twice.\",\"Order: notes and author-date styles sort alphabetically. Numeric styles (IEEE, Vancouver) keep your order; use Move citation up/down.\",\"Exports (block toolbar): copy the bibliography as text, or download BibTeX, BibLaTeX, RIS, or CSL-JSON.\",\"Per-entry Cite / Export (sidebar, off by default): gives readers copy and download links under each entry on the published page. The Chicago Notes-Bibliography example in section 3 has it on.\",\"Machine-readable output (sidebar): JSON-LD for search engines (on by default), COinS for Zotero, and embedded CSL-JSON. The examples in section 3 show each on and off.\",\"Block settings: like other blocks, a bibliography takes an HTML anchor and extra CSS classes (Advanced), a font size, and top and bottom margin and padding.\",\"Front end: use View Post to see the published bibliography, then open its read-only REST data.\"],\"examples\":[{\"title\":\"Chicago Notes-Bibliography: per-entry Cite / Export\",\"description\":\"A book, a chapter, a journal article, and a webpage, sorted alphabetically. View the published page and open Cite / Export under any entry to copy it or download it as RIS, BibTeX, BibLaTeX, or CSL-JSON. Settings: Per-entry Cite / Export on, and every machine-readable layer on (JSON-LD, COinS, embedded CSL-JSON); heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-notes\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"anchor\":\"demo-chicago-notes\",\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":true,\"outputCiteExport\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"chapter\",\"title\":\"The Library of Babel\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Irby\",\"given\":\"James E.\"}],\"container-title\":\"Labyrinths: Selected Stories and Other Writings\",\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}},{\"type\":\"webpage\",\"title\":\"Block Editor Handbook\",\"author\":[{\"literal\":\"WordPress.org\"}],\"container-title\":\"WordPress Developer Resources\",\"URL\":\"https://developer.wordpress.org/block-editor/\"}],\"exports\":[{\"exportBibtex\":\"@book{Borges1962Labyrinths,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@book{Borges1962Labyrinths,\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@inbook{Borges1962Library,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@inbook{Borges1962Library,\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n\\ttranslator = {Irby, James E.},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournal = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tyear = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournaltitle = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tdate = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@misc{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n\\thowpublished = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@online{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\tbooktitle = {WordPress {Developer} {Resources}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\"}]},{\"title\":\"In-text citations and an annotated bibliography\",\"description\":\"Three books with the compiler's own notes, and a paragraph that cites them. Settings: Show annotations on, Chicago Notes-Bibliography. Select a citation in the paragraph and choose Cite in the toolbar to see its entry and page, or select any text and cite it yourself. Then switch the style to IEEE in the block's sidebar and choose Update citations in its Citations in this post panel: every citation becomes a numbered one, pages kept. A theme's margin-note style turns the same citations into sidenotes.\",\"prose\":[\"The footnote is how a historian shows the work: Grafton, The Footnote. Print made that kind of checking possible at scale, by fixing texts so that every reader saw the same page: Eisenstein, The Printing Press as an Agent of Change. A citation is also a tool in Ivan Illich's sense, one that serves the reader only while it stays small enough to follow: Illich, Tools for Conviviality, chap. 3.\"],\"attributes\":{\"bibliographyId\":\"demo-cite-annotate\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"anchor\":\"demo-cite-annotate\",\"showAnnotations\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Tools for Conviviality\",\"author\":[{\"family\":\"Illich\",\"given\":\"Ivan\"}],\"publisher\":\"Harper & Row\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1973]]},\"annote\":\"Argues that past a certain scale, tools begin to serve themselves rather than the people who use them, and proposes limits that keep them convivial.\\n\\nThe source of the idea of counterfoil research.\"},{\"type\":\"book\",\"title\":\"The Footnote: A Curious History\",\"author\":[{\"family\":\"Grafton\",\"given\":\"Anthony\"}],\"publisher\":\"Harvard University Press\",\"publisher-place\":\"Cambridge, MA\",\"issued\":{\"date-parts\":[[1997]]},\"annote\":\"A history of the scholarly footnote, from Ranke and Gibbon back to the early modern antiquaries: how notes became the way historians make their work checkable.\"},{\"type\":\"book\",\"title\":\"The Printing Press as an Agent of Change: Communications and Cultural Transformations in Early-Modern Europe\",\"author\":[{\"family\":\"Eisenstein\",\"given\":\"Elizabeth L.\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1979]]},\"annote\":\"Argues that printing changed how knowledge was preserved, standardized, and spread, and so helped shape the Renaissance, the Reformation, and the Scientific Revolution.\"}]},{\"title\":\"Chicago Author-Date: same author, same year\",\"description\":\"Three of Einstein’s 1905 papers. Author-date styles letter works by one author in one year (1905a, 1905b, 1905c) so in-text citations stay unambiguous. Settings: the default output (JSON-LD only); heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-author-date\",\"citationStyle\":\"chicago-author-date\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Zur Elektrodynamik bewegter Körper\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"10\",\"page\":\"891-921\",\"DOI\":\"10.1002/andp.19053221004\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Über einen die Erzeugung und Verwandlung des Lichtes betreffenden heuristischen Gesichtspunkt\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"6\",\"page\":\"132-148\",\"DOI\":\"10.1002/andp.19053220607\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"323\",\"issue\":\"13\",\"page\":\"639-641\",\"DOI\":\"10.1002/andp.19053231314\",\"issued\":{\"date-parts\":[[1905]]}}]},{\"title\":\"APA 7\",\"description\":\"Journal articles and an arXiv preprint, with DOIs as links. Settings: the default output (JSON-LD only), with the heading at the Paragraph level, so it is styled text rather than a heading.\",\"attributes\":{\"bibliographyId\":\"demo-apa-7\",\"citationStyle\":\"apa-7\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Deep learning\",\"author\":[{\"family\":\"LeCun\",\"given\":\"Yann\"},{\"family\":\"Bengio\",\"given\":\"Yoshua\"},{\"family\":\"Hinton\",\"given\":\"Geoffrey\"}],\"container-title\":\"Nature\",\"volume\":\"521\",\"issue\":\"7553\",\"page\":\"436-444\",\"DOI\":\"10.1038/nature14539\",\"issued\":{\"date-parts\":[[2015]]}},{\"type\":\"article\",\"title\":\"Attention is all you need\",\"author\":[{\"family\":\"Vaswani\",\"given\":\"Ashish\"},{\"family\":\"Shazeer\",\"given\":\"Noam\"},{\"family\":\"Parmar\",\"given\":\"Niki\"},{\"family\":\"Uszkoreit\",\"given\":\"Jakob\"},{\"family\":\"Jones\",\"given\":\"Llion\"},{\"family\":\"Gomez\",\"given\":\"Aidan N.\"},{\"family\":\"Kaiser\",\"given\":\"Łukasz\"},{\"family\":\"Polosukhin\",\"given\":\"Illia\"}],\"publisher\":\"arXiv\",\"number\":\"1706.03762\",\"DOI\":\"10.48550/arXiv.1706.03762\",\"issued\":{\"date-parts\":[[2017]]}},{\"type\":\"article-journal\",\"title\":\"Computing machinery and intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}}]},{\"title\":\"MLA 9: repeated authors\",\"description\":\"Works by one author list the name once, then three hyphens, as MLA asks. Settings: COinS on, so Zotero’s browser connector can save every entry; heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-mla-9\",\"citationStyle\":\"mla-9\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Ficciones\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Kerrigan\",\"given\":\"Anthony\"}],\"publisher\":\"Grove Press\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Other Inquisitions, 1937–1952\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Simms\",\"given\":\"Ruth L. C.\"}],\"publisher\":\"University of Texas Press\",\"publisher-place\":\"Austin\",\"issued\":{\"date-parts\":[[1964]]}},{\"type\":\"book\",\"title\":\"Borges: A Life\",\"author\":[{\"family\":\"Woodall\",\"given\":\"James\"}],\"publisher\":\"Basic Books\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1996]]}}]},{\"title\":\"Harvard: a bare list\",\"description\":\"No heading and no machine-readable output: just the entries. Settings: heading left empty, JSON-LD off, and the block’s Typography font size set to Small.\",\"attributes\":{\"bibliographyId\":\"demo-harvard\",\"citationStyle\":\"harvard\",\"headingText\":\"\",\"fontSize\":\"small\",\"outputJsonLd\":false,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Governing the Commons: The Evolution of Institutions for Collective Action\",\"author\":[{\"family\":\"Ostrom\",\"given\":\"Elinor\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1990]]}},{\"type\":\"book\",\"title\":\"The Structure of Scientific Revolutions\",\"author\":[{\"family\":\"Kuhn\",\"given\":\"Thomas S.\"}],\"publisher\":\"University of Chicago Press\",\"publisher-place\":\"Chicago\",\"issued\":{\"date-parts\":[[1962]]}}]},{\"title\":\"IEEE\",\"description\":\"Numbered entries keep the order you give them. Select the block and use Move citation up/down to renumber. Journals print by their abbreviated titles, from each record's short title. Settings: the defaults, in a numbered list.\",\"attributes\":{\"bibliographyId\":\"demo-ieee\",\"citationStyle\":\"ieee\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"A Mathematical Theory of Communication\",\"author\":[{\"family\":\"Shannon\",\"given\":\"Claude E.\"}],\"container-title\":\"Bell System Technical Journal\",\"container-title-short\":\"Bell Syst. Tech. J.\",\"volume\":\"27\",\"issue\":\"3\",\"page\":\"379-423\",\"DOI\":\"10.1002/j.1538-7305.1948.tb01338.x\",\"issued\":{\"date-parts\":[[1948]]}},{\"type\":\"article-journal\",\"title\":\"Computing Machinery and Intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"container-title-short\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"container-title-short\":\"Comput. J.\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}}]},{\"title\":\"Vancouver: biomedical references\",\"description\":\"Numbered entries with PubMed IDs; authors after the sixth become “et al.” Settings: embedded CSL-JSON on (a script tag other tools can read), beside the default JSON-LD; heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-vancouver\",\"citationStyle\":\"vancouver\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":true,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid\",\"author\":[{\"family\":\"Watson\",\"given\":\"J. D.\"},{\"family\":\"Crick\",\"given\":\"F. H. C.\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"171\",\"issue\":\"4356\",\"page\":\"737-738\",\"DOI\":\"10.1038/171737a0\",\"PMID\":\"13054692\",\"issued\":{\"date-parts\":[[1953,4,25]]}},{\"type\":\"article-journal\",\"title\":\"Highly accurate protein structure prediction with AlphaFold\",\"author\":[{\"family\":\"Jumper\",\"given\":\"John\"},{\"family\":\"Evans\",\"given\":\"Richard\"},{\"family\":\"Pritzel\",\"given\":\"Alexander\"},{\"family\":\"Green\",\"given\":\"Tim\"},{\"family\":\"Figurnov\",\"given\":\"Michael\"},{\"family\":\"Ronneberger\",\"given\":\"Olaf\"},{\"family\":\"Tunyasuvunakool\",\"given\":\"Kathryn\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"596\",\"issue\":\"7873\",\"page\":\"583-589\",\"DOI\":\"10.1038/s41586-021-03819-2\",\"PMID\":\"34265844\",\"issued\":{\"date-parts\":[[2021,8]]}}]},{\"title\":\"OSCOLA: tables of cases, legislation, and treaties\",\"description\":\"OSCOLA 5 lists primary sources in their own tables before the secondary sources. Each table’s label sits one level below the block heading. Settings: the default output; heading Bibliography at level H4, so the tables are labeled at H5.\",\"attributes\":{\"bibliographyId\":\"demo-oscola\",\"citationStyle\":\"oscola\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"legal_case\",\"title\":\"Donoghue v Stevenson\",\"container-title\":\"AC\",\"issued\":{\"date-parts\":[[1932]]},\"number\":\"562\"},{\"type\":\"legal_case\",\"title\":\"Carlill v Carbolic Smoke Ball Co\",\"container-title\":\"1 QB\",\"issued\":{\"date-parts\":[[1893]]},\"number\":\"256\"},{\"type\":\"legislation\",\"title\":\"Human Rights Act\",\"issued\":{\"date-parts\":[[1998]]}},{\"type\":\"regulation\",\"title\":\"Air Navigation Order 2016\",\"number\":\"SI 2016/765\"},{\"type\":\"treaty\",\"title\":\"Convention for the Protection of Human Rights and Fundamental Freedoms\",\"container-title\":\"213 UNTS\",\"page\":\"221\",\"issued\":{\"date-parts\":[[1950,11,4]]}},{\"type\":\"book\",\"title\":\"Constitutional and Administrative Law\",\"author\":[{\"family\":\"Bradley\",\"given\":\"A. W.\"},{\"family\":\"Ewing\",\"given\":\"K. D.\"},{\"family\":\"Knight\",\"given\":\"C. J. S.\"}],\"edition\":\"17\",\"publisher\":\"Pearson\",\"issued\":{\"date-parts\":[[2018]]}},{\"type\":\"article-journal\",\"title\":\"The Rule of Law\",\"author\":[{\"family\":\"Bingham\",\"given\":\"Tom\"}],\"container-title\":\"Cambridge Law Journal\",\"container-title-short\":\"CLJ\",\"volume\":\"66\",\"page\":\"67\",\"issued\":{\"date-parts\":[[2007]]}}]},{\"title\":\"ABNT: Brazilian references\",\"description\":\"Surnames in capitals, with particles such as “de” after the given name, sorted by surname. Settings: the default output; heading Referências at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-abnt\",\"citationStyle\":\"abnt\",\"headingText\":\"Referências\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"O alienista\",\"author\":[{\"family\":\"Assis\",\"given\":\"Machado\",\"dropping-particle\":\"de\"}],\"publisher\":\"Ática\",\"publisher-place\":\"São Paulo\",\"issued\":{\"date-parts\":[[1997]]}},{\"type\":\"book\",\"title\":\"Raízes do Brasil\",\"author\":[{\"family\":\"Holanda\",\"given\":\"Sérgio Buarque\",\"dropping-particle\":\"de\"}],\"publisher\":\"José Olympio\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1936]]}},{\"type\":\"book\",\"title\":\"Casa-grande & senzala\",\"author\":[{\"family\":\"Freyre\",\"given\":\"Gilberto\"}],\"publisher\":\"Maia & Schmidt\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1933]]}}]}]}\nJSON;\n/**\n * Playground demo page builder.\n *\n * `npm run playground:build` inlines this file into each demo blueprint's\n * runPHP step, after defining:\n *\n * - $borges_demo_json The contents of playground/demo-content.json.\n * - $borges_demo_intro An HTML lead paragraph for that blueprint.\n *\n * It rewrites post 1 as the demo page the blueprint lands on, and turns off\n * the editor's Welcome Guide so the page is visible straight away. Example\n * bibliographies are formatted with the plugin's own citeproc formatter and\n * rendered with its PHP port of save(), so they validate against whatever\n * version is installed. A release without that port (before 1.7.0) gets a\n * note instead.\n *\n * Not part of the plugin package (playground/ is in .distignore).\n *\n * @package BibliographyBuilder\n */\n\nrequire_once '/wordpress/wp-load.php';\n\n// Write as the admin, and keep kses from stripping the blocks' JSON-LD\n// scripts and data attributes: kses_init() ran before any user was set.\nwp_set_current_user( 1 );\nkses_remove_filters();\n\n$borges_demo = json_decode( $borges_demo_json, true );\n\n$borges_demo_block = static function ( $name, $attrs, $html ) {\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => $name,\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$borges_demo_paragraph = static function ( $html ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block( 'core/paragraph', array(), '

' . $html . '

' );\n};\n\n$borges_demo_heading = static function ( $text, $level ) use ( $borges_demo_block ) {\n\t$attrs = 2 === $level ? array() : array( 'level' => $level );\n\t$tag = 'h' . $level;\n\n\treturn $borges_demo_block( 'core/heading', $attrs, '<' . $tag . ' class=\"wp-block-heading\">' . esc_html( $text ) . '' );\n};\n\n$borges_demo_code = static function ( $text ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block(\n\t\t'core/code',\n\t\tarray(),\n\t\t'
' . htmlspecialchars( $text, ENT_NOQUOTES, 'UTF-8' ) . '
'\n\t);\n};\n\n$borges_demo_list = static function ( $items ) {\n\t$html = \"\\n\\n\\n\\n\";\n};\n\n$borges_demo_can_prebuild = function_exists( 'bibliography_builder_render_save_markup' )\n\t&& function_exists( 'bibliography_builder_format_csl_items' )\n\t&& bibliography_builder_can_render_save_markup();\n\n// Returns the serialized block, or '' when this install cannot build it.\n$borges_demo_bibliography = static function ( $example ) use ( $borges_demo_can_prebuild ) {\n\tif ( ! $borges_demo_can_prebuild ) {\n\t\treturn '';\n\t}\n\n\t$csl_items = bibliography_builder_validate_and_sanitize_csl_items( $example['citations'] );\n\n\tif ( is_wp_error( $csl_items ) ) {\n\t\treturn '';\n\t}\n\n\t$formatted = bibliography_builder_format_csl_items( $csl_items, $example['attributes']['citationStyle'] );\n\n\tif ( is_wp_error( $formatted ) ) {\n\t\treturn '';\n\t}\n\n\t$citations = array();\n\n\tforeach ( array_values( $csl_items ) as $index => $csl ) {\n\t\t$citation = array(\n\t\t\t'id' => $example['attributes']['bibliographyId'] . '-' . ( $index + 1 ),\n\t\t\t'csl' => $csl,\n\t\t\t'formattedText' => $formatted[ $index ],\n\t\t);\n\n\t\t// The editor stores these for Cite / Export; without them it adds\n\t\t// them on load and the untouched demo opens with unsaved changes.\n\t\tforeach ( array( 'exportBibtex', 'exportBiblatex' ) as $export_key ) {\n\t\t\tif ( isset( $example['exports'][ $index ][ $export_key ] ) ) {\n\t\t\t\t$citation[ $export_key ] = $example['exports'][ $index ][ $export_key ];\n\t\t\t}\n\t\t}\n\n\t\t$citations[] = $citation;\n\t}\n\n\t$attrs = $example['attributes'];\n\t// Stored in display order, as the editor stores them.\n\t$attrs['citations'] = bibliography_builder_sort_citations_for_save( $citations, $attrs['citationStyle'] );\n\t// Render from the attributes as the editor will parse them back.\n\t$html = bibliography_builder_render_save_markup(\n\t\tbibliography_builder_decode_save_attributes( wp_json_encode( $attrs ) )\n\t);\n\n\tif ( '' === $html ) {\n\t\treturn '';\n\t}\n\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => 'bibliography-builder/bibliography',\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$content = $borges_demo_paragraph( $borges_demo_intro );\n\n$content .= $borges_demo_heading( '1. Paste any supported format', 2 );\n$content .= $borges_demo_paragraph(\n\t'Select the empty Bibliography block at the end of this section, open Paste / Import, paste one or more samples, and choose Add. Separate entries with a blank line; up to 50 go in one paste, so you can copy several groups at once. A CSL-JSON document goes in a paste of its own.'\n);\n\nforeach ( $borges_demo['sampleGroups'] as $group ) {\n\t$content .= $borges_demo_heading( $group['title'], 3 );\n\t$content .= $borges_demo_paragraph( $group['description'] );\n\t$content .= $borges_demo_code( implode( \"\\n\\n\", wp_list_pluck( $group['samples'], 'input' ) ) );\n}\n\n$content .= $borges_demo_block(\n\t'bibliography-builder/bibliography',\n\tarray(\n\t\t'bibliographyId' => 'demo-try-it',\n\t\t'headingText' => 'References',\n\t),\n\t''\n);\n\n$content .= $borges_demo_heading( '2. Key features to try', 2 );\n$content .= $borges_demo_list( $borges_demo['features'] );\n\n$content .= $borges_demo_heading( '3. Example bibliographies', 2 );\n\n$borges_demo_examples = '';\n\nforeach ( $borges_demo['examples'] as $example ) {\n\t$block = $borges_demo_bibliography( $example );\n\n\tif ( '' === $block ) {\n\t\tcontinue;\n\t}\n\n\t$borges_demo_examples .= $borges_demo_heading( $example['title'], 3 );\n\t$borges_demo_examples .= $borges_demo_paragraph( $example['description'] );\n\n\t// Paragraphs that cite the example's entries with the \"Cite\" format, as\n\t// it saves them: links to `#ref-{bibliographyId}-{n}`, the IDs given above.\n\tforeach ( isset( $example['prose'] ) ? $example['prose'] : array() as $prose ) {\n\t\t$borges_demo_examples .= $borges_demo_paragraph( $prose );\n\t}\n\n\t$borges_demo_examples .= $block;\n}\n\n$content .= '' !== $borges_demo_examples\n\t? $borges_demo_paragraph( 'One example per citation style, each built from CSL-JSON. Under each title, Settings names the block settings it shows. Select a block to change them, or view the published page to see them as readers do.' ) . $borges_demo_examples\n\t: $borges_demo_paragraph( 'Pre-built examples need Borges 1.7.0 or later. Paste a few samples from section 1 to build your own.' );\n\nwp_update_post(\n\tarray(\n\t\t'ID' => 1,\n\t\t'post_title' => $borges_demo['title'],\n\t\t'post_content' => wp_slash( $content ),\n\t)\n);\n\n// Skip the block editor's Welcome Guide so the demo page is what opens.\n$borges_demo_meta_key = $GLOBALS['wpdb']->get_blog_prefix() . 'persisted_preferences';\n$borges_demo_preferences = get_user_meta( 1, $borges_demo_meta_key, true );\n$borges_demo_preferences = is_array( $borges_demo_preferences ) ? $borges_demo_preferences : array();\n\n$borges_demo_preferences['core/edit-post'] = array_merge(\n\tisset( $borges_demo_preferences['core/edit-post'] ) && is_array( $borges_demo_preferences['core/edit-post'] )\n\t\t? $borges_demo_preferences['core/edit-post']\n\t\t: array(),\n\tarray( 'welcomeGuide' => false )\n);\n$borges_demo_preferences['_modified'] = gmdate( 'c' );\n\nupdate_user_meta( 1, $borges_demo_meta_key, $borges_demo_preferences );\n" } ] } diff --git a/playground/blueprint-write-api.json b/playground/blueprint-write-api.json index a3890cf..176bfda 100644 --- a/playground/blueprint-write-api.json +++ b/playground/blueprint-write-api.json @@ -68,7 +68,7 @@ }, { "step": "runPHP", - "code": "Borges write API (development). This Playground runs the current main build with the opt-in bibliography write routes enabled. Open your browser console here and try await borgesWrite.list(); every call dry-runs first, and { commit: true } writes (see docs/rest-write-routes.md). Not for real sites.';\n$borges_demo_json = <<<'JSON'\n{\"title\":\"Borges Bibliography Builder demo\",\"sampleGroups\":[{\"title\":\"DOIs\",\"description\":\"A bare DOI, a doi: prefix, or a doi.org link. Metadata comes from Crossref.\",\"samples\":[{\"format\":\"doi\",\"input\":\"10.1038/s41586-020-2649-2\"},{\"format\":\"doi\",\"input\":\"doi:10.1038/nature14539\"},{\"format\":\"doi\",\"input\":\"https://doi.org/10.1145/3368089.3409742\"}]},{\"title\":\"PubMed and PubMed Central\",\"description\":\"A PMID needs its PMID: label. A PMCID starts with PMC, with or without a PMCID: label.\",\"samples\":[{\"format\":\"pmid\",\"input\":\"PMID:26673779\"},{\"format\":\"pmcid\",\"input\":\"PMC3531190\"}]},{\"title\":\"arXiv\",\"description\":\"An arXiv: ID (modern or legacy), an arxiv.org link, or an arXiv DOI.\",\"samples\":[{\"format\":\"arxiv\",\"input\":\"arXiv:1706.03762\"},{\"format\":\"arxiv\",\"input\":\"https://arxiv.org/abs/1810.04805\"},{\"format\":\"arxiv\",\"input\":\"arXiv:hep-th/9711200\"},{\"format\":\"arxiv\",\"input\":\"10.48550/arXiv.2005.14165\"}]},{\"title\":\"ISBNs\",\"description\":\"A labeled ISBN-13 or ISBN-10, or a bare ISBN-13 starting with 978 or 979. Books come from Open Library, with Google Books as a fallback.\",\"samples\":[{\"format\":\"isbn\",\"input\":\"ISBN 978-0-14-032872-1\"},{\"format\":\"isbn\",\"input\":\"9780262033848\"},{\"format\":\"isbn\",\"input\":\"ISBN-10: 0-8112-0012-4\"}]},{\"title\":\"Library catalogs and the Internet Archive\",\"description\":\"An OCLC number or LCCN needs its label (or its WorldCat or lccn.loc.gov link); an Open Library edition ID (OL…M) works on its own. An archive.org item link, ia: identifier, or ARK cites the edition the item names and keeps the archive.org page as the link. Records come from Open Library and the Internet Archive.\",\"samples\":[{\"format\":\"catalog\",\"input\":\"OCLC 297222669\"},{\"format\":\"catalog\",\"input\":\"LCCN 76-28766\"},{\"format\":\"archive\",\"input\":\"https://archive.org/details/limitstomedicine00illi\"}]},{\"title\":\"BibTeX and BibLaTeX\",\"description\":\"Whole entries, one or many. BibLaTeX fields such as date and location are understood.\",\"samples\":[{\"format\":\"bibtex\",\"input\":\"@article{knuth1984literate,\\n author = {Knuth, Donald E.},\\n title = {Literate Programming},\\n journal = {The Computer Journal},\\n year = {1984},\\n volume = {27},\\n number = {2},\\n pages = {97--111},\\n doi = {10.1093/comjnl/27.2.97}\\n}\"},{\"format\":\"bibtex\",\"input\":\"@book{borges1962labyrinths,\\n author = {Borges, Jorge Luis},\\n title = {Labyrinths: Selected Stories and Other Writings},\\n editor = {Yates, Donald A. and Irby, James E.},\\n date = {1962},\\n publisher = {New Directions},\\n location = {New York}\\n}\"}]},{\"title\":\"RIS\",\"description\":\"Records exported from Zotero, Mendeley, EndNote, or another reference manager, one or many. Each record runs from TY - to ER -.\",\"samples\":[{\"format\":\"ris\",\"input\":\"TY - BOOK\\nAU - Kuhn, Thomas S.\\nTI - The Structure of Scientific Revolutions\\nPY - 1962\\nPB - University of Chicago Press\\nCY - Chicago\\nER - \"},{\"format\":\"ris\",\"input\":\"TY - CHAP\\nAU - Geertz, Clifford\\nTI - Thick Description: Toward an Interpretive Theory of Culture\\nT2 - The Interpretation of Cultures\\nPY - 1973\\nSP - 3\\nEP - 30\\nPB - Basic Books\\nCY - New York\\nER - \"}]},{\"title\":\"CSL-JSON\",\"description\":\"A reference manager’s CSL JSON export, or a CSL-JSON file downloaded from Borges. Paste a CSL-JSON document on its own, not mixed with other samples.\",\"samples\":[{\"format\":\"csl-json\",\"input\":\"[{\\\"type\\\": \\\"book\\\", \\\"title\\\": \\\"Orientalism\\\", \\\"author\\\": [{\\\"family\\\": \\\"Said\\\", \\\"given\\\": \\\"Edward W.\\\"}], \\\"publisher\\\": \\\"Pantheon Books\\\", \\\"publisher-place\\\": \\\"New York\\\", \\\"issued\\\": {\\\"date-parts\\\": [[1978]]}}]\"}]},{\"title\":\"Formatted citations\",\"description\":\"Plain-text citations for books, journal articles, chapters, and webpages, in Chicago or APA shape. A citation that contains a DOI, PMID, PMCID, or arXiv ID is looked up by that identifier instead.\",\"samples\":[{\"format\":\"freetext\",\"input\":\"Binder, Amy J., and Jeffrey L. Kidder. The Channels of Student Activism: How the Left and Right Are Winning (and Losing) in Campus Politics Today. University of Chicago Press, 2022.\"},{\"format\":\"freetext\",\"input\":\"Ostrom, Elinor. Governing the Commons. Cambridge: Cambridge University Press, 1990.\"},{\"format\":\"freetext\",\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85.\"},{\"format\":\"freetext\",\"input\":\"Doyle, Kathleen. “The Queen Mary Psalter.” In The Book by Design: The Remarkable Story of the World’s Greatest Invention, edited by P. J. M. Marks and Stephen Parkin. University of Chicago Press, 2023.\"},{\"format\":\"freetext\",\"input\":\"Yale University. “About Yale: Yale Facts.” Accessed March 8, 2022. https://www.yale.edu/about-yale/yale-facts.\"},{\"format\":\"doi\",\"embedded\":true,\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85. https://doi.org/10.1086/725865.\"}]}],\"features\":[\"Citation Style (block sidebar): nine styles, Chicago Notes-Bibliography and Author-Date, APA 7, MLA 9, Harvard, IEEE, Vancouver, OSCOLA, and ABNT. Section 3 has an example of each. Switching reformats the generated text and keeps your manual edits.\",\"Heading: type the heading in the block, and choose its level in the sidebar: H2 (where a new block starts) to H6, or Paragraph for styled text that stays out of the page outline. Leave it empty for no heading.\",\"Edit fields: click any citation to correct its authors, title, year, DOI, and other fields; only the fields you change are saved. The pencil edits the displayed text instead, and Reset edits restores the generated text.\",\"Manual Entry: next to Paste / Import, add a citation field by field when there is nothing to paste.\",\"Duplicates: paste a DOI that is already in the list; it is skipped, not added twice.\",\"Order: notes and author-date styles sort alphabetically. Numeric styles (IEEE, Vancouver) keep your order; use Move citation up/down.\",\"Exports (block toolbar): copy the bibliography as text, or download BibTeX, BibLaTeX, RIS, or CSL-JSON.\",\"Per-entry Cite / Export (sidebar, off by default): gives readers copy and download links under each entry on the published page. The Chicago Notes-Bibliography example in section 3 has it on.\",\"Machine-readable output (sidebar): JSON-LD for search engines (on by default), COinS for Zotero, and embedded CSL-JSON. The examples in section 3 show each on and off.\",\"Block settings: like other blocks, a bibliography takes an HTML anchor and extra CSS classes (Advanced), a font size, and top and bottom margin and padding.\",\"Front end: use View Post to see the published bibliography, then open its read-only REST data.\"],\"examples\":[{\"title\":\"Chicago Notes-Bibliography: per-entry Cite / Export\",\"description\":\"A book, a chapter, a journal article, and a webpage, sorted alphabetically. View the published page and open Cite / Export under any entry to copy it or download it as RIS, BibTeX, BibLaTeX, or CSL-JSON. Settings: Per-entry Cite / Export on, and every machine-readable layer on (JSON-LD, COinS, embedded CSL-JSON); heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-notes\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"anchor\":\"demo-chicago-notes\",\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":true,\"outputCiteExport\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"chapter\",\"title\":\"The Library of Babel\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Irby\",\"given\":\"James E.\"}],\"container-title\":\"Labyrinths: Selected Stories and Other Writings\",\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}},{\"type\":\"webpage\",\"title\":\"Block Editor Handbook\",\"author\":[{\"literal\":\"WordPress.org\"}],\"container-title\":\"WordPress Developer Resources\",\"URL\":\"https://developer.wordpress.org/block-editor/\"}],\"exports\":[{\"exportBibtex\":\"@book{Borges1962Labyrinths,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@book{Borges1962Labyrinths,\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@inbook{Borges1962Library,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@inbook{Borges1962Library,\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n\\ttranslator = {Irby, James E.},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournal = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tyear = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournaltitle = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tdate = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@misc{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n\\thowpublished = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@online{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\tbooktitle = {WordPress {Developer} {Resources}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\"}]},{\"title\":\"Chicago Author-Date: same author, same year\",\"description\":\"Three of Einstein’s 1905 papers. Author-date styles letter works by one author in one year (1905a, 1905b, 1905c) so in-text citations stay unambiguous. Settings: the default output (JSON-LD only); heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-author-date\",\"citationStyle\":\"chicago-author-date\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Zur Elektrodynamik bewegter Körper\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"10\",\"page\":\"891-921\",\"DOI\":\"10.1002/andp.19053221004\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Über einen die Erzeugung und Verwandlung des Lichtes betreffenden heuristischen Gesichtspunkt\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"6\",\"page\":\"132-148\",\"DOI\":\"10.1002/andp.19053220607\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"323\",\"issue\":\"13\",\"page\":\"639-641\",\"DOI\":\"10.1002/andp.19053231314\",\"issued\":{\"date-parts\":[[1905]]}}]},{\"title\":\"APA 7\",\"description\":\"Journal articles and an arXiv preprint, with DOIs as links. Settings: the default output (JSON-LD only), with the heading at the Paragraph level, so it is styled text rather than a heading.\",\"attributes\":{\"bibliographyId\":\"demo-apa-7\",\"citationStyle\":\"apa-7\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Deep learning\",\"author\":[{\"family\":\"LeCun\",\"given\":\"Yann\"},{\"family\":\"Bengio\",\"given\":\"Yoshua\"},{\"family\":\"Hinton\",\"given\":\"Geoffrey\"}],\"container-title\":\"Nature\",\"volume\":\"521\",\"issue\":\"7553\",\"page\":\"436-444\",\"DOI\":\"10.1038/nature14539\",\"issued\":{\"date-parts\":[[2015]]}},{\"type\":\"article\",\"title\":\"Attention is all you need\",\"author\":[{\"family\":\"Vaswani\",\"given\":\"Ashish\"},{\"family\":\"Shazeer\",\"given\":\"Noam\"},{\"family\":\"Parmar\",\"given\":\"Niki\"},{\"family\":\"Uszkoreit\",\"given\":\"Jakob\"},{\"family\":\"Jones\",\"given\":\"Llion\"},{\"family\":\"Gomez\",\"given\":\"Aidan N.\"},{\"family\":\"Kaiser\",\"given\":\"Łukasz\"},{\"family\":\"Polosukhin\",\"given\":\"Illia\"}],\"publisher\":\"arXiv\",\"number\":\"1706.03762\",\"DOI\":\"10.48550/arXiv.1706.03762\",\"issued\":{\"date-parts\":[[2017]]}},{\"type\":\"article-journal\",\"title\":\"Computing machinery and intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}}]},{\"title\":\"MLA 9: repeated authors\",\"description\":\"Works by one author list the name once, then three hyphens, as MLA asks. Settings: COinS on, so Zotero’s browser connector can save every entry; heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-mla-9\",\"citationStyle\":\"mla-9\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Ficciones\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Kerrigan\",\"given\":\"Anthony\"}],\"publisher\":\"Grove Press\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Other Inquisitions, 1937–1952\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Simms\",\"given\":\"Ruth L. C.\"}],\"publisher\":\"University of Texas Press\",\"publisher-place\":\"Austin\",\"issued\":{\"date-parts\":[[1964]]}},{\"type\":\"book\",\"title\":\"Borges: A Life\",\"author\":[{\"family\":\"Woodall\",\"given\":\"James\"}],\"publisher\":\"Basic Books\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1996]]}}]},{\"title\":\"Harvard: a bare list\",\"description\":\"No heading and no machine-readable output: just the entries. Settings: heading left empty, JSON-LD off, and the block’s Typography font size set to Small.\",\"attributes\":{\"bibliographyId\":\"demo-harvard\",\"citationStyle\":\"harvard\",\"headingText\":\"\",\"fontSize\":\"small\",\"outputJsonLd\":false,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Governing the Commons: The Evolution of Institutions for Collective Action\",\"author\":[{\"family\":\"Ostrom\",\"given\":\"Elinor\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1990]]}},{\"type\":\"book\",\"title\":\"The Structure of Scientific Revolutions\",\"author\":[{\"family\":\"Kuhn\",\"given\":\"Thomas S.\"}],\"publisher\":\"University of Chicago Press\",\"publisher-place\":\"Chicago\",\"issued\":{\"date-parts\":[[1962]]}}]},{\"title\":\"IEEE\",\"description\":\"Numbered entries keep the order you give them. Select the block and use Move citation up/down to renumber. Journals print by their abbreviated titles, from each record's short title. Settings: the defaults, in a numbered list.\",\"attributes\":{\"bibliographyId\":\"demo-ieee\",\"citationStyle\":\"ieee\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"A Mathematical Theory of Communication\",\"author\":[{\"family\":\"Shannon\",\"given\":\"Claude E.\"}],\"container-title\":\"Bell System Technical Journal\",\"container-title-short\":\"Bell Syst. Tech. J.\",\"volume\":\"27\",\"issue\":\"3\",\"page\":\"379-423\",\"DOI\":\"10.1002/j.1538-7305.1948.tb01338.x\",\"issued\":{\"date-parts\":[[1948]]}},{\"type\":\"article-journal\",\"title\":\"Computing Machinery and Intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"container-title-short\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"container-title-short\":\"Comput. J.\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}}]},{\"title\":\"Vancouver: biomedical references\",\"description\":\"Numbered entries with PubMed IDs; authors after the sixth become “et al.” Settings: embedded CSL-JSON on (a script tag other tools can read), beside the default JSON-LD; heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-vancouver\",\"citationStyle\":\"vancouver\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":true,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid\",\"author\":[{\"family\":\"Watson\",\"given\":\"J. D.\"},{\"family\":\"Crick\",\"given\":\"F. H. C.\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"171\",\"issue\":\"4356\",\"page\":\"737-738\",\"DOI\":\"10.1038/171737a0\",\"PMID\":\"13054692\",\"issued\":{\"date-parts\":[[1953,4,25]]}},{\"type\":\"article-journal\",\"title\":\"Highly accurate protein structure prediction with AlphaFold\",\"author\":[{\"family\":\"Jumper\",\"given\":\"John\"},{\"family\":\"Evans\",\"given\":\"Richard\"},{\"family\":\"Pritzel\",\"given\":\"Alexander\"},{\"family\":\"Green\",\"given\":\"Tim\"},{\"family\":\"Figurnov\",\"given\":\"Michael\"},{\"family\":\"Ronneberger\",\"given\":\"Olaf\"},{\"family\":\"Tunyasuvunakool\",\"given\":\"Kathryn\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"596\",\"issue\":\"7873\",\"page\":\"583-589\",\"DOI\":\"10.1038/s41586-021-03819-2\",\"PMID\":\"34265844\",\"issued\":{\"date-parts\":[[2021,8]]}}]},{\"title\":\"OSCOLA: tables of cases, legislation, and treaties\",\"description\":\"OSCOLA 5 lists primary sources in their own tables before the secondary sources. Each table’s label sits one level below the block heading. Settings: the default output; heading Bibliography at level H4, so the tables are labeled at H5.\",\"attributes\":{\"bibliographyId\":\"demo-oscola\",\"citationStyle\":\"oscola\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"legal_case\",\"title\":\"Donoghue v Stevenson\",\"container-title\":\"AC\",\"issued\":{\"date-parts\":[[1932]]},\"number\":\"562\"},{\"type\":\"legal_case\",\"title\":\"Carlill v Carbolic Smoke Ball Co\",\"container-title\":\"1 QB\",\"issued\":{\"date-parts\":[[1893]]},\"number\":\"256\"},{\"type\":\"legislation\",\"title\":\"Human Rights Act\",\"issued\":{\"date-parts\":[[1998]]}},{\"type\":\"regulation\",\"title\":\"Air Navigation Order 2016\",\"number\":\"SI 2016/765\"},{\"type\":\"treaty\",\"title\":\"Convention for the Protection of Human Rights and Fundamental Freedoms\",\"container-title\":\"213 UNTS\",\"page\":\"221\",\"issued\":{\"date-parts\":[[1950,11,4]]}},{\"type\":\"book\",\"title\":\"Constitutional and Administrative Law\",\"author\":[{\"family\":\"Bradley\",\"given\":\"A. W.\"},{\"family\":\"Ewing\",\"given\":\"K. D.\"},{\"family\":\"Knight\",\"given\":\"C. J. S.\"}],\"edition\":\"17\",\"publisher\":\"Pearson\",\"issued\":{\"date-parts\":[[2018]]}},{\"type\":\"article-journal\",\"title\":\"The Rule of Law\",\"author\":[{\"family\":\"Bingham\",\"given\":\"Tom\"}],\"container-title\":\"Cambridge Law Journal\",\"container-title-short\":\"CLJ\",\"volume\":\"66\",\"page\":\"67\",\"issued\":{\"date-parts\":[[2007]]}}]},{\"title\":\"ABNT: Brazilian references\",\"description\":\"Surnames in capitals, with particles such as “de” after the given name, sorted by surname. Settings: the default output; heading Referências at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-abnt\",\"citationStyle\":\"abnt\",\"headingText\":\"Referências\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"O alienista\",\"author\":[{\"family\":\"Assis\",\"given\":\"Machado\",\"dropping-particle\":\"de\"}],\"publisher\":\"Ática\",\"publisher-place\":\"São Paulo\",\"issued\":{\"date-parts\":[[1997]]}},{\"type\":\"book\",\"title\":\"Raízes do Brasil\",\"author\":[{\"family\":\"Holanda\",\"given\":\"Sérgio Buarque\",\"dropping-particle\":\"de\"}],\"publisher\":\"José Olympio\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1936]]}},{\"type\":\"book\",\"title\":\"Casa-grande & senzala\",\"author\":[{\"family\":\"Freyre\",\"given\":\"Gilberto\"}],\"publisher\":\"Maia & Schmidt\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1933]]}}]}]}\nJSON;\n/**\n * Playground demo page builder.\n *\n * `npm run playground:build` inlines this file into each demo blueprint's\n * runPHP step, after defining:\n *\n * - $borges_demo_json The contents of playground/demo-content.json.\n * - $borges_demo_intro An HTML lead paragraph for that blueprint.\n *\n * It rewrites post 1 as the demo page the blueprint lands on, and turns off\n * the editor's Welcome Guide so the page is visible straight away. Example\n * bibliographies are formatted with the plugin's own citeproc formatter and\n * rendered with its PHP port of save(), so they validate against whatever\n * version is installed. A release without that port (before 1.7.0) gets a\n * note instead.\n *\n * Not part of the plugin package (playground/ is in .distignore).\n *\n * @package BibliographyBuilder\n */\n\nrequire_once '/wordpress/wp-load.php';\n\n// Write as the admin, and keep kses from stripping the blocks' JSON-LD\n// scripts and data attributes: kses_init() ran before any user was set.\nwp_set_current_user( 1 );\nkses_remove_filters();\n\n$borges_demo = json_decode( $borges_demo_json, true );\n\n$borges_demo_block = static function ( $name, $attrs, $html ) {\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => $name,\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$borges_demo_paragraph = static function ( $html ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block( 'core/paragraph', array(), '

' . $html . '

' );\n};\n\n$borges_demo_heading = static function ( $text, $level ) use ( $borges_demo_block ) {\n\t$attrs = 2 === $level ? array() : array( 'level' => $level );\n\t$tag = 'h' . $level;\n\n\treturn $borges_demo_block( 'core/heading', $attrs, '<' . $tag . ' class=\"wp-block-heading\">' . esc_html( $text ) . '' );\n};\n\n$borges_demo_code = static function ( $text ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block(\n\t\t'core/code',\n\t\tarray(),\n\t\t'
' . htmlspecialchars( $text, ENT_NOQUOTES, 'UTF-8' ) . '
'\n\t);\n};\n\n$borges_demo_list = static function ( $items ) {\n\t$html = \"\\n\\n\\n\\n\";\n};\n\n$borges_demo_can_prebuild = function_exists( 'bibliography_builder_render_save_markup' )\n\t&& function_exists( 'bibliography_builder_format_csl_items' )\n\t&& bibliography_builder_can_render_save_markup();\n\n// Returns the serialized block, or '' when this install cannot build it.\n$borges_demo_bibliography = static function ( $example ) use ( $borges_demo_can_prebuild ) {\n\tif ( ! $borges_demo_can_prebuild ) {\n\t\treturn '';\n\t}\n\n\t$csl_items = bibliography_builder_validate_and_sanitize_csl_items( $example['citations'] );\n\n\tif ( is_wp_error( $csl_items ) ) {\n\t\treturn '';\n\t}\n\n\t$formatted = bibliography_builder_format_csl_items( $csl_items, $example['attributes']['citationStyle'] );\n\n\tif ( is_wp_error( $formatted ) ) {\n\t\treturn '';\n\t}\n\n\t$citations = array();\n\n\tforeach ( array_values( $csl_items ) as $index => $csl ) {\n\t\t$citation = array(\n\t\t\t'id' => $example['attributes']['bibliographyId'] . '-' . ( $index + 1 ),\n\t\t\t'csl' => $csl,\n\t\t\t'formattedText' => $formatted[ $index ],\n\t\t);\n\n\t\t// The editor stores these for Cite / Export; without them it adds\n\t\t// them on load and the untouched demo opens with unsaved changes.\n\t\tforeach ( array( 'exportBibtex', 'exportBiblatex' ) as $export_key ) {\n\t\t\tif ( isset( $example['exports'][ $index ][ $export_key ] ) ) {\n\t\t\t\t$citation[ $export_key ] = $example['exports'][ $index ][ $export_key ];\n\t\t\t}\n\t\t}\n\n\t\t$citations[] = $citation;\n\t}\n\n\t$attrs = $example['attributes'];\n\t// Stored in display order, as the editor stores them.\n\t$attrs['citations'] = bibliography_builder_sort_citations_for_save( $citations, $attrs['citationStyle'] );\n\t// Render from the attributes as the editor will parse them back.\n\t$html = bibliography_builder_render_save_markup(\n\t\tbibliography_builder_decode_save_attributes( wp_json_encode( $attrs ) )\n\t);\n\n\tif ( '' === $html ) {\n\t\treturn '';\n\t}\n\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => 'bibliography-builder/bibliography',\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$content = $borges_demo_paragraph( $borges_demo_intro );\n\n$content .= $borges_demo_heading( '1. Paste any supported format', 2 );\n$content .= $borges_demo_paragraph(\n\t'Select the empty Bibliography block at the end of this section, open Paste / Import, paste one or more samples, and choose Add. Separate entries with a blank line; up to 50 go in one paste, so you can copy several groups at once. A CSL-JSON document goes in a paste of its own.'\n);\n\nforeach ( $borges_demo['sampleGroups'] as $group ) {\n\t$content .= $borges_demo_heading( $group['title'], 3 );\n\t$content .= $borges_demo_paragraph( $group['description'] );\n\t$content .= $borges_demo_code( implode( \"\\n\\n\", wp_list_pluck( $group['samples'], 'input' ) ) );\n}\n\n$content .= $borges_demo_block(\n\t'bibliography-builder/bibliography',\n\tarray(\n\t\t'bibliographyId' => 'demo-try-it',\n\t\t'headingText' => 'References',\n\t),\n\t''\n);\n\n$content .= $borges_demo_heading( '2. Key features to try', 2 );\n$content .= $borges_demo_list( $borges_demo['features'] );\n\n$content .= $borges_demo_heading( '3. Example bibliographies', 2 );\n\n$borges_demo_examples = '';\n\nforeach ( $borges_demo['examples'] as $example ) {\n\t$block = $borges_demo_bibliography( $example );\n\n\tif ( '' === $block ) {\n\t\tcontinue;\n\t}\n\n\t$borges_demo_examples .= $borges_demo_heading( $example['title'], 3 );\n\t$borges_demo_examples .= $borges_demo_paragraph( $example['description'] );\n\t$borges_demo_examples .= $block;\n}\n\n$content .= '' !== $borges_demo_examples\n\t? $borges_demo_paragraph( 'One example per citation style, each built from CSL-JSON. Under each title, Settings names the block settings it shows. Select a block to change them, or view the published page to see them as readers do.' ) . $borges_demo_examples\n\t: $borges_demo_paragraph( 'Pre-built examples need Borges 1.7.0 or later. Paste a few samples from section 1 to build your own.' );\n\nwp_update_post(\n\tarray(\n\t\t'ID' => 1,\n\t\t'post_title' => $borges_demo['title'],\n\t\t'post_content' => wp_slash( $content ),\n\t)\n);\n\n// Skip the block editor's Welcome Guide so the demo page is what opens.\n$borges_demo_meta_key = $GLOBALS['wpdb']->get_blog_prefix() . 'persisted_preferences';\n$borges_demo_preferences = get_user_meta( 1, $borges_demo_meta_key, true );\n$borges_demo_preferences = is_array( $borges_demo_preferences ) ? $borges_demo_preferences : array();\n\n$borges_demo_preferences['core/edit-post'] = array_merge(\n\tisset( $borges_demo_preferences['core/edit-post'] ) && is_array( $borges_demo_preferences['core/edit-post'] )\n\t\t? $borges_demo_preferences['core/edit-post']\n\t\t: array(),\n\tarray( 'welcomeGuide' => false )\n);\n$borges_demo_preferences['_modified'] = gmdate( 'c' );\n\nupdate_user_meta( 1, $borges_demo_meta_key, $borges_demo_preferences );\n" + "code": "Borges write API (development). This Playground runs the current main build with the opt-in bibliography write routes enabled. Open your browser console here and try await borgesWrite.list(); every call dry-runs first, and { commit: true } writes (see docs/rest-write-routes.md). Not for real sites.';\n$borges_demo_json = <<<'JSON'\n{\"title\":\"Borges Bibliography Builder demo\",\"sampleGroups\":[{\"title\":\"DOIs\",\"description\":\"A bare DOI, a doi: prefix, or a doi.org link. Metadata comes from Crossref.\",\"samples\":[{\"format\":\"doi\",\"input\":\"10.1038/s41586-020-2649-2\"},{\"format\":\"doi\",\"input\":\"doi:10.1038/nature14539\"},{\"format\":\"doi\",\"input\":\"https://doi.org/10.1145/3368089.3409742\"}]},{\"title\":\"PubMed and PubMed Central\",\"description\":\"A PMID needs its PMID: label. A PMCID starts with PMC, with or without a PMCID: label.\",\"samples\":[{\"format\":\"pmid\",\"input\":\"PMID:26673779\"},{\"format\":\"pmcid\",\"input\":\"PMC3531190\"}]},{\"title\":\"arXiv\",\"description\":\"An arXiv: ID (modern or legacy), an arxiv.org link, or an arXiv DOI.\",\"samples\":[{\"format\":\"arxiv\",\"input\":\"arXiv:1706.03762\"},{\"format\":\"arxiv\",\"input\":\"https://arxiv.org/abs/1810.04805\"},{\"format\":\"arxiv\",\"input\":\"arXiv:hep-th/9711200\"},{\"format\":\"arxiv\",\"input\":\"10.48550/arXiv.2005.14165\"}]},{\"title\":\"ISBNs\",\"description\":\"A labeled ISBN-13 or ISBN-10, or a bare ISBN-13 starting with 978 or 979. Books come from Open Library, with Google Books as a fallback.\",\"samples\":[{\"format\":\"isbn\",\"input\":\"ISBN 978-0-14-032872-1\"},{\"format\":\"isbn\",\"input\":\"9780262033848\"},{\"format\":\"isbn\",\"input\":\"ISBN-10: 0-8112-0012-4\"}]},{\"title\":\"Library catalogs and the Internet Archive\",\"description\":\"An OCLC number or LCCN needs its label (or its WorldCat or lccn.loc.gov link); an Open Library edition ID (OL…M) works on its own. An archive.org item link, ia: identifier, or ARK cites the edition the item names and keeps the archive.org page as the link. Records come from Open Library and the Internet Archive.\",\"samples\":[{\"format\":\"catalog\",\"input\":\"OCLC 297222669\"},{\"format\":\"catalog\",\"input\":\"LCCN 76-28766\"},{\"format\":\"archive\",\"input\":\"https://archive.org/details/limitstomedicine00illi\"}]},{\"title\":\"BibTeX and BibLaTeX\",\"description\":\"Whole entries, one or many. BibLaTeX fields such as date and location are understood.\",\"samples\":[{\"format\":\"bibtex\",\"input\":\"@article{knuth1984literate,\\n author = {Knuth, Donald E.},\\n title = {Literate Programming},\\n journal = {The Computer Journal},\\n year = {1984},\\n volume = {27},\\n number = {2},\\n pages = {97--111},\\n doi = {10.1093/comjnl/27.2.97}\\n}\"},{\"format\":\"bibtex\",\"input\":\"@book{borges1962labyrinths,\\n author = {Borges, Jorge Luis},\\n title = {Labyrinths: Selected Stories and Other Writings},\\n editor = {Yates, Donald A. and Irby, James E.},\\n date = {1962},\\n publisher = {New Directions},\\n location = {New York}\\n}\"}]},{\"title\":\"RIS\",\"description\":\"Records exported from Zotero, Mendeley, EndNote, or another reference manager, one or many. Each record runs from TY - to ER -.\",\"samples\":[{\"format\":\"ris\",\"input\":\"TY - BOOK\\nAU - Kuhn, Thomas S.\\nTI - The Structure of Scientific Revolutions\\nPY - 1962\\nPB - University of Chicago Press\\nCY - Chicago\\nER - \"},{\"format\":\"ris\",\"input\":\"TY - CHAP\\nAU - Geertz, Clifford\\nTI - Thick Description: Toward an Interpretive Theory of Culture\\nT2 - The Interpretation of Cultures\\nPY - 1973\\nSP - 3\\nEP - 30\\nPB - Basic Books\\nCY - New York\\nER - \"}]},{\"title\":\"CSL-JSON\",\"description\":\"A reference manager’s CSL JSON export, or a CSL-JSON file downloaded from Borges. Paste a CSL-JSON document on its own, not mixed with other samples.\",\"samples\":[{\"format\":\"csl-json\",\"input\":\"[{\\\"type\\\": \\\"book\\\", \\\"title\\\": \\\"Orientalism\\\", \\\"author\\\": [{\\\"family\\\": \\\"Said\\\", \\\"given\\\": \\\"Edward W.\\\"}], \\\"publisher\\\": \\\"Pantheon Books\\\", \\\"publisher-place\\\": \\\"New York\\\", \\\"issued\\\": {\\\"date-parts\\\": [[1978]]}}]\"}]},{\"title\":\"Formatted citations\",\"description\":\"Plain-text citations for books, journal articles, chapters, and webpages, in Chicago or APA shape. A citation that contains a DOI, PMID, PMCID, or arXiv ID is looked up by that identifier instead.\",\"samples\":[{\"format\":\"freetext\",\"input\":\"Binder, Amy J., and Jeffrey L. Kidder. The Channels of Student Activism: How the Left and Right Are Winning (and Losing) in Campus Politics Today. University of Chicago Press, 2022.\"},{\"format\":\"freetext\",\"input\":\"Ostrom, Elinor. Governing the Commons. Cambridge: Cambridge University Press, 1990.\"},{\"format\":\"freetext\",\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85.\"},{\"format\":\"freetext\",\"input\":\"Doyle, Kathleen. “The Queen Mary Psalter.” In The Book by Design: The Remarkable Story of the World’s Greatest Invention, edited by P. J. M. Marks and Stephen Parkin. University of Chicago Press, 2023.\"},{\"format\":\"freetext\",\"input\":\"Yale University. “About Yale: Yale Facts.” Accessed March 8, 2022. https://www.yale.edu/about-yale/yale-facts.\"},{\"format\":\"doi\",\"embedded\":true,\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85. https://doi.org/10.1086/725865.\"}]}],\"features\":[\"Citation Style (block sidebar): nine styles, Chicago Notes-Bibliography and Author-Date, APA 7, MLA 9, Harvard, IEEE, Vancouver, OSCOLA, and ABNT. Section 3 has an example of each. Switching reformats the generated text and keeps your manual edits.\",\"Heading: type the heading in the block, and choose its level in the sidebar: H2 (where a new block starts) to H6, or Paragraph for styled text that stays out of the page outline. Leave it empty for no heading.\",\"Edit fields: click any citation to correct its authors, title, year, DOI, and other fields; only the fields you change are saved. The pencil edits the displayed text instead, and Reset edits restores the generated text.\",\"Manual Entry: next to Paste / Import, add a citation field by field when there is nothing to paste.\",\"Duplicates: paste a DOI that is already in the list; it is skipped, not added twice.\",\"Order: notes and author-date styles sort alphabetically. Numeric styles (IEEE, Vancouver) keep your order; use Move citation up/down.\",\"Exports (block toolbar): copy the bibliography as text, or download BibTeX, BibLaTeX, RIS, or CSL-JSON.\",\"Per-entry Cite / Export (sidebar, off by default): gives readers copy and download links under each entry on the published page. The Chicago Notes-Bibliography example in section 3 has it on.\",\"Machine-readable output (sidebar): JSON-LD for search engines (on by default), COinS for Zotero, and embedded CSL-JSON. The examples in section 3 show each on and off.\",\"Block settings: like other blocks, a bibliography takes an HTML anchor and extra CSS classes (Advanced), a font size, and top and bottom margin and padding.\",\"Front end: use View Post to see the published bibliography, then open its read-only REST data.\"],\"examples\":[{\"title\":\"Chicago Notes-Bibliography: per-entry Cite / Export\",\"description\":\"A book, a chapter, a journal article, and a webpage, sorted alphabetically. View the published page and open Cite / Export under any entry to copy it or download it as RIS, BibTeX, BibLaTeX, or CSL-JSON. Settings: Per-entry Cite / Export on, and every machine-readable layer on (JSON-LD, COinS, embedded CSL-JSON); heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-notes\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"anchor\":\"demo-chicago-notes\",\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":true,\"outputCiteExport\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"chapter\",\"title\":\"The Library of Babel\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Irby\",\"given\":\"James E.\"}],\"container-title\":\"Labyrinths: Selected Stories and Other Writings\",\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}},{\"type\":\"webpage\",\"title\":\"Block Editor Handbook\",\"author\":[{\"literal\":\"WordPress.org\"}],\"container-title\":\"WordPress Developer Resources\",\"URL\":\"https://developer.wordpress.org/block-editor/\"}],\"exports\":[{\"exportBibtex\":\"@book{Borges1962Labyrinths,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@book{Borges1962Labyrinths,\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@inbook{Borges1962Library,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@inbook{Borges1962Library,\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n\\ttranslator = {Irby, James E.},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournal = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tyear = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournaltitle = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tdate = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@misc{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n\\thowpublished = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@online{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\tbooktitle = {WordPress {Developer} {Resources}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\"}]},{\"title\":\"In-text citations and an annotated bibliography\",\"description\":\"Three books with the compiler's own notes, and a paragraph that cites them. Settings: Show annotations on, Chicago Notes-Bibliography. Select a citation in the paragraph and choose Cite in the toolbar to see its entry and page, or select any text and cite it yourself. Then switch the style to IEEE in the block's sidebar and choose Update citations in its Citations in this post panel: every citation becomes a numbered one, pages kept. A theme's margin-note style turns the same citations into sidenotes.\",\"prose\":[\"The footnote is how a historian shows the work: Grafton, The Footnote. Print made that kind of checking possible at scale, by fixing texts so that every reader saw the same page: Eisenstein, The Printing Press as an Agent of Change. A citation is also a tool in Ivan Illich's sense, one that serves the reader only while it stays small enough to follow: Illich, Tools for Conviviality, chap. 3.\"],\"attributes\":{\"bibliographyId\":\"demo-cite-annotate\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"anchor\":\"demo-cite-annotate\",\"showAnnotations\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Tools for Conviviality\",\"author\":[{\"family\":\"Illich\",\"given\":\"Ivan\"}],\"publisher\":\"Harper & Row\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1973]]},\"annote\":\"Argues that past a certain scale, tools begin to serve themselves rather than the people who use them, and proposes limits that keep them convivial.\\n\\nThe source of the idea of counterfoil research.\"},{\"type\":\"book\",\"title\":\"The Footnote: A Curious History\",\"author\":[{\"family\":\"Grafton\",\"given\":\"Anthony\"}],\"publisher\":\"Harvard University Press\",\"publisher-place\":\"Cambridge, MA\",\"issued\":{\"date-parts\":[[1997]]},\"annote\":\"A history of the scholarly footnote, from Ranke and Gibbon back to the early modern antiquaries: how notes became the way historians make their work checkable.\"},{\"type\":\"book\",\"title\":\"The Printing Press as an Agent of Change: Communications and Cultural Transformations in Early-Modern Europe\",\"author\":[{\"family\":\"Eisenstein\",\"given\":\"Elizabeth L.\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1979]]},\"annote\":\"Argues that printing changed how knowledge was preserved, standardized, and spread, and so helped shape the Renaissance, the Reformation, and the Scientific Revolution.\"}]},{\"title\":\"Chicago Author-Date: same author, same year\",\"description\":\"Three of Einstein’s 1905 papers. Author-date styles letter works by one author in one year (1905a, 1905b, 1905c) so in-text citations stay unambiguous. Settings: the default output (JSON-LD only); heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-author-date\",\"citationStyle\":\"chicago-author-date\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Zur Elektrodynamik bewegter Körper\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"10\",\"page\":\"891-921\",\"DOI\":\"10.1002/andp.19053221004\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Über einen die Erzeugung und Verwandlung des Lichtes betreffenden heuristischen Gesichtspunkt\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"6\",\"page\":\"132-148\",\"DOI\":\"10.1002/andp.19053220607\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"323\",\"issue\":\"13\",\"page\":\"639-641\",\"DOI\":\"10.1002/andp.19053231314\",\"issued\":{\"date-parts\":[[1905]]}}]},{\"title\":\"APA 7\",\"description\":\"Journal articles and an arXiv preprint, with DOIs as links. Settings: the default output (JSON-LD only), with the heading at the Paragraph level, so it is styled text rather than a heading.\",\"attributes\":{\"bibliographyId\":\"demo-apa-7\",\"citationStyle\":\"apa-7\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Deep learning\",\"author\":[{\"family\":\"LeCun\",\"given\":\"Yann\"},{\"family\":\"Bengio\",\"given\":\"Yoshua\"},{\"family\":\"Hinton\",\"given\":\"Geoffrey\"}],\"container-title\":\"Nature\",\"volume\":\"521\",\"issue\":\"7553\",\"page\":\"436-444\",\"DOI\":\"10.1038/nature14539\",\"issued\":{\"date-parts\":[[2015]]}},{\"type\":\"article\",\"title\":\"Attention is all you need\",\"author\":[{\"family\":\"Vaswani\",\"given\":\"Ashish\"},{\"family\":\"Shazeer\",\"given\":\"Noam\"},{\"family\":\"Parmar\",\"given\":\"Niki\"},{\"family\":\"Uszkoreit\",\"given\":\"Jakob\"},{\"family\":\"Jones\",\"given\":\"Llion\"},{\"family\":\"Gomez\",\"given\":\"Aidan N.\"},{\"family\":\"Kaiser\",\"given\":\"Łukasz\"},{\"family\":\"Polosukhin\",\"given\":\"Illia\"}],\"publisher\":\"arXiv\",\"number\":\"1706.03762\",\"DOI\":\"10.48550/arXiv.1706.03762\",\"issued\":{\"date-parts\":[[2017]]}},{\"type\":\"article-journal\",\"title\":\"Computing machinery and intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}}]},{\"title\":\"MLA 9: repeated authors\",\"description\":\"Works by one author list the name once, then three hyphens, as MLA asks. Settings: COinS on, so Zotero’s browser connector can save every entry; heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-mla-9\",\"citationStyle\":\"mla-9\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Ficciones\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Kerrigan\",\"given\":\"Anthony\"}],\"publisher\":\"Grove Press\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Other Inquisitions, 1937–1952\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Simms\",\"given\":\"Ruth L. C.\"}],\"publisher\":\"University of Texas Press\",\"publisher-place\":\"Austin\",\"issued\":{\"date-parts\":[[1964]]}},{\"type\":\"book\",\"title\":\"Borges: A Life\",\"author\":[{\"family\":\"Woodall\",\"given\":\"James\"}],\"publisher\":\"Basic Books\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1996]]}}]},{\"title\":\"Harvard: a bare list\",\"description\":\"No heading and no machine-readable output: just the entries. Settings: heading left empty, JSON-LD off, and the block’s Typography font size set to Small.\",\"attributes\":{\"bibliographyId\":\"demo-harvard\",\"citationStyle\":\"harvard\",\"headingText\":\"\",\"fontSize\":\"small\",\"outputJsonLd\":false,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Governing the Commons: The Evolution of Institutions for Collective Action\",\"author\":[{\"family\":\"Ostrom\",\"given\":\"Elinor\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1990]]}},{\"type\":\"book\",\"title\":\"The Structure of Scientific Revolutions\",\"author\":[{\"family\":\"Kuhn\",\"given\":\"Thomas S.\"}],\"publisher\":\"University of Chicago Press\",\"publisher-place\":\"Chicago\",\"issued\":{\"date-parts\":[[1962]]}}]},{\"title\":\"IEEE\",\"description\":\"Numbered entries keep the order you give them. Select the block and use Move citation up/down to renumber. Journals print by their abbreviated titles, from each record's short title. Settings: the defaults, in a numbered list.\",\"attributes\":{\"bibliographyId\":\"demo-ieee\",\"citationStyle\":\"ieee\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"A Mathematical Theory of Communication\",\"author\":[{\"family\":\"Shannon\",\"given\":\"Claude E.\"}],\"container-title\":\"Bell System Technical Journal\",\"container-title-short\":\"Bell Syst. Tech. J.\",\"volume\":\"27\",\"issue\":\"3\",\"page\":\"379-423\",\"DOI\":\"10.1002/j.1538-7305.1948.tb01338.x\",\"issued\":{\"date-parts\":[[1948]]}},{\"type\":\"article-journal\",\"title\":\"Computing Machinery and Intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"container-title-short\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"container-title-short\":\"Comput. J.\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}}]},{\"title\":\"Vancouver: biomedical references\",\"description\":\"Numbered entries with PubMed IDs; authors after the sixth become “et al.” Settings: embedded CSL-JSON on (a script tag other tools can read), beside the default JSON-LD; heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-vancouver\",\"citationStyle\":\"vancouver\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":true,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid\",\"author\":[{\"family\":\"Watson\",\"given\":\"J. D.\"},{\"family\":\"Crick\",\"given\":\"F. H. C.\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"171\",\"issue\":\"4356\",\"page\":\"737-738\",\"DOI\":\"10.1038/171737a0\",\"PMID\":\"13054692\",\"issued\":{\"date-parts\":[[1953,4,25]]}},{\"type\":\"article-journal\",\"title\":\"Highly accurate protein structure prediction with AlphaFold\",\"author\":[{\"family\":\"Jumper\",\"given\":\"John\"},{\"family\":\"Evans\",\"given\":\"Richard\"},{\"family\":\"Pritzel\",\"given\":\"Alexander\"},{\"family\":\"Green\",\"given\":\"Tim\"},{\"family\":\"Figurnov\",\"given\":\"Michael\"},{\"family\":\"Ronneberger\",\"given\":\"Olaf\"},{\"family\":\"Tunyasuvunakool\",\"given\":\"Kathryn\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"596\",\"issue\":\"7873\",\"page\":\"583-589\",\"DOI\":\"10.1038/s41586-021-03819-2\",\"PMID\":\"34265844\",\"issued\":{\"date-parts\":[[2021,8]]}}]},{\"title\":\"OSCOLA: tables of cases, legislation, and treaties\",\"description\":\"OSCOLA 5 lists primary sources in their own tables before the secondary sources. Each table’s label sits one level below the block heading. Settings: the default output; heading Bibliography at level H4, so the tables are labeled at H5.\",\"attributes\":{\"bibliographyId\":\"demo-oscola\",\"citationStyle\":\"oscola\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"legal_case\",\"title\":\"Donoghue v Stevenson\",\"container-title\":\"AC\",\"issued\":{\"date-parts\":[[1932]]},\"number\":\"562\"},{\"type\":\"legal_case\",\"title\":\"Carlill v Carbolic Smoke Ball Co\",\"container-title\":\"1 QB\",\"issued\":{\"date-parts\":[[1893]]},\"number\":\"256\"},{\"type\":\"legislation\",\"title\":\"Human Rights Act\",\"issued\":{\"date-parts\":[[1998]]}},{\"type\":\"regulation\",\"title\":\"Air Navigation Order 2016\",\"number\":\"SI 2016/765\"},{\"type\":\"treaty\",\"title\":\"Convention for the Protection of Human Rights and Fundamental Freedoms\",\"container-title\":\"213 UNTS\",\"page\":\"221\",\"issued\":{\"date-parts\":[[1950,11,4]]}},{\"type\":\"book\",\"title\":\"Constitutional and Administrative Law\",\"author\":[{\"family\":\"Bradley\",\"given\":\"A. W.\"},{\"family\":\"Ewing\",\"given\":\"K. D.\"},{\"family\":\"Knight\",\"given\":\"C. J. S.\"}],\"edition\":\"17\",\"publisher\":\"Pearson\",\"issued\":{\"date-parts\":[[2018]]}},{\"type\":\"article-journal\",\"title\":\"The Rule of Law\",\"author\":[{\"family\":\"Bingham\",\"given\":\"Tom\"}],\"container-title\":\"Cambridge Law Journal\",\"container-title-short\":\"CLJ\",\"volume\":\"66\",\"page\":\"67\",\"issued\":{\"date-parts\":[[2007]]}}]},{\"title\":\"ABNT: Brazilian references\",\"description\":\"Surnames in capitals, with particles such as “de” after the given name, sorted by surname. Settings: the default output; heading Referências at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-abnt\",\"citationStyle\":\"abnt\",\"headingText\":\"Referências\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"O alienista\",\"author\":[{\"family\":\"Assis\",\"given\":\"Machado\",\"dropping-particle\":\"de\"}],\"publisher\":\"Ática\",\"publisher-place\":\"São Paulo\",\"issued\":{\"date-parts\":[[1997]]}},{\"type\":\"book\",\"title\":\"Raízes do Brasil\",\"author\":[{\"family\":\"Holanda\",\"given\":\"Sérgio Buarque\",\"dropping-particle\":\"de\"}],\"publisher\":\"José Olympio\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1936]]}},{\"type\":\"book\",\"title\":\"Casa-grande & senzala\",\"author\":[{\"family\":\"Freyre\",\"given\":\"Gilberto\"}],\"publisher\":\"Maia & Schmidt\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1933]]}}]}]}\nJSON;\n/**\n * Playground demo page builder.\n *\n * `npm run playground:build` inlines this file into each demo blueprint's\n * runPHP step, after defining:\n *\n * - $borges_demo_json The contents of playground/demo-content.json.\n * - $borges_demo_intro An HTML lead paragraph for that blueprint.\n *\n * It rewrites post 1 as the demo page the blueprint lands on, and turns off\n * the editor's Welcome Guide so the page is visible straight away. Example\n * bibliographies are formatted with the plugin's own citeproc formatter and\n * rendered with its PHP port of save(), so they validate against whatever\n * version is installed. A release without that port (before 1.7.0) gets a\n * note instead.\n *\n * Not part of the plugin package (playground/ is in .distignore).\n *\n * @package BibliographyBuilder\n */\n\nrequire_once '/wordpress/wp-load.php';\n\n// Write as the admin, and keep kses from stripping the blocks' JSON-LD\n// scripts and data attributes: kses_init() ran before any user was set.\nwp_set_current_user( 1 );\nkses_remove_filters();\n\n$borges_demo = json_decode( $borges_demo_json, true );\n\n$borges_demo_block = static function ( $name, $attrs, $html ) {\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => $name,\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$borges_demo_paragraph = static function ( $html ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block( 'core/paragraph', array(), '

' . $html . '

' );\n};\n\n$borges_demo_heading = static function ( $text, $level ) use ( $borges_demo_block ) {\n\t$attrs = 2 === $level ? array() : array( 'level' => $level );\n\t$tag = 'h' . $level;\n\n\treturn $borges_demo_block( 'core/heading', $attrs, '<' . $tag . ' class=\"wp-block-heading\">' . esc_html( $text ) . '' );\n};\n\n$borges_demo_code = static function ( $text ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block(\n\t\t'core/code',\n\t\tarray(),\n\t\t'
' . htmlspecialchars( $text, ENT_NOQUOTES, 'UTF-8' ) . '
'\n\t);\n};\n\n$borges_demo_list = static function ( $items ) {\n\t$html = \"\\n\\n\\n\\n\";\n};\n\n$borges_demo_can_prebuild = function_exists( 'bibliography_builder_render_save_markup' )\n\t&& function_exists( 'bibliography_builder_format_csl_items' )\n\t&& bibliography_builder_can_render_save_markup();\n\n// Returns the serialized block, or '' when this install cannot build it.\n$borges_demo_bibliography = static function ( $example ) use ( $borges_demo_can_prebuild ) {\n\tif ( ! $borges_demo_can_prebuild ) {\n\t\treturn '';\n\t}\n\n\t$csl_items = bibliography_builder_validate_and_sanitize_csl_items( $example['citations'] );\n\n\tif ( is_wp_error( $csl_items ) ) {\n\t\treturn '';\n\t}\n\n\t$formatted = bibliography_builder_format_csl_items( $csl_items, $example['attributes']['citationStyle'] );\n\n\tif ( is_wp_error( $formatted ) ) {\n\t\treturn '';\n\t}\n\n\t$citations = array();\n\n\tforeach ( array_values( $csl_items ) as $index => $csl ) {\n\t\t$citation = array(\n\t\t\t'id' => $example['attributes']['bibliographyId'] . '-' . ( $index + 1 ),\n\t\t\t'csl' => $csl,\n\t\t\t'formattedText' => $formatted[ $index ],\n\t\t);\n\n\t\t// The editor stores these for Cite / Export; without them it adds\n\t\t// them on load and the untouched demo opens with unsaved changes.\n\t\tforeach ( array( 'exportBibtex', 'exportBiblatex' ) as $export_key ) {\n\t\t\tif ( isset( $example['exports'][ $index ][ $export_key ] ) ) {\n\t\t\t\t$citation[ $export_key ] = $example['exports'][ $index ][ $export_key ];\n\t\t\t}\n\t\t}\n\n\t\t$citations[] = $citation;\n\t}\n\n\t$attrs = $example['attributes'];\n\t// Stored in display order, as the editor stores them.\n\t$attrs['citations'] = bibliography_builder_sort_citations_for_save( $citations, $attrs['citationStyle'] );\n\t// Render from the attributes as the editor will parse them back.\n\t$html = bibliography_builder_render_save_markup(\n\t\tbibliography_builder_decode_save_attributes( wp_json_encode( $attrs ) )\n\t);\n\n\tif ( '' === $html ) {\n\t\treturn '';\n\t}\n\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => 'bibliography-builder/bibliography',\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$content = $borges_demo_paragraph( $borges_demo_intro );\n\n$content .= $borges_demo_heading( '1. Paste any supported format', 2 );\n$content .= $borges_demo_paragraph(\n\t'Select the empty Bibliography block at the end of this section, open Paste / Import, paste one or more samples, and choose Add. Separate entries with a blank line; up to 50 go in one paste, so you can copy several groups at once. A CSL-JSON document goes in a paste of its own.'\n);\n\nforeach ( $borges_demo['sampleGroups'] as $group ) {\n\t$content .= $borges_demo_heading( $group['title'], 3 );\n\t$content .= $borges_demo_paragraph( $group['description'] );\n\t$content .= $borges_demo_code( implode( \"\\n\\n\", wp_list_pluck( $group['samples'], 'input' ) ) );\n}\n\n$content .= $borges_demo_block(\n\t'bibliography-builder/bibliography',\n\tarray(\n\t\t'bibliographyId' => 'demo-try-it',\n\t\t'headingText' => 'References',\n\t),\n\t''\n);\n\n$content .= $borges_demo_heading( '2. Key features to try', 2 );\n$content .= $borges_demo_list( $borges_demo['features'] );\n\n$content .= $borges_demo_heading( '3. Example bibliographies', 2 );\n\n$borges_demo_examples = '';\n\nforeach ( $borges_demo['examples'] as $example ) {\n\t$block = $borges_demo_bibliography( $example );\n\n\tif ( '' === $block ) {\n\t\tcontinue;\n\t}\n\n\t$borges_demo_examples .= $borges_demo_heading( $example['title'], 3 );\n\t$borges_demo_examples .= $borges_demo_paragraph( $example['description'] );\n\n\t// Paragraphs that cite the example's entries with the \"Cite\" format, as\n\t// it saves them: links to `#ref-{bibliographyId}-{n}`, the IDs given above.\n\tforeach ( isset( $example['prose'] ) ? $example['prose'] : array() as $prose ) {\n\t\t$borges_demo_examples .= $borges_demo_paragraph( $prose );\n\t}\n\n\t$borges_demo_examples .= $block;\n}\n\n$content .= '' !== $borges_demo_examples\n\t? $borges_demo_paragraph( 'One example per citation style, each built from CSL-JSON. Under each title, Settings names the block settings it shows. Select a block to change them, or view the published page to see them as readers do.' ) . $borges_demo_examples\n\t: $borges_demo_paragraph( 'Pre-built examples need Borges 1.7.0 or later. Paste a few samples from section 1 to build your own.' );\n\nwp_update_post(\n\tarray(\n\t\t'ID' => 1,\n\t\t'post_title' => $borges_demo['title'],\n\t\t'post_content' => wp_slash( $content ),\n\t)\n);\n\n// Skip the block editor's Welcome Guide so the demo page is what opens.\n$borges_demo_meta_key = $GLOBALS['wpdb']->get_blog_prefix() . 'persisted_preferences';\n$borges_demo_preferences = get_user_meta( 1, $borges_demo_meta_key, true );\n$borges_demo_preferences = is_array( $borges_demo_preferences ) ? $borges_demo_preferences : array();\n\n$borges_demo_preferences['core/edit-post'] = array_merge(\n\tisset( $borges_demo_preferences['core/edit-post'] ) && is_array( $borges_demo_preferences['core/edit-post'] )\n\t\t? $borges_demo_preferences['core/edit-post']\n\t\t: array(),\n\tarray( 'welcomeGuide' => false )\n);\n$borges_demo_preferences['_modified'] = gmdate( 'c' );\n\nupdate_user_meta( 1, $borges_demo_meta_key, $borges_demo_preferences );\n" } ] } diff --git a/playground/blueprint.json b/playground/blueprint.json index 4e94568..845dded 100644 --- a/playground/blueprint.json +++ b/playground/blueprint.json @@ -48,7 +48,7 @@ }, { "step": "runPHP", - "code": "Welcome to Borges Bibliography Builder. This Playground runs the latest release. It is a sandbox: nothing here is kept after you close the tab.';\n$borges_demo_json = <<<'JSON'\n{\"title\":\"Borges Bibliography Builder demo\",\"sampleGroups\":[{\"title\":\"DOIs\",\"description\":\"A bare DOI, a doi: prefix, or a doi.org link. Metadata comes from Crossref.\",\"samples\":[{\"format\":\"doi\",\"input\":\"10.1038/s41586-020-2649-2\"},{\"format\":\"doi\",\"input\":\"doi:10.1038/nature14539\"},{\"format\":\"doi\",\"input\":\"https://doi.org/10.1145/3368089.3409742\"}]},{\"title\":\"PubMed and PubMed Central\",\"description\":\"A PMID needs its PMID: label. A PMCID starts with PMC, with or without a PMCID: label.\",\"samples\":[{\"format\":\"pmid\",\"input\":\"PMID:26673779\"},{\"format\":\"pmcid\",\"input\":\"PMC3531190\"}]},{\"title\":\"arXiv\",\"description\":\"An arXiv: ID (modern or legacy), an arxiv.org link, or an arXiv DOI.\",\"samples\":[{\"format\":\"arxiv\",\"input\":\"arXiv:1706.03762\"},{\"format\":\"arxiv\",\"input\":\"https://arxiv.org/abs/1810.04805\"},{\"format\":\"arxiv\",\"input\":\"arXiv:hep-th/9711200\"},{\"format\":\"arxiv\",\"input\":\"10.48550/arXiv.2005.14165\"}]},{\"title\":\"ISBNs\",\"description\":\"A labeled ISBN-13 or ISBN-10, or a bare ISBN-13 starting with 978 or 979. Books come from Open Library, with Google Books as a fallback.\",\"samples\":[{\"format\":\"isbn\",\"input\":\"ISBN 978-0-14-032872-1\"},{\"format\":\"isbn\",\"input\":\"9780262033848\"},{\"format\":\"isbn\",\"input\":\"ISBN-10: 0-8112-0012-4\"}]},{\"title\":\"Library catalogs and the Internet Archive\",\"description\":\"An OCLC number or LCCN needs its label (or its WorldCat or lccn.loc.gov link); an Open Library edition ID (OL…M) works on its own. An archive.org item link, ia: identifier, or ARK cites the edition the item names and keeps the archive.org page as the link. Records come from Open Library and the Internet Archive.\",\"samples\":[{\"format\":\"catalog\",\"input\":\"OCLC 297222669\"},{\"format\":\"catalog\",\"input\":\"LCCN 76-28766\"},{\"format\":\"archive\",\"input\":\"https://archive.org/details/limitstomedicine00illi\"}]},{\"title\":\"BibTeX and BibLaTeX\",\"description\":\"Whole entries, one or many. BibLaTeX fields such as date and location are understood.\",\"samples\":[{\"format\":\"bibtex\",\"input\":\"@article{knuth1984literate,\\n author = {Knuth, Donald E.},\\n title = {Literate Programming},\\n journal = {The Computer Journal},\\n year = {1984},\\n volume = {27},\\n number = {2},\\n pages = {97--111},\\n doi = {10.1093/comjnl/27.2.97}\\n}\"},{\"format\":\"bibtex\",\"input\":\"@book{borges1962labyrinths,\\n author = {Borges, Jorge Luis},\\n title = {Labyrinths: Selected Stories and Other Writings},\\n editor = {Yates, Donald A. and Irby, James E.},\\n date = {1962},\\n publisher = {New Directions},\\n location = {New York}\\n}\"}]},{\"title\":\"RIS\",\"description\":\"Records exported from Zotero, Mendeley, EndNote, or another reference manager, one or many. Each record runs from TY - to ER -.\",\"samples\":[{\"format\":\"ris\",\"input\":\"TY - BOOK\\nAU - Kuhn, Thomas S.\\nTI - The Structure of Scientific Revolutions\\nPY - 1962\\nPB - University of Chicago Press\\nCY - Chicago\\nER - \"},{\"format\":\"ris\",\"input\":\"TY - CHAP\\nAU - Geertz, Clifford\\nTI - Thick Description: Toward an Interpretive Theory of Culture\\nT2 - The Interpretation of Cultures\\nPY - 1973\\nSP - 3\\nEP - 30\\nPB - Basic Books\\nCY - New York\\nER - \"}]},{\"title\":\"CSL-JSON\",\"description\":\"A reference manager’s CSL JSON export, or a CSL-JSON file downloaded from Borges. Paste a CSL-JSON document on its own, not mixed with other samples.\",\"samples\":[{\"format\":\"csl-json\",\"input\":\"[{\\\"type\\\": \\\"book\\\", \\\"title\\\": \\\"Orientalism\\\", \\\"author\\\": [{\\\"family\\\": \\\"Said\\\", \\\"given\\\": \\\"Edward W.\\\"}], \\\"publisher\\\": \\\"Pantheon Books\\\", \\\"publisher-place\\\": \\\"New York\\\", \\\"issued\\\": {\\\"date-parts\\\": [[1978]]}}]\"}]},{\"title\":\"Formatted citations\",\"description\":\"Plain-text citations for books, journal articles, chapters, and webpages, in Chicago or APA shape. A citation that contains a DOI, PMID, PMCID, or arXiv ID is looked up by that identifier instead.\",\"samples\":[{\"format\":\"freetext\",\"input\":\"Binder, Amy J., and Jeffrey L. Kidder. The Channels of Student Activism: How the Left and Right Are Winning (and Losing) in Campus Politics Today. University of Chicago Press, 2022.\"},{\"format\":\"freetext\",\"input\":\"Ostrom, Elinor. Governing the Commons. Cambridge: Cambridge University Press, 1990.\"},{\"format\":\"freetext\",\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85.\"},{\"format\":\"freetext\",\"input\":\"Doyle, Kathleen. “The Queen Mary Psalter.” In The Book by Design: The Remarkable Story of the World’s Greatest Invention, edited by P. J. M. Marks and Stephen Parkin. University of Chicago Press, 2023.\"},{\"format\":\"freetext\",\"input\":\"Yale University. “About Yale: Yale Facts.” Accessed March 8, 2022. https://www.yale.edu/about-yale/yale-facts.\"},{\"format\":\"doi\",\"embedded\":true,\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85. https://doi.org/10.1086/725865.\"}]}],\"features\":[\"Citation Style (block sidebar): nine styles, Chicago Notes-Bibliography and Author-Date, APA 7, MLA 9, Harvard, IEEE, Vancouver, OSCOLA, and ABNT. Section 3 has an example of each. Switching reformats the generated text and keeps your manual edits.\",\"Heading: type the heading in the block, and choose its level in the sidebar: H2 (where a new block starts) to H6, or Paragraph for styled text that stays out of the page outline. Leave it empty for no heading.\",\"Edit fields: click any citation to correct its authors, title, year, DOI, and other fields; only the fields you change are saved. The pencil edits the displayed text instead, and Reset edits restores the generated text.\",\"Manual Entry: next to Paste / Import, add a citation field by field when there is nothing to paste.\",\"Duplicates: paste a DOI that is already in the list; it is skipped, not added twice.\",\"Order: notes and author-date styles sort alphabetically. Numeric styles (IEEE, Vancouver) keep your order; use Move citation up/down.\",\"Exports (block toolbar): copy the bibliography as text, or download BibTeX, BibLaTeX, RIS, or CSL-JSON.\",\"Per-entry Cite / Export (sidebar, off by default): gives readers copy and download links under each entry on the published page. The Chicago Notes-Bibliography example in section 3 has it on.\",\"Machine-readable output (sidebar): JSON-LD for search engines (on by default), COinS for Zotero, and embedded CSL-JSON. The examples in section 3 show each on and off.\",\"Block settings: like other blocks, a bibliography takes an HTML anchor and extra CSS classes (Advanced), a font size, and top and bottom margin and padding.\",\"Front end: use View Post to see the published bibliography, then open its read-only REST data.\"],\"examples\":[{\"title\":\"Chicago Notes-Bibliography: per-entry Cite / Export\",\"description\":\"A book, a chapter, a journal article, and a webpage, sorted alphabetically. View the published page and open Cite / Export under any entry to copy it or download it as RIS, BibTeX, BibLaTeX, or CSL-JSON. Settings: Per-entry Cite / Export on, and every machine-readable layer on (JSON-LD, COinS, embedded CSL-JSON); heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-notes\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"anchor\":\"demo-chicago-notes\",\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":true,\"outputCiteExport\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"chapter\",\"title\":\"The Library of Babel\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Irby\",\"given\":\"James E.\"}],\"container-title\":\"Labyrinths: Selected Stories and Other Writings\",\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}},{\"type\":\"webpage\",\"title\":\"Block Editor Handbook\",\"author\":[{\"literal\":\"WordPress.org\"}],\"container-title\":\"WordPress Developer Resources\",\"URL\":\"https://developer.wordpress.org/block-editor/\"}],\"exports\":[{\"exportBibtex\":\"@book{Borges1962Labyrinths,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@book{Borges1962Labyrinths,\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@inbook{Borges1962Library,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@inbook{Borges1962Library,\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n\\ttranslator = {Irby, James E.},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournal = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tyear = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournaltitle = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tdate = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@misc{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n\\thowpublished = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@online{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\tbooktitle = {WordPress {Developer} {Resources}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\"}]},{\"title\":\"Chicago Author-Date: same author, same year\",\"description\":\"Three of Einstein’s 1905 papers. Author-date styles letter works by one author in one year (1905a, 1905b, 1905c) so in-text citations stay unambiguous. Settings: the default output (JSON-LD only); heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-author-date\",\"citationStyle\":\"chicago-author-date\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Zur Elektrodynamik bewegter Körper\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"10\",\"page\":\"891-921\",\"DOI\":\"10.1002/andp.19053221004\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Über einen die Erzeugung und Verwandlung des Lichtes betreffenden heuristischen Gesichtspunkt\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"6\",\"page\":\"132-148\",\"DOI\":\"10.1002/andp.19053220607\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"323\",\"issue\":\"13\",\"page\":\"639-641\",\"DOI\":\"10.1002/andp.19053231314\",\"issued\":{\"date-parts\":[[1905]]}}]},{\"title\":\"APA 7\",\"description\":\"Journal articles and an arXiv preprint, with DOIs as links. Settings: the default output (JSON-LD only), with the heading at the Paragraph level, so it is styled text rather than a heading.\",\"attributes\":{\"bibliographyId\":\"demo-apa-7\",\"citationStyle\":\"apa-7\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Deep learning\",\"author\":[{\"family\":\"LeCun\",\"given\":\"Yann\"},{\"family\":\"Bengio\",\"given\":\"Yoshua\"},{\"family\":\"Hinton\",\"given\":\"Geoffrey\"}],\"container-title\":\"Nature\",\"volume\":\"521\",\"issue\":\"7553\",\"page\":\"436-444\",\"DOI\":\"10.1038/nature14539\",\"issued\":{\"date-parts\":[[2015]]}},{\"type\":\"article\",\"title\":\"Attention is all you need\",\"author\":[{\"family\":\"Vaswani\",\"given\":\"Ashish\"},{\"family\":\"Shazeer\",\"given\":\"Noam\"},{\"family\":\"Parmar\",\"given\":\"Niki\"},{\"family\":\"Uszkoreit\",\"given\":\"Jakob\"},{\"family\":\"Jones\",\"given\":\"Llion\"},{\"family\":\"Gomez\",\"given\":\"Aidan N.\"},{\"family\":\"Kaiser\",\"given\":\"Łukasz\"},{\"family\":\"Polosukhin\",\"given\":\"Illia\"}],\"publisher\":\"arXiv\",\"number\":\"1706.03762\",\"DOI\":\"10.48550/arXiv.1706.03762\",\"issued\":{\"date-parts\":[[2017]]}},{\"type\":\"article-journal\",\"title\":\"Computing machinery and intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}}]},{\"title\":\"MLA 9: repeated authors\",\"description\":\"Works by one author list the name once, then three hyphens, as MLA asks. Settings: COinS on, so Zotero’s browser connector can save every entry; heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-mla-9\",\"citationStyle\":\"mla-9\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Ficciones\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Kerrigan\",\"given\":\"Anthony\"}],\"publisher\":\"Grove Press\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Other Inquisitions, 1937–1952\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Simms\",\"given\":\"Ruth L. C.\"}],\"publisher\":\"University of Texas Press\",\"publisher-place\":\"Austin\",\"issued\":{\"date-parts\":[[1964]]}},{\"type\":\"book\",\"title\":\"Borges: A Life\",\"author\":[{\"family\":\"Woodall\",\"given\":\"James\"}],\"publisher\":\"Basic Books\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1996]]}}]},{\"title\":\"Harvard: a bare list\",\"description\":\"No heading and no machine-readable output: just the entries. Settings: heading left empty, JSON-LD off, and the block’s Typography font size set to Small.\",\"attributes\":{\"bibliographyId\":\"demo-harvard\",\"citationStyle\":\"harvard\",\"headingText\":\"\",\"fontSize\":\"small\",\"outputJsonLd\":false,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Governing the Commons: The Evolution of Institutions for Collective Action\",\"author\":[{\"family\":\"Ostrom\",\"given\":\"Elinor\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1990]]}},{\"type\":\"book\",\"title\":\"The Structure of Scientific Revolutions\",\"author\":[{\"family\":\"Kuhn\",\"given\":\"Thomas S.\"}],\"publisher\":\"University of Chicago Press\",\"publisher-place\":\"Chicago\",\"issued\":{\"date-parts\":[[1962]]}}]},{\"title\":\"IEEE\",\"description\":\"Numbered entries keep the order you give them. Select the block and use Move citation up/down to renumber. Journals print by their abbreviated titles, from each record's short title. Settings: the defaults, in a numbered list.\",\"attributes\":{\"bibliographyId\":\"demo-ieee\",\"citationStyle\":\"ieee\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"A Mathematical Theory of Communication\",\"author\":[{\"family\":\"Shannon\",\"given\":\"Claude E.\"}],\"container-title\":\"Bell System Technical Journal\",\"container-title-short\":\"Bell Syst. Tech. J.\",\"volume\":\"27\",\"issue\":\"3\",\"page\":\"379-423\",\"DOI\":\"10.1002/j.1538-7305.1948.tb01338.x\",\"issued\":{\"date-parts\":[[1948]]}},{\"type\":\"article-journal\",\"title\":\"Computing Machinery and Intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"container-title-short\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"container-title-short\":\"Comput. J.\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}}]},{\"title\":\"Vancouver: biomedical references\",\"description\":\"Numbered entries with PubMed IDs; authors after the sixth become “et al.” Settings: embedded CSL-JSON on (a script tag other tools can read), beside the default JSON-LD; heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-vancouver\",\"citationStyle\":\"vancouver\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":true,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid\",\"author\":[{\"family\":\"Watson\",\"given\":\"J. D.\"},{\"family\":\"Crick\",\"given\":\"F. H. C.\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"171\",\"issue\":\"4356\",\"page\":\"737-738\",\"DOI\":\"10.1038/171737a0\",\"PMID\":\"13054692\",\"issued\":{\"date-parts\":[[1953,4,25]]}},{\"type\":\"article-journal\",\"title\":\"Highly accurate protein structure prediction with AlphaFold\",\"author\":[{\"family\":\"Jumper\",\"given\":\"John\"},{\"family\":\"Evans\",\"given\":\"Richard\"},{\"family\":\"Pritzel\",\"given\":\"Alexander\"},{\"family\":\"Green\",\"given\":\"Tim\"},{\"family\":\"Figurnov\",\"given\":\"Michael\"},{\"family\":\"Ronneberger\",\"given\":\"Olaf\"},{\"family\":\"Tunyasuvunakool\",\"given\":\"Kathryn\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"596\",\"issue\":\"7873\",\"page\":\"583-589\",\"DOI\":\"10.1038/s41586-021-03819-2\",\"PMID\":\"34265844\",\"issued\":{\"date-parts\":[[2021,8]]}}]},{\"title\":\"OSCOLA: tables of cases, legislation, and treaties\",\"description\":\"OSCOLA 5 lists primary sources in their own tables before the secondary sources. Each table’s label sits one level below the block heading. Settings: the default output; heading Bibliography at level H4, so the tables are labeled at H5.\",\"attributes\":{\"bibliographyId\":\"demo-oscola\",\"citationStyle\":\"oscola\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"legal_case\",\"title\":\"Donoghue v Stevenson\",\"container-title\":\"AC\",\"issued\":{\"date-parts\":[[1932]]},\"number\":\"562\"},{\"type\":\"legal_case\",\"title\":\"Carlill v Carbolic Smoke Ball Co\",\"container-title\":\"1 QB\",\"issued\":{\"date-parts\":[[1893]]},\"number\":\"256\"},{\"type\":\"legislation\",\"title\":\"Human Rights Act\",\"issued\":{\"date-parts\":[[1998]]}},{\"type\":\"regulation\",\"title\":\"Air Navigation Order 2016\",\"number\":\"SI 2016/765\"},{\"type\":\"treaty\",\"title\":\"Convention for the Protection of Human Rights and Fundamental Freedoms\",\"container-title\":\"213 UNTS\",\"page\":\"221\",\"issued\":{\"date-parts\":[[1950,11,4]]}},{\"type\":\"book\",\"title\":\"Constitutional and Administrative Law\",\"author\":[{\"family\":\"Bradley\",\"given\":\"A. W.\"},{\"family\":\"Ewing\",\"given\":\"K. D.\"},{\"family\":\"Knight\",\"given\":\"C. J. S.\"}],\"edition\":\"17\",\"publisher\":\"Pearson\",\"issued\":{\"date-parts\":[[2018]]}},{\"type\":\"article-journal\",\"title\":\"The Rule of Law\",\"author\":[{\"family\":\"Bingham\",\"given\":\"Tom\"}],\"container-title\":\"Cambridge Law Journal\",\"container-title-short\":\"CLJ\",\"volume\":\"66\",\"page\":\"67\",\"issued\":{\"date-parts\":[[2007]]}}]},{\"title\":\"ABNT: Brazilian references\",\"description\":\"Surnames in capitals, with particles such as “de” after the given name, sorted by surname. Settings: the default output; heading Referências at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-abnt\",\"citationStyle\":\"abnt\",\"headingText\":\"Referências\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"O alienista\",\"author\":[{\"family\":\"Assis\",\"given\":\"Machado\",\"dropping-particle\":\"de\"}],\"publisher\":\"Ática\",\"publisher-place\":\"São Paulo\",\"issued\":{\"date-parts\":[[1997]]}},{\"type\":\"book\",\"title\":\"Raízes do Brasil\",\"author\":[{\"family\":\"Holanda\",\"given\":\"Sérgio Buarque\",\"dropping-particle\":\"de\"}],\"publisher\":\"José Olympio\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1936]]}},{\"type\":\"book\",\"title\":\"Casa-grande & senzala\",\"author\":[{\"family\":\"Freyre\",\"given\":\"Gilberto\"}],\"publisher\":\"Maia & Schmidt\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1933]]}}]}]}\nJSON;\n/**\n * Playground demo page builder.\n *\n * `npm run playground:build` inlines this file into each demo blueprint's\n * runPHP step, after defining:\n *\n * - $borges_demo_json The contents of playground/demo-content.json.\n * - $borges_demo_intro An HTML lead paragraph for that blueprint.\n *\n * It rewrites post 1 as the demo page the blueprint lands on, and turns off\n * the editor's Welcome Guide so the page is visible straight away. Example\n * bibliographies are formatted with the plugin's own citeproc formatter and\n * rendered with its PHP port of save(), so they validate against whatever\n * version is installed. A release without that port (before 1.7.0) gets a\n * note instead.\n *\n * Not part of the plugin package (playground/ is in .distignore).\n *\n * @package BibliographyBuilder\n */\n\nrequire_once '/wordpress/wp-load.php';\n\n// Write as the admin, and keep kses from stripping the blocks' JSON-LD\n// scripts and data attributes: kses_init() ran before any user was set.\nwp_set_current_user( 1 );\nkses_remove_filters();\n\n$borges_demo = json_decode( $borges_demo_json, true );\n\n$borges_demo_block = static function ( $name, $attrs, $html ) {\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => $name,\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$borges_demo_paragraph = static function ( $html ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block( 'core/paragraph', array(), '

' . $html . '

' );\n};\n\n$borges_demo_heading = static function ( $text, $level ) use ( $borges_demo_block ) {\n\t$attrs = 2 === $level ? array() : array( 'level' => $level );\n\t$tag = 'h' . $level;\n\n\treturn $borges_demo_block( 'core/heading', $attrs, '<' . $tag . ' class=\"wp-block-heading\">' . esc_html( $text ) . '' );\n};\n\n$borges_demo_code = static function ( $text ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block(\n\t\t'core/code',\n\t\tarray(),\n\t\t'
' . htmlspecialchars( $text, ENT_NOQUOTES, 'UTF-8' ) . '
'\n\t);\n};\n\n$borges_demo_list = static function ( $items ) {\n\t$html = \"\\n\\n\\n\\n\";\n};\n\n$borges_demo_can_prebuild = function_exists( 'bibliography_builder_render_save_markup' )\n\t&& function_exists( 'bibliography_builder_format_csl_items' )\n\t&& bibliography_builder_can_render_save_markup();\n\n// Returns the serialized block, or '' when this install cannot build it.\n$borges_demo_bibliography = static function ( $example ) use ( $borges_demo_can_prebuild ) {\n\tif ( ! $borges_demo_can_prebuild ) {\n\t\treturn '';\n\t}\n\n\t$csl_items = bibliography_builder_validate_and_sanitize_csl_items( $example['citations'] );\n\n\tif ( is_wp_error( $csl_items ) ) {\n\t\treturn '';\n\t}\n\n\t$formatted = bibliography_builder_format_csl_items( $csl_items, $example['attributes']['citationStyle'] );\n\n\tif ( is_wp_error( $formatted ) ) {\n\t\treturn '';\n\t}\n\n\t$citations = array();\n\n\tforeach ( array_values( $csl_items ) as $index => $csl ) {\n\t\t$citation = array(\n\t\t\t'id' => $example['attributes']['bibliographyId'] . '-' . ( $index + 1 ),\n\t\t\t'csl' => $csl,\n\t\t\t'formattedText' => $formatted[ $index ],\n\t\t);\n\n\t\t// The editor stores these for Cite / Export; without them it adds\n\t\t// them on load and the untouched demo opens with unsaved changes.\n\t\tforeach ( array( 'exportBibtex', 'exportBiblatex' ) as $export_key ) {\n\t\t\tif ( isset( $example['exports'][ $index ][ $export_key ] ) ) {\n\t\t\t\t$citation[ $export_key ] = $example['exports'][ $index ][ $export_key ];\n\t\t\t}\n\t\t}\n\n\t\t$citations[] = $citation;\n\t}\n\n\t$attrs = $example['attributes'];\n\t// Stored in display order, as the editor stores them.\n\t$attrs['citations'] = bibliography_builder_sort_citations_for_save( $citations, $attrs['citationStyle'] );\n\t// Render from the attributes as the editor will parse them back.\n\t$html = bibliography_builder_render_save_markup(\n\t\tbibliography_builder_decode_save_attributes( wp_json_encode( $attrs ) )\n\t);\n\n\tif ( '' === $html ) {\n\t\treturn '';\n\t}\n\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => 'bibliography-builder/bibliography',\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$content = $borges_demo_paragraph( $borges_demo_intro );\n\n$content .= $borges_demo_heading( '1. Paste any supported format', 2 );\n$content .= $borges_demo_paragraph(\n\t'Select the empty Bibliography block at the end of this section, open Paste / Import, paste one or more samples, and choose Add. Separate entries with a blank line; up to 50 go in one paste, so you can copy several groups at once. A CSL-JSON document goes in a paste of its own.'\n);\n\nforeach ( $borges_demo['sampleGroups'] as $group ) {\n\t$content .= $borges_demo_heading( $group['title'], 3 );\n\t$content .= $borges_demo_paragraph( $group['description'] );\n\t$content .= $borges_demo_code( implode( \"\\n\\n\", wp_list_pluck( $group['samples'], 'input' ) ) );\n}\n\n$content .= $borges_demo_block(\n\t'bibliography-builder/bibliography',\n\tarray(\n\t\t'bibliographyId' => 'demo-try-it',\n\t\t'headingText' => 'References',\n\t),\n\t''\n);\n\n$content .= $borges_demo_heading( '2. Key features to try', 2 );\n$content .= $borges_demo_list( $borges_demo['features'] );\n\n$content .= $borges_demo_heading( '3. Example bibliographies', 2 );\n\n$borges_demo_examples = '';\n\nforeach ( $borges_demo['examples'] as $example ) {\n\t$block = $borges_demo_bibliography( $example );\n\n\tif ( '' === $block ) {\n\t\tcontinue;\n\t}\n\n\t$borges_demo_examples .= $borges_demo_heading( $example['title'], 3 );\n\t$borges_demo_examples .= $borges_demo_paragraph( $example['description'] );\n\t$borges_demo_examples .= $block;\n}\n\n$content .= '' !== $borges_demo_examples\n\t? $borges_demo_paragraph( 'One example per citation style, each built from CSL-JSON. Under each title, Settings names the block settings it shows. Select a block to change them, or view the published page to see them as readers do.' ) . $borges_demo_examples\n\t: $borges_demo_paragraph( 'Pre-built examples need Borges 1.7.0 or later. Paste a few samples from section 1 to build your own.' );\n\nwp_update_post(\n\tarray(\n\t\t'ID' => 1,\n\t\t'post_title' => $borges_demo['title'],\n\t\t'post_content' => wp_slash( $content ),\n\t)\n);\n\n// Skip the block editor's Welcome Guide so the demo page is what opens.\n$borges_demo_meta_key = $GLOBALS['wpdb']->get_blog_prefix() . 'persisted_preferences';\n$borges_demo_preferences = get_user_meta( 1, $borges_demo_meta_key, true );\n$borges_demo_preferences = is_array( $borges_demo_preferences ) ? $borges_demo_preferences : array();\n\n$borges_demo_preferences['core/edit-post'] = array_merge(\n\tisset( $borges_demo_preferences['core/edit-post'] ) && is_array( $borges_demo_preferences['core/edit-post'] )\n\t\t? $borges_demo_preferences['core/edit-post']\n\t\t: array(),\n\tarray( 'welcomeGuide' => false )\n);\n$borges_demo_preferences['_modified'] = gmdate( 'c' );\n\nupdate_user_meta( 1, $borges_demo_meta_key, $borges_demo_preferences );\n" + "code": "Welcome to Borges Bibliography Builder. This Playground runs the latest release. It is a sandbox: nothing here is kept after you close the tab.';\n$borges_demo_json = <<<'JSON'\n{\"title\":\"Borges Bibliography Builder demo\",\"sampleGroups\":[{\"title\":\"DOIs\",\"description\":\"A bare DOI, a doi: prefix, or a doi.org link. Metadata comes from Crossref.\",\"samples\":[{\"format\":\"doi\",\"input\":\"10.1038/s41586-020-2649-2\"},{\"format\":\"doi\",\"input\":\"doi:10.1038/nature14539\"},{\"format\":\"doi\",\"input\":\"https://doi.org/10.1145/3368089.3409742\"}]},{\"title\":\"PubMed and PubMed Central\",\"description\":\"A PMID needs its PMID: label. A PMCID starts with PMC, with or without a PMCID: label.\",\"samples\":[{\"format\":\"pmid\",\"input\":\"PMID:26673779\"},{\"format\":\"pmcid\",\"input\":\"PMC3531190\"}]},{\"title\":\"arXiv\",\"description\":\"An arXiv: ID (modern or legacy), an arxiv.org link, or an arXiv DOI.\",\"samples\":[{\"format\":\"arxiv\",\"input\":\"arXiv:1706.03762\"},{\"format\":\"arxiv\",\"input\":\"https://arxiv.org/abs/1810.04805\"},{\"format\":\"arxiv\",\"input\":\"arXiv:hep-th/9711200\"},{\"format\":\"arxiv\",\"input\":\"10.48550/arXiv.2005.14165\"}]},{\"title\":\"ISBNs\",\"description\":\"A labeled ISBN-13 or ISBN-10, or a bare ISBN-13 starting with 978 or 979. Books come from Open Library, with Google Books as a fallback.\",\"samples\":[{\"format\":\"isbn\",\"input\":\"ISBN 978-0-14-032872-1\"},{\"format\":\"isbn\",\"input\":\"9780262033848\"},{\"format\":\"isbn\",\"input\":\"ISBN-10: 0-8112-0012-4\"}]},{\"title\":\"Library catalogs and the Internet Archive\",\"description\":\"An OCLC number or LCCN needs its label (or its WorldCat or lccn.loc.gov link); an Open Library edition ID (OL…M) works on its own. An archive.org item link, ia: identifier, or ARK cites the edition the item names and keeps the archive.org page as the link. Records come from Open Library and the Internet Archive.\",\"samples\":[{\"format\":\"catalog\",\"input\":\"OCLC 297222669\"},{\"format\":\"catalog\",\"input\":\"LCCN 76-28766\"},{\"format\":\"archive\",\"input\":\"https://archive.org/details/limitstomedicine00illi\"}]},{\"title\":\"BibTeX and BibLaTeX\",\"description\":\"Whole entries, one or many. BibLaTeX fields such as date and location are understood.\",\"samples\":[{\"format\":\"bibtex\",\"input\":\"@article{knuth1984literate,\\n author = {Knuth, Donald E.},\\n title = {Literate Programming},\\n journal = {The Computer Journal},\\n year = {1984},\\n volume = {27},\\n number = {2},\\n pages = {97--111},\\n doi = {10.1093/comjnl/27.2.97}\\n}\"},{\"format\":\"bibtex\",\"input\":\"@book{borges1962labyrinths,\\n author = {Borges, Jorge Luis},\\n title = {Labyrinths: Selected Stories and Other Writings},\\n editor = {Yates, Donald A. and Irby, James E.},\\n date = {1962},\\n publisher = {New Directions},\\n location = {New York}\\n}\"}]},{\"title\":\"RIS\",\"description\":\"Records exported from Zotero, Mendeley, EndNote, or another reference manager, one or many. Each record runs from TY - to ER -.\",\"samples\":[{\"format\":\"ris\",\"input\":\"TY - BOOK\\nAU - Kuhn, Thomas S.\\nTI - The Structure of Scientific Revolutions\\nPY - 1962\\nPB - University of Chicago Press\\nCY - Chicago\\nER - \"},{\"format\":\"ris\",\"input\":\"TY - CHAP\\nAU - Geertz, Clifford\\nTI - Thick Description: Toward an Interpretive Theory of Culture\\nT2 - The Interpretation of Cultures\\nPY - 1973\\nSP - 3\\nEP - 30\\nPB - Basic Books\\nCY - New York\\nER - \"}]},{\"title\":\"CSL-JSON\",\"description\":\"A reference manager’s CSL JSON export, or a CSL-JSON file downloaded from Borges. Paste a CSL-JSON document on its own, not mixed with other samples.\",\"samples\":[{\"format\":\"csl-json\",\"input\":\"[{\\\"type\\\": \\\"book\\\", \\\"title\\\": \\\"Orientalism\\\", \\\"author\\\": [{\\\"family\\\": \\\"Said\\\", \\\"given\\\": \\\"Edward W.\\\"}], \\\"publisher\\\": \\\"Pantheon Books\\\", \\\"publisher-place\\\": \\\"New York\\\", \\\"issued\\\": {\\\"date-parts\\\": [[1978]]}}]\"}]},{\"title\":\"Formatted citations\",\"description\":\"Plain-text citations for books, journal articles, chapters, and webpages, in Chicago or APA shape. A citation that contains a DOI, PMID, PMCID, or arXiv ID is looked up by that identifier instead.\",\"samples\":[{\"format\":\"freetext\",\"input\":\"Binder, Amy J., and Jeffrey L. Kidder. The Channels of Student Activism: How the Left and Right Are Winning (and Losing) in Campus Politics Today. University of Chicago Press, 2022.\"},{\"format\":\"freetext\",\"input\":\"Ostrom, Elinor. Governing the Commons. Cambridge: Cambridge University Press, 1990.\"},{\"format\":\"freetext\",\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85.\"},{\"format\":\"freetext\",\"input\":\"Doyle, Kathleen. “The Queen Mary Psalter.” In The Book by Design: The Remarkable Story of the World’s Greatest Invention, edited by P. J. M. Marks and Stephen Parkin. University of Chicago Press, 2023.\"},{\"format\":\"freetext\",\"input\":\"Yale University. “About Yale: Yale Facts.” Accessed March 8, 2022. https://www.yale.edu/about-yale/yale-facts.\"},{\"format\":\"doi\",\"embedded\":true,\"input\":\"Dittmar, Emily L., and Douglas W. Schemske. “Temporal Variation in Selection Influences Microgeographic Local Adaptation.” American Naturalist 202, no. 4 (2023): 471–85. https://doi.org/10.1086/725865.\"}]}],\"features\":[\"Citation Style (block sidebar): nine styles, Chicago Notes-Bibliography and Author-Date, APA 7, MLA 9, Harvard, IEEE, Vancouver, OSCOLA, and ABNT. Section 3 has an example of each. Switching reformats the generated text and keeps your manual edits.\",\"Heading: type the heading in the block, and choose its level in the sidebar: H2 (where a new block starts) to H6, or Paragraph for styled text that stays out of the page outline. Leave it empty for no heading.\",\"Edit fields: click any citation to correct its authors, title, year, DOI, and other fields; only the fields you change are saved. The pencil edits the displayed text instead, and Reset edits restores the generated text.\",\"Manual Entry: next to Paste / Import, add a citation field by field when there is nothing to paste.\",\"Duplicates: paste a DOI that is already in the list; it is skipped, not added twice.\",\"Order: notes and author-date styles sort alphabetically. Numeric styles (IEEE, Vancouver) keep your order; use Move citation up/down.\",\"Exports (block toolbar): copy the bibliography as text, or download BibTeX, BibLaTeX, RIS, or CSL-JSON.\",\"Per-entry Cite / Export (sidebar, off by default): gives readers copy and download links under each entry on the published page. The Chicago Notes-Bibliography example in section 3 has it on.\",\"Machine-readable output (sidebar): JSON-LD for search engines (on by default), COinS for Zotero, and embedded CSL-JSON. The examples in section 3 show each on and off.\",\"Block settings: like other blocks, a bibliography takes an HTML anchor and extra CSS classes (Advanced), a font size, and top and bottom margin and padding.\",\"Front end: use View Post to see the published bibliography, then open its read-only REST data.\"],\"examples\":[{\"title\":\"Chicago Notes-Bibliography: per-entry Cite / Export\",\"description\":\"A book, a chapter, a journal article, and a webpage, sorted alphabetically. View the published page and open Cite / Export under any entry to copy it or download it as RIS, BibTeX, BibLaTeX, or CSL-JSON. Settings: Per-entry Cite / Export on, and every machine-readable layer on (JSON-LD, COinS, embedded CSL-JSON); heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-notes\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"anchor\":\"demo-chicago-notes\",\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":true,\"outputCiteExport\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"chapter\",\"title\":\"The Library of Babel\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Irby\",\"given\":\"James E.\"}],\"container-title\":\"Labyrinths: Selected Stories and Other Writings\",\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}},{\"type\":\"webpage\",\"title\":\"Block Editor Handbook\",\"author\":[{\"literal\":\"WordPress.org\"}],\"container-title\":\"WordPress Developer Resources\",\"URL\":\"https://developer.wordpress.org/block-editor/\"}],\"exports\":[{\"exportBibtex\":\"@book{Borges1962Labyrinths,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@book{Borges1962Labyrinths,\\n\\tauthor = {Borges, Jorge Luis},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@inbook{Borges1962Library,\\n\\taddress = {New York},\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tyear = {1962},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@inbook{Borges1962Library,\\n\\tauthor = {Borges, Jorge Luis},\\n\\tbooktitle = {Labyrinths: Selected {Stories} and {Other} {Writings}},\\n\\teditor = {Yates, Donald A. and Irby, James E.},\\n\\tdate = {1962},\\n\\tlocation = {New York},\\n\\tpublisher = {New Directions},\\n\\ttitle = {The {Library} of {Babel}},\\n\\ttranslator = {Irby, James E.},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournal = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tyear = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@article{Knuth1984Literate,\\n\\tauthor = {Knuth, Donald E.},\\n\\tjournaltitle = {The Computer Journal},\\n\\tdoi = {10.1093/comjnl/27.2.97},\\n\\tnumber = {2},\\n\\tdate = {1984},\\n\\tpages = {97--111},\\n\\ttitle = {Literate {Programming}},\\n\\tvolume = {27},\\n}\\n\\n\\n\"},{\"exportBibtex\":\"@misc{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n\\thowpublished = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\",\"exportBiblatex\":\"@online{WordPressBlock,\\n\\tauthor = {{WordPress.org}},\\n\\tbooktitle = {WordPress {Developer} {Resources}},\\n\\ttitle = {Block {Editor} {Handbook}},\\n\\turl = {https://developer.wordpress.org/block-editor/},\\n}\\n\\n\\n\"}]},{\"title\":\"In-text citations and an annotated bibliography\",\"description\":\"Three books with the compiler's own notes, and a paragraph that cites them. Settings: Show annotations on, Chicago Notes-Bibliography. Select a citation in the paragraph and choose Cite in the toolbar to see its entry and page, or select any text and cite it yourself. Then switch the style to IEEE in the block's sidebar and choose Update citations in its Citations in this post panel: every citation becomes a numbered one, pages kept. A theme's margin-note style turns the same citations into sidenotes.\",\"prose\":[\"The footnote is how a historian shows the work: Grafton, The Footnote. Print made that kind of checking possible at scale, by fixing texts so that every reader saw the same page: Eisenstein, The Printing Press as an Agent of Change. A citation is also a tool in Ivan Illich's sense, one that serves the reader only while it stays small enough to follow: Illich, Tools for Conviviality, chap. 3.\"],\"attributes\":{\"bibliographyId\":\"demo-cite-annotate\",\"citationStyle\":\"chicago-notes-bibliography\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"anchor\":\"demo-cite-annotate\",\"showAnnotations\":true},\"citations\":[{\"type\":\"book\",\"title\":\"Tools for Conviviality\",\"author\":[{\"family\":\"Illich\",\"given\":\"Ivan\"}],\"publisher\":\"Harper & Row\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1973]]},\"annote\":\"Argues that past a certain scale, tools begin to serve themselves rather than the people who use them, and proposes limits that keep them convivial.\\n\\nThe source of the idea of counterfoil research.\"},{\"type\":\"book\",\"title\":\"The Footnote: A Curious History\",\"author\":[{\"family\":\"Grafton\",\"given\":\"Anthony\"}],\"publisher\":\"Harvard University Press\",\"publisher-place\":\"Cambridge, MA\",\"issued\":{\"date-parts\":[[1997]]},\"annote\":\"A history of the scholarly footnote, from Ranke and Gibbon back to the early modern antiquaries: how notes became the way historians make their work checkable.\"},{\"type\":\"book\",\"title\":\"The Printing Press as an Agent of Change: Communications and Cultural Transformations in Early-Modern Europe\",\"author\":[{\"family\":\"Eisenstein\",\"given\":\"Elizabeth L.\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1979]]},\"annote\":\"Argues that printing changed how knowledge was preserved, standardized, and spread, and so helped shape the Renaissance, the Reformation, and the Scientific Revolution.\"}]},{\"title\":\"Chicago Author-Date: same author, same year\",\"description\":\"Three of Einstein’s 1905 papers. Author-date styles letter works by one author in one year (1905a, 1905b, 1905c) so in-text citations stay unambiguous. Settings: the default output (JSON-LD only); heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-chicago-author-date\",\"citationStyle\":\"chicago-author-date\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Zur Elektrodynamik bewegter Körper\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"10\",\"page\":\"891-921\",\"DOI\":\"10.1002/andp.19053221004\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Über einen die Erzeugung und Verwandlung des Lichtes betreffenden heuristischen Gesichtspunkt\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"322\",\"issue\":\"6\",\"page\":\"132-148\",\"DOI\":\"10.1002/andp.19053220607\",\"issued\":{\"date-parts\":[[1905]]}},{\"type\":\"article-journal\",\"title\":\"Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?\",\"author\":[{\"family\":\"Einstein\",\"given\":\"Albert\"}],\"container-title\":\"Annalen der Physik\",\"volume\":\"323\",\"issue\":\"13\",\"page\":\"639-641\",\"DOI\":\"10.1002/andp.19053231314\",\"issued\":{\"date-parts\":[[1905]]}}]},{\"title\":\"APA 7\",\"description\":\"Journal articles and an arXiv preprint, with DOIs as links. Settings: the default output (JSON-LD only), with the heading at the Paragraph level, so it is styled text rather than a heading.\",\"attributes\":{\"bibliographyId\":\"demo-apa-7\",\"citationStyle\":\"apa-7\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Deep learning\",\"author\":[{\"family\":\"LeCun\",\"given\":\"Yann\"},{\"family\":\"Bengio\",\"given\":\"Yoshua\"},{\"family\":\"Hinton\",\"given\":\"Geoffrey\"}],\"container-title\":\"Nature\",\"volume\":\"521\",\"issue\":\"7553\",\"page\":\"436-444\",\"DOI\":\"10.1038/nature14539\",\"issued\":{\"date-parts\":[[2015]]}},{\"type\":\"article\",\"title\":\"Attention is all you need\",\"author\":[{\"family\":\"Vaswani\",\"given\":\"Ashish\"},{\"family\":\"Shazeer\",\"given\":\"Noam\"},{\"family\":\"Parmar\",\"given\":\"Niki\"},{\"family\":\"Uszkoreit\",\"given\":\"Jakob\"},{\"family\":\"Jones\",\"given\":\"Llion\"},{\"family\":\"Gomez\",\"given\":\"Aidan N.\"},{\"family\":\"Kaiser\",\"given\":\"Łukasz\"},{\"family\":\"Polosukhin\",\"given\":\"Illia\"}],\"publisher\":\"arXiv\",\"number\":\"1706.03762\",\"DOI\":\"10.48550/arXiv.1706.03762\",\"issued\":{\"date-parts\":[[2017]]}},{\"type\":\"article-journal\",\"title\":\"Computing machinery and intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}}]},{\"title\":\"MLA 9: repeated authors\",\"description\":\"Works by one author list the name once, then three hyphens, as MLA asks. Settings: COinS on, so Zotero’s browser connector can save every entry; heading Works Cited at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-mla-9\",\"citationStyle\":\"mla-9\",\"headingText\":\"Works Cited\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":true,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Labyrinths: Selected Stories and Other Writings\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Yates\",\"given\":\"Donald A.\"},{\"family\":\"Irby\",\"given\":\"James E.\"}],\"publisher\":\"New Directions\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Ficciones\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"editor\":[{\"family\":\"Kerrigan\",\"given\":\"Anthony\"}],\"publisher\":\"Grove Press\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1962]]}},{\"type\":\"book\",\"title\":\"Other Inquisitions, 1937–1952\",\"author\":[{\"family\":\"Borges\",\"given\":\"Jorge Luis\"}],\"translator\":[{\"family\":\"Simms\",\"given\":\"Ruth L. C.\"}],\"publisher\":\"University of Texas Press\",\"publisher-place\":\"Austin\",\"issued\":{\"date-parts\":[[1964]]}},{\"type\":\"book\",\"title\":\"Borges: A Life\",\"author\":[{\"family\":\"Woodall\",\"given\":\"James\"}],\"publisher\":\"Basic Books\",\"publisher-place\":\"New York\",\"issued\":{\"date-parts\":[[1996]]}}]},{\"title\":\"Harvard: a bare list\",\"description\":\"No heading and no machine-readable output: just the entries. Settings: heading left empty, JSON-LD off, and the block’s Typography font size set to Small.\",\"attributes\":{\"bibliographyId\":\"demo-harvard\",\"citationStyle\":\"harvard\",\"headingText\":\"\",\"fontSize\":\"small\",\"outputJsonLd\":false,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"Governing the Commons: The Evolution of Institutions for Collective Action\",\"author\":[{\"family\":\"Ostrom\",\"given\":\"Elinor\"}],\"publisher\":\"Cambridge University Press\",\"publisher-place\":\"Cambridge\",\"issued\":{\"date-parts\":[[1990]]}},{\"type\":\"book\",\"title\":\"The Structure of Scientific Revolutions\",\"author\":[{\"family\":\"Kuhn\",\"given\":\"Thomas S.\"}],\"publisher\":\"University of Chicago Press\",\"publisher-place\":\"Chicago\",\"issued\":{\"date-parts\":[[1962]]}}]},{\"title\":\"IEEE\",\"description\":\"Numbered entries keep the order you give them. Select the block and use Move citation up/down to renumber. Journals print by their abbreviated titles, from each record's short title. Settings: the defaults, in a numbered list.\",\"attributes\":{\"bibliographyId\":\"demo-ieee\",\"citationStyle\":\"ieee\",\"headingText\":\"References\",\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"A Mathematical Theory of Communication\",\"author\":[{\"family\":\"Shannon\",\"given\":\"Claude E.\"}],\"container-title\":\"Bell System Technical Journal\",\"container-title-short\":\"Bell Syst. Tech. J.\",\"volume\":\"27\",\"issue\":\"3\",\"page\":\"379-423\",\"DOI\":\"10.1002/j.1538-7305.1948.tb01338.x\",\"issued\":{\"date-parts\":[[1948]]}},{\"type\":\"article-journal\",\"title\":\"Computing Machinery and Intelligence\",\"author\":[{\"family\":\"Turing\",\"given\":\"A. M.\"}],\"container-title\":\"Mind\",\"container-title-short\":\"Mind\",\"volume\":\"59\",\"issue\":\"236\",\"page\":\"433-460\",\"DOI\":\"10.1093/mind/LIX.236.433\",\"issued\":{\"date-parts\":[[1950]]}},{\"type\":\"article-journal\",\"title\":\"Literate Programming\",\"author\":[{\"family\":\"Knuth\",\"given\":\"Donald E.\"}],\"container-title\":\"The Computer Journal\",\"container-title-short\":\"Comput. J.\",\"volume\":\"27\",\"issue\":\"2\",\"page\":\"97-111\",\"DOI\":\"10.1093/comjnl/27.2.97\",\"issued\":{\"date-parts\":[[1984]]}}]},{\"title\":\"Vancouver: biomedical references\",\"description\":\"Numbered entries with PubMed IDs; authors after the sixth become “et al.” Settings: embedded CSL-JSON on (a script tag other tools can read), beside the default JSON-LD; heading References at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-vancouver\",\"citationStyle\":\"vancouver\",\"headingText\":\"References\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":true,\"outputCiteExport\":false},\"citations\":[{\"type\":\"article-journal\",\"title\":\"Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid\",\"author\":[{\"family\":\"Watson\",\"given\":\"J. D.\"},{\"family\":\"Crick\",\"given\":\"F. H. C.\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"171\",\"issue\":\"4356\",\"page\":\"737-738\",\"DOI\":\"10.1038/171737a0\",\"PMID\":\"13054692\",\"issued\":{\"date-parts\":[[1953,4,25]]}},{\"type\":\"article-journal\",\"title\":\"Highly accurate protein structure prediction with AlphaFold\",\"author\":[{\"family\":\"Jumper\",\"given\":\"John\"},{\"family\":\"Evans\",\"given\":\"Richard\"},{\"family\":\"Pritzel\",\"given\":\"Alexander\"},{\"family\":\"Green\",\"given\":\"Tim\"},{\"family\":\"Figurnov\",\"given\":\"Michael\"},{\"family\":\"Ronneberger\",\"given\":\"Olaf\"},{\"family\":\"Tunyasuvunakool\",\"given\":\"Kathryn\"}],\"container-title\":\"Nature\",\"container-title-short\":\"Nature\",\"volume\":\"596\",\"issue\":\"7873\",\"page\":\"583-589\",\"DOI\":\"10.1038/s41586-021-03819-2\",\"PMID\":\"34265844\",\"issued\":{\"date-parts\":[[2021,8]]}}]},{\"title\":\"OSCOLA: tables of cases, legislation, and treaties\",\"description\":\"OSCOLA 5 lists primary sources in their own tables before the secondary sources. Each table’s label sits one level below the block heading. Settings: the default output; heading Bibliography at level H4, so the tables are labeled at H5.\",\"attributes\":{\"bibliographyId\":\"demo-oscola\",\"citationStyle\":\"oscola\",\"headingText\":\"Bibliography\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"legal_case\",\"title\":\"Donoghue v Stevenson\",\"container-title\":\"AC\",\"issued\":{\"date-parts\":[[1932]]},\"number\":\"562\"},{\"type\":\"legal_case\",\"title\":\"Carlill v Carbolic Smoke Ball Co\",\"container-title\":\"1 QB\",\"issued\":{\"date-parts\":[[1893]]},\"number\":\"256\"},{\"type\":\"legislation\",\"title\":\"Human Rights Act\",\"issued\":{\"date-parts\":[[1998]]}},{\"type\":\"regulation\",\"title\":\"Air Navigation Order 2016\",\"number\":\"SI 2016/765\"},{\"type\":\"treaty\",\"title\":\"Convention for the Protection of Human Rights and Fundamental Freedoms\",\"container-title\":\"213 UNTS\",\"page\":\"221\",\"issued\":{\"date-parts\":[[1950,11,4]]}},{\"type\":\"book\",\"title\":\"Constitutional and Administrative Law\",\"author\":[{\"family\":\"Bradley\",\"given\":\"A. W.\"},{\"family\":\"Ewing\",\"given\":\"K. D.\"},{\"family\":\"Knight\",\"given\":\"C. J. S.\"}],\"edition\":\"17\",\"publisher\":\"Pearson\",\"issued\":{\"date-parts\":[[2018]]}},{\"type\":\"article-journal\",\"title\":\"The Rule of Law\",\"author\":[{\"family\":\"Bingham\",\"given\":\"Tom\"}],\"container-title\":\"Cambridge Law Journal\",\"container-title-short\":\"CLJ\",\"volume\":\"66\",\"page\":\"67\",\"issued\":{\"date-parts\":[[2007]]}}]},{\"title\":\"ABNT: Brazilian references\",\"description\":\"Surnames in capitals, with particles such as “de” after the given name, sorted by surname. Settings: the default output; heading Referências at level H4.\",\"attributes\":{\"bibliographyId\":\"demo-abnt\",\"citationStyle\":\"abnt\",\"headingText\":\"Referências\",\"headingLevel\":4,\"outputJsonLd\":true,\"outputCoins\":false,\"outputCslJson\":false,\"outputCiteExport\":false},\"citations\":[{\"type\":\"book\",\"title\":\"O alienista\",\"author\":[{\"family\":\"Assis\",\"given\":\"Machado\",\"dropping-particle\":\"de\"}],\"publisher\":\"Ática\",\"publisher-place\":\"São Paulo\",\"issued\":{\"date-parts\":[[1997]]}},{\"type\":\"book\",\"title\":\"Raízes do Brasil\",\"author\":[{\"family\":\"Holanda\",\"given\":\"Sérgio Buarque\",\"dropping-particle\":\"de\"}],\"publisher\":\"José Olympio\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1936]]}},{\"type\":\"book\",\"title\":\"Casa-grande & senzala\",\"author\":[{\"family\":\"Freyre\",\"given\":\"Gilberto\"}],\"publisher\":\"Maia & Schmidt\",\"publisher-place\":\"Rio de Janeiro\",\"issued\":{\"date-parts\":[[1933]]}}]}]}\nJSON;\n/**\n * Playground demo page builder.\n *\n * `npm run playground:build` inlines this file into each demo blueprint's\n * runPHP step, after defining:\n *\n * - $borges_demo_json The contents of playground/demo-content.json.\n * - $borges_demo_intro An HTML lead paragraph for that blueprint.\n *\n * It rewrites post 1 as the demo page the blueprint lands on, and turns off\n * the editor's Welcome Guide so the page is visible straight away. Example\n * bibliographies are formatted with the plugin's own citeproc formatter and\n * rendered with its PHP port of save(), so they validate against whatever\n * version is installed. A release without that port (before 1.7.0) gets a\n * note instead.\n *\n * Not part of the plugin package (playground/ is in .distignore).\n *\n * @package BibliographyBuilder\n */\n\nrequire_once '/wordpress/wp-load.php';\n\n// Write as the admin, and keep kses from stripping the blocks' JSON-LD\n// scripts and data attributes: kses_init() ran before any user was set.\nwp_set_current_user( 1 );\nkses_remove_filters();\n\n$borges_demo = json_decode( $borges_demo_json, true );\n\n$borges_demo_block = static function ( $name, $attrs, $html ) {\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => $name,\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$borges_demo_paragraph = static function ( $html ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block( 'core/paragraph', array(), '

' . $html . '

' );\n};\n\n$borges_demo_heading = static function ( $text, $level ) use ( $borges_demo_block ) {\n\t$attrs = 2 === $level ? array() : array( 'level' => $level );\n\t$tag = 'h' . $level;\n\n\treturn $borges_demo_block( 'core/heading', $attrs, '<' . $tag . ' class=\"wp-block-heading\">' . esc_html( $text ) . '' );\n};\n\n$borges_demo_code = static function ( $text ) use ( $borges_demo_block ) {\n\treturn $borges_demo_block(\n\t\t'core/code',\n\t\tarray(),\n\t\t'
' . htmlspecialchars( $text, ENT_NOQUOTES, 'UTF-8' ) . '
'\n\t);\n};\n\n$borges_demo_list = static function ( $items ) {\n\t$html = \"\\n\\n\\n\\n\";\n};\n\n$borges_demo_can_prebuild = function_exists( 'bibliography_builder_render_save_markup' )\n\t&& function_exists( 'bibliography_builder_format_csl_items' )\n\t&& bibliography_builder_can_render_save_markup();\n\n// Returns the serialized block, or '' when this install cannot build it.\n$borges_demo_bibliography = static function ( $example ) use ( $borges_demo_can_prebuild ) {\n\tif ( ! $borges_demo_can_prebuild ) {\n\t\treturn '';\n\t}\n\n\t$csl_items = bibliography_builder_validate_and_sanitize_csl_items( $example['citations'] );\n\n\tif ( is_wp_error( $csl_items ) ) {\n\t\treturn '';\n\t}\n\n\t$formatted = bibliography_builder_format_csl_items( $csl_items, $example['attributes']['citationStyle'] );\n\n\tif ( is_wp_error( $formatted ) ) {\n\t\treturn '';\n\t}\n\n\t$citations = array();\n\n\tforeach ( array_values( $csl_items ) as $index => $csl ) {\n\t\t$citation = array(\n\t\t\t'id' => $example['attributes']['bibliographyId'] . '-' . ( $index + 1 ),\n\t\t\t'csl' => $csl,\n\t\t\t'formattedText' => $formatted[ $index ],\n\t\t);\n\n\t\t// The editor stores these for Cite / Export; without them it adds\n\t\t// them on load and the untouched demo opens with unsaved changes.\n\t\tforeach ( array( 'exportBibtex', 'exportBiblatex' ) as $export_key ) {\n\t\t\tif ( isset( $example['exports'][ $index ][ $export_key ] ) ) {\n\t\t\t\t$citation[ $export_key ] = $example['exports'][ $index ][ $export_key ];\n\t\t\t}\n\t\t}\n\n\t\t$citations[] = $citation;\n\t}\n\n\t$attrs = $example['attributes'];\n\t// Stored in display order, as the editor stores them.\n\t$attrs['citations'] = bibliography_builder_sort_citations_for_save( $citations, $attrs['citationStyle'] );\n\t// Render from the attributes as the editor will parse them back.\n\t$html = bibliography_builder_render_save_markup(\n\t\tbibliography_builder_decode_save_attributes( wp_json_encode( $attrs ) )\n\t);\n\n\tif ( '' === $html ) {\n\t\treturn '';\n\t}\n\n\treturn serialize_block(\n\t\tarray(\n\t\t\t'blockName' => 'bibliography-builder/bibliography',\n\t\t\t'attrs' => $attrs,\n\t\t\t'innerBlocks' => array(),\n\t\t\t'innerHTML' => $html,\n\t\t\t'innerContent' => array( $html ),\n\t\t)\n\t) . \"\\n\\n\";\n};\n\n$content = $borges_demo_paragraph( $borges_demo_intro );\n\n$content .= $borges_demo_heading( '1. Paste any supported format', 2 );\n$content .= $borges_demo_paragraph(\n\t'Select the empty Bibliography block at the end of this section, open Paste / Import, paste one or more samples, and choose Add. Separate entries with a blank line; up to 50 go in one paste, so you can copy several groups at once. A CSL-JSON document goes in a paste of its own.'\n);\n\nforeach ( $borges_demo['sampleGroups'] as $group ) {\n\t$content .= $borges_demo_heading( $group['title'], 3 );\n\t$content .= $borges_demo_paragraph( $group['description'] );\n\t$content .= $borges_demo_code( implode( \"\\n\\n\", wp_list_pluck( $group['samples'], 'input' ) ) );\n}\n\n$content .= $borges_demo_block(\n\t'bibliography-builder/bibliography',\n\tarray(\n\t\t'bibliographyId' => 'demo-try-it',\n\t\t'headingText' => 'References',\n\t),\n\t''\n);\n\n$content .= $borges_demo_heading( '2. Key features to try', 2 );\n$content .= $borges_demo_list( $borges_demo['features'] );\n\n$content .= $borges_demo_heading( '3. Example bibliographies', 2 );\n\n$borges_demo_examples = '';\n\nforeach ( $borges_demo['examples'] as $example ) {\n\t$block = $borges_demo_bibliography( $example );\n\n\tif ( '' === $block ) {\n\t\tcontinue;\n\t}\n\n\t$borges_demo_examples .= $borges_demo_heading( $example['title'], 3 );\n\t$borges_demo_examples .= $borges_demo_paragraph( $example['description'] );\n\n\t// Paragraphs that cite the example's entries with the \"Cite\" format, as\n\t// it saves them: links to `#ref-{bibliographyId}-{n}`, the IDs given above.\n\tforeach ( isset( $example['prose'] ) ? $example['prose'] : array() as $prose ) {\n\t\t$borges_demo_examples .= $borges_demo_paragraph( $prose );\n\t}\n\n\t$borges_demo_examples .= $block;\n}\n\n$content .= '' !== $borges_demo_examples\n\t? $borges_demo_paragraph( 'One example per citation style, each built from CSL-JSON. Under each title, Settings names the block settings it shows. Select a block to change them, or view the published page to see them as readers do.' ) . $borges_demo_examples\n\t: $borges_demo_paragraph( 'Pre-built examples need Borges 1.7.0 or later. Paste a few samples from section 1 to build your own.' );\n\nwp_update_post(\n\tarray(\n\t\t'ID' => 1,\n\t\t'post_title' => $borges_demo['title'],\n\t\t'post_content' => wp_slash( $content ),\n\t)\n);\n\n// Skip the block editor's Welcome Guide so the demo page is what opens.\n$borges_demo_meta_key = $GLOBALS['wpdb']->get_blog_prefix() . 'persisted_preferences';\n$borges_demo_preferences = get_user_meta( 1, $borges_demo_meta_key, true );\n$borges_demo_preferences = is_array( $borges_demo_preferences ) ? $borges_demo_preferences : array();\n\n$borges_demo_preferences['core/edit-post'] = array_merge(\n\tisset( $borges_demo_preferences['core/edit-post'] ) && is_array( $borges_demo_preferences['core/edit-post'] )\n\t\t? $borges_demo_preferences['core/edit-post']\n\t\t: array(),\n\tarray( 'welcomeGuide' => false )\n);\n$borges_demo_preferences['_modified'] = gmdate( 'c' );\n\nupdate_user_meta( 1, $borges_demo_meta_key, $borges_demo_preferences );\n" } ] } diff --git a/playground/demo-content.json b/playground/demo-content.json index 845f185..4c98338 100644 --- a/playground/demo-content.json +++ b/playground/demo-content.json @@ -210,6 +210,83 @@ } ] }, + { + "title": "In-text citations and an annotated bibliography", + "description": "Three books with the compiler's own notes, and a paragraph that cites them. Settings: Show annotations on, Chicago Notes-Bibliography. Select a citation in the paragraph and choose Cite in the toolbar to see its entry and page, or select any text and cite it yourself. Then switch the style to IEEE in the block's sidebar and choose Update citations in its Citations in this post panel: every citation becomes a numbered one, pages kept. A theme's margin-note style turns the same citations into sidenotes.", + "prose": [ + "The footnote is how a historian shows the work: Grafton, The Footnote. Print made that kind of checking possible at scale, by fixing texts so that every reader saw the same page: Eisenstein, The Printing Press as an Agent of Change. A citation is also a tool in Ivan Illich's sense, one that serves the reader only while it stays small enough to follow: Illich, Tools for Conviviality, chap. 3." + ], + "attributes": { + "bibliographyId": "demo-cite-annotate", + "citationStyle": "chicago-notes-bibliography", + "headingText": "Bibliography", + "headingLevel": 4, + "anchor": "demo-cite-annotate", + "showAnnotations": true + }, + "citations": [ + { + "type": "book", + "title": "Tools for Conviviality", + "author": [ + { + "family": "Illich", + "given": "Ivan" + } + ], + "publisher": "Harper & Row", + "publisher-place": "New York", + "issued": { + "date-parts": [ + [ + 1973 + ] + ] + }, + "annote": "Argues that past a certain scale, tools begin to serve themselves rather than the people who use them, and proposes limits that keep them convivial.\n\nThe source of the idea of counterfoil research." + }, + { + "type": "book", + "title": "The Footnote: A Curious History", + "author": [ + { + "family": "Grafton", + "given": "Anthony" + } + ], + "publisher": "Harvard University Press", + "publisher-place": "Cambridge, MA", + "issued": { + "date-parts": [ + [ + 1997 + ] + ] + }, + "annote": "A history of the scholarly footnote, from Ranke and Gibbon back to the early modern antiquaries: how notes became the way historians make their work checkable." + }, + { + "type": "book", + "title": "The Printing Press as an Agent of Change: Communications and Cultural Transformations in Early-Modern Europe", + "author": [ + { + "family": "Eisenstein", + "given": "Elizabeth L." + } + ], + "publisher": "Cambridge University Press", + "publisher-place": "Cambridge", + "issued": { + "date-parts": [ + [ + 1979 + ] + ] + }, + "annote": "Argues that printing changed how knowledge was preserved, standardized, and spread, and so helped shape the Renaissance, the Reformation, and the Scientific Revolution." + } + ] + }, { "title": "Chicago Author-Date: same author, same year", "description": "Three of Einstein’s 1905 papers. Author-date styles letter works by one author in one year (1905a, 1905b, 1905c) so in-text citations stay unambiguous. Settings: the default output (JSON-LD only); heading References at level H4.", diff --git a/playground/demo-content.php b/playground/demo-content.php index c56eb1b..69301d1 100644 --- a/playground/demo-content.php +++ b/playground/demo-content.php @@ -173,6 +173,13 @@ $borges_demo_examples .= $borges_demo_heading( $example['title'], 3 ); $borges_demo_examples .= $borges_demo_paragraph( $example['description'] ); + + // Paragraphs that cite the example's entries with the "Cite" format, as + // it saves them: links to `#ref-{bibliographyId}-{n}`, the IDs given above. + foreach ( isset( $example['prose'] ) ? $example['prose'] : array() as $prose ) { + $borges_demo_examples .= $borges_demo_paragraph( $prose ); + } + $borges_demo_examples .= $block; }