platform-bible-utils
    Preparing search index...

    Type Alias UsjReaderWriterOptions

    Set of options to provide to UsjReaderWriter's constructor to customize how the reading and writing works

    type UsjReaderWriterOptions = {
        markersMap?: MarkersMap;
        shouldAllowInvisibleCharacters?: boolean;
    }
    Index

    Properties

    markersMap?: MarkersMap

    A map of all USFM/USX/USJ markers and some information about them. Used for translating between the formats

    Defaults to trying to use a built-in markers map that matches the version of the USJ passed in.

    Currently supported built-in USFM versions:

    • 3.0/3.0.x
    shouldAllowInvisibleCharacters?: boolean

    The Paratext project setting "Allow invisible characters" (AllowInvisibleChars in Settings.xml, ScrText.Settings.AllowInvisibleChars in ParatextData) of the project this USJ belongs to. Pass the value of the project setting platformScripture.allowInvisibleCharacters for that project — useProjectSetting(projectId, 'platformScripture.allowInvisibleCharacters', false) in a web view, getSetting('platformScripture.allowInvisibleCharacters') on the project's platform.base PDP elsewhere. It can be left unset for USJ that belongs to no Paratext project, or when nothing reads USFM text from this instance.

    It decides how a no-break space (U+00A0) in the USJ text is spelled in the USFM this class writes (IUsjReaderWriter.toUsfm), matching what Paratext reads and writes for that project. It covers text content and the values of attribute markers such as \ca, \va and \cat; a value in a marker's | attribute list (lemma, a milestone's who, a figure's src) is written exactly as the USJ holds it, as ParatextData writes one:

    • false: the project's USFM spells a no-break space ~, so U+00A0 in text is written as ~. The USJ text Platform.Bible gets for such a project never contains ~ (an attribute value can: ParatextData keeps a ~ in most attribute values as written); a ~ that is in the text anyway is written as ~ too, so Paratext saves it as a no-break space. A literal tilde cannot be represented in text.
    • true: ~ is an ordinary character (a literal tilde) and U+00A0 is written as itself, so the two stay distinct. Writing this project's USJ with false would turn every no-break space into a literal tilde when the USFM is saved.

    Nothing else depends on it: searching and every location and index conversion read the USJ, and ~ and U+00A0 are each one UTF-16 code unit, so USFM indices are the same either way.

    Defaults to false