From 21967c67fbe6837b7bb77d8f0dfc4870272bcbf5 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Wed, 23 Nov 2022 16:26:55 +0100 Subject: [PATCH] docs: text values: describe which combinations of gui_element and encoding are desirable (DEV-1521) (#259) --- docs/dsp-tools-create-ontologies.md | 6 ++--- docs/dsp-tools-xmlupload.md | 34 +++++++++++++++-------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/docs/dsp-tools-create-ontologies.md b/docs/dsp-tools-create-ontologies.md index acca61cb9..25a7bbb89 100644 --- a/docs/dsp-tools-create-ontologies.md +++ b/docs/dsp-tools-create-ontologies.md @@ -530,17 +530,17 @@ for more information. *gui_elements / gui_attributes*: -- `SimpleText`: A simple text entry box (one line only) +- `SimpleText`: one-line text entry box (for text **without** markup) - *gui_attributes*: - `maxlength=integer` (optional): maximal length (number of characters accepted) - `size=integer` (optional): size (width) of widget -- `Textarea`: A multiline text entry box +- `Textarea`: multiline text entry box (for text **without** markup) - *gui_attributes*: - `cols=integer` (optional): number of columns of the textarea - `rows=integer` (optional): number of rows of the textarea - `width=percent` (optional): width of the textarea on the screen - `wrap=soft|hard` (optional): wrapping of text -- `Richtext`: A rich-text editor. +- `Richtext`: multiline rich-text editor (for text **with** markup) - *gui_attributes*: No attributes Example: diff --git a/docs/dsp-tools-xmlupload.md b/docs/dsp-tools-xmlupload.md index 8f3a5a59b..57eb310b6 100644 --- a/docs/dsp-tools-xmlupload.md +++ b/docs/dsp-tools-xmlupload.md @@ -676,34 +676,36 @@ Attributes: The `` element has the following attributes: -- `encoding`: either "utf8" or "xml" (required) +- `encoding` (required) - `utf8`: simple text without markup - `xml`: complex text with markup. It must follow the XML format as defined by the [DSP standard mapping](https://docs.dasch.swiss/latest/DSP-API/03-apis/api-v2/xml-to-standoff-mapping/). -- `permissions`: Permission ID (optional, but if omitted, users who are lower than a `ProjectAdmin` have no permissions at all, not even view rights) +- `permissions`: Permission ID (optional, but if omitted, users who are lower than a `ProjectAdmin` have no permissions + at all, not even view rights) - `comment`: a comment for this specific value (optional) -Within a text property, multiple simple (UTF8) and complex (XML) text values may be mixed. -Both simple and complex text values can be used inside all `gui_element`s that are defined in an ontology (`SimpleText`, -`Richtext`, `Textarea`, see [here](dsp-tools-create-ontologies.md#textvalue)). But typically, you would use UTF8 in a -`SimpleText`, and XML in `Richtext` or `Textarea`. +For the possible combinations of `encoding` with the `gui_element` [defined in the ontology](dsp-tools-create-ontologies.md#textvalue), +see the table: + +| `gui_element` (JSON ontology) | `encoding` (XML data) | How DSP-APP renders the whitespaces | +|-------------------------------|-----------------------|------------------------------------------------------------------------------------------------------------------------------| +| `SimpleText` | `utf8` | Pretty-print whitespaces and newlines from the XML are taken into the text field as they are. | +| `Textarea` | `utf8` | Pretty-print whitespaces and newlines from the XML are taken into the text field as they are. | +| `Richtext` | `xml` | Pretty-print whitespaces and newlines from the XML are removed. If you want a newline in the text field, use `
` instead. | -Example of a public simple text and a hidden complex text: +Example of a public and a hidden text: ```xml - - Probe bei "Wimberger". Lokal in Wien? + + Probe bei "Wimberger". Lokal in Wien? - Bold text and a link to an ID - and a link to an IRI + Bold text and a link to an ID.
+ And a link to an IRI.
``` -The complex text above contains a link to the resource `obj_0003`, which is defined in the same XML file. -It also contains a link to the resource `http://rdfh.ch/4123/nyOODvYySV2nJ5RWRdmOdQ`, which already exists on the DSP server. - -For simple texts, it is not advised to add XML-"pretty-print" whitespaces or line breaks, because they will be taken -into the text field as they are. +The second text above contains a link to the resource `obj_0003`, which is defined in the same XML file. It also +contains a link to the resource `http://rdfh.ch/4123/nyOODvYySV2nJ5RWRdmOdQ`, which already exists on the DSP server. ### <time-prop>