DITA import
Bring a DITA 1.3 project in as modules, manuals, variants, translations and files, and read what had no counterpart.
A project kept in DITA comes in through the same import as the
import format, with the importer dita: a ZIP of a DITA 1.3
project becomes modules, manuals, variants, translations and files, in a new revision (a change
set) to review.
Map the project first
How DITA's names map to your project is dita in openfolia.yaml, so nothing about one project's DITA
is in code. Every key is optional:
dita:
moduleTypes: { task: procedure } # topic type → module type
outputclasses: { howto: procedure } # an @outputclass token → module type; wins over moduleTypes
defaultModuleType: concept # any other topic
profiling:
product: { variantAttribute: model, values: { compact: small } }
audience: { audience: { user: public } }
textKeys: { prodname: product-name } # an empty <ph keyref="prodname"/> → a text attribute
hazardSymbols: { hot-surface.svg: w001 } # a <hazardsymbol> → a safety symbol
ditavalDefault: none # a DITAVAL file no map names: none (default) or allWithout a mapping, a profiling attribute named like a variant attribute maps to it, and
audience maps to the audience levels of the same IDs. A value naming nothing configured is not
refused: GET /config lists it in meta.ditaIssues, and the import uses its default there. The
openfolia.yaml reference lists every key.
Import it
-
ZIP the project: maps, topics, images and DITAVAL files, in any folders. Put translations in top-level folders named as configured languages (
de/,fr/); everything else is the source language. -
Check it with a dry run, as for any import, naming the importer. Like every import, it is made with a signed-in person's session in
cookies.txt, not a service account's token. Make that file readable by you only, sign out and delete it when you are done: Sign in for the import shows how.curl -s -b cookies.txt -H "X-Ccms-Request: 1" \ -F file=@project.zip -F importer=dita -F dryRun=true \ https://docs.example.com/api/imports -
Read
meta.report.converterReport: what had no counterpart, each entry starting with a stable code in brackets, such as[dropped-element]. Nothing is dropped silently. -
Upload it again without
dryRun, then apply it (POST /imports/<importId>/apply), as on Import format. A topic the import refuses (too large, say) can be left out withskipRefusedwhen nothing else needs it, as for any importer.
How it maps
| DITA | Becomes |
|---|---|
| a root map or bookmap, in the source language | a manual |
each DITAVAL file a root map names (<ditavalref>) | a variant of that manual |
| a top-level topic | a module, its ID from its path (topics/install.dita → topics-install) |
| a topic at the same path in a language folder | that module's translation |
filter attributes (@product, @audience, …) | variant blocks, by the profiling mapping |
| content references and keys | resolved; an empty <ph keyref> a text attribute |
| images | files |
The same project always gives the same IDs, so importing it again updates what changed and skips
what did not. docs/dita-import.md in the repository has the full mapping table and every report
code.
What it refuses or leaves out
- Safe reading: no DTD is read or fetched, no entity is expanded, and only UTF-8 is read. A
file the reader refuses (
not-well-formed,dtd-subset,unsupported-encoding,too-large) is reported and left out; the rest are imported. - Nothing outside the archive: a reference leaving the archive resolves to nothing
(
outside-archive), and nothing is fetched (external-reference). - Bounded: content references, keys and maps are followed only so deep and so wide
(
expansion-limit). The conversion runs in a process of its own, bounded byCCMS_IMPORT_CONVERT_MAX_MEMORY_MBandCCMS_IMPORT_CONVERT_TIMEOUT_MS; past either, the import is 422import-too-large. - No counterpart: index terms, relationship tables, inline conditions and the like are left out or kept without what they said, each reported.
The way back out is the DITA export of a release.