@pretextbook/web-editor 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -313,15 +313,23 @@ export declare function assembleProjectSource(divisions: Division[], rootXmlId:
313
313
  * `<section xml:id="...">...</section>`) into a standalone PreTeXt fragment
314
314
  * document suitable for a build-server preview of just that division.
315
315
  *
316
- * Unlike {@link assembleProjectSource}, this never expands `<plus:* ref="..."/>`
317
- * placeholders they are left as-is for the build server to handle when
318
- * rendering a fragment preview.
316
+ * This function itself never expands `<plus:* ref="..."/>` placeholders —
317
+ * the real build server has no notion of that placeholder syntax, so callers
318
+ * must resolve them first (e.g. via {@link assembleProjectSource}) before
319
+ * passing `divisionXml` in. Passing unresolved refs produces invalid PreTeXt
320
+ * and a build failure.
319
321
  *
320
322
  * `divisionType` determines the minimal wrapper needed around `divisionXml`:
321
323
  * root types (`book`/`article`/`slideshow`) need none, `chapter`/`part` are
322
324
  * wrapped in a bare `<book>`, and everything else in a bare `<article>`.
325
+ * The PreTeXt schema requires `<book>`/`<article>` to have a `<title>` as
326
+ * their first child, so a wrapper built here uses `wrapperTitle` for that —
327
+ * without it the build server's schema validation rejects the document,
328
+ * produces no output, and 500s.
323
329
  * `docinfo` (the full `<docinfo>...</docinfo>` element, or `""`) is inserted
324
330
  * as a sibling of the root element inside `<pretext>`, matching real PreTeXt
325
331
  * document shape.
332
+ *
333
+ * We need to add `label="preview"` (or really any label) since if this isn't present the build server won't know what file to return.
326
334
  */
327
- export declare function wrapDivisionForPreview(divisionType: DivisionType, divisionXml: string, docinfo: string): string;
335
+ export declare function wrapDivisionForPreview(divisionType: DivisionType, divisionXml: string, docinfo: string, wrapperTitle: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretextbook/web-editor",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "private": false,
5
5
  "description": "A web-based editor for PreTeXt documents, with simple preview functionality",
6
6
  "keywords": [