sillsdev / appbuilder-pwa

Progress Web App template for Scripture App Builder
https://software.sil.org/scriptureappbuilder
MIT License
10 stars 26 forks source link

Convert: DAB: Parse Specific Config #676

Open chrisvire opened 2 months ago

chrisvire commented 2 months ago

SAB and DAB share a lot of the same config, but there will be parts that are unique to DAB.

The main data elements in a DAB project are:

    <database-filename>data.sqlite</database-filename>
    <lexicon-db type="flex-xhtml" />

The main data elements in an SAB project are:

    <books id="C01">
        <book-collection-name>World English Bible</book-collection-name>
        <book-collection-abbrev>web</book-collection-abbrev>
        <book-collection-description></book-collection-description>
        ...
    </books>

You will need to make the convert/convertConfig.ts file work with both types. The way that you tell which is which is in the <app-definition> tag:

<app-definition type="DAB" program-version="12.1">

The writing-system entries in DAB are more complex that what is in SAB.

Here is an example writing-systems from the Hanga project:

    <writing-systems>
        <writing-system code="hag-Latn-GH-fonipa-x-emic" type="main|gloss">
            <display-names>
                <form lang="default">Hanga</form>
            </display-names>
            <font-family>font-hag-Latn-GH-fonipa-x-emic</font-family>
            <trait name="text-direction" value="LTR"/>
            <trait name="indexed" value="false"/>
            <sort-method type="none">
                <ignore-chars>- = ~ * ( ) [ ] ¡ ¿</ignore-chars>
            </sort-method>
            <alphabet>a b ch d e f g gb h i j k kp l m n ny ŋ ŋm o p r s t u v w y z</alphabet>
            <input-buttons>a b ch d e f g gb h i j k kp l m n ny ŋ ŋm o p r s t u v w y z</input-buttons>
            <features type="writing-system">
                <e name="summary-gloss" value="true"/>
            </features>
        </writing-system>
        <writing-system code="en" type="gloss">
            <display-names>
                <form lang="default">English</form>
            </display-names>
            <font-family>font-en</font-family>
            <trait name="text-direction" value="LTR"/>
            <trait name="indexed" value="true"/>
            <sort-method type="none">
                <ignore-chars>- = ~ * ( ) [ ] ¡ ¿</ignore-chars>
            </sort-method>
            <alphabet>a b c d e f g h i j k l m n o p q r s t u v w x y z</alphabet>
            <reversal-filename>Hanga dictionary reversals.xhtml</reversal-filename>
        </writing-system>
    </writing-systems>

Here is an example writing-systems from SAB:

        <writing-systems>
            <writing-system code="en" type="interface">
                <display-names>
                    <form lang="en">English</form>
                    <form lang="fr">Anglais</form>
                    <form lang="es">Inglés</form>
                    <form lang="de">Englisch</form>
                </display-names>
                <font-family>system</font-family>
                <trait name="text-direction" value="LTR"/>
            </writing-system>
            <writing-system code="fr" type="interface">
                <display-names>
                    <form lang="en">French</form>
                    <form lang="fr">Français</form>
                    <form lang="es">Francés</form>
                    <form lang="de">Französisch</form>
                </display-names>
                <font-family>system</font-family>
                <trait name="text-direction" value="LTR"/>
            </writing-system>
            <writing-system code="de" type="interface">
                <display-names>
                    <form lang="en">German</form>
                    <form lang="fr">Allemand</form>
                    <form lang="de">Deutsch</form>
                    <form lang="es">Alemán</form>
                </display-names>
                <font-family>system</font-family>
                <trait name="text-direction" value="LTR"/>
            </writing-system>
            <writing-system code="es" type="interface">
                <display-names>
                    <form lang="en">Spanish</form>
                    <form lang="fr">Espagnol</form>
                    <form lang="es">Español</form>
                    <form lang="de">Spanisch</form>
                </display-names>
                <font-family>system</font-family>
                <trait name="text-direction" value="LTR"/>
            </writing-system>
        </writing-systems>

So you can see there is a different "type" (interface or gloss) and additional optional properties.

chrisvire commented 1 month ago

In DAB 12.2, there has been a change in how to determine if there will be index files (surprise to me).

Prior to DAB 12.2, there was a <trait name="indexed" value="true|false"> in the <writing-system> element. In DAB 12.2, that has been pulled out into a separate configuration.

    <indexes>
        <index lang="en" displayed="true"></index>
        <index lang="hag-Latn-GH-fonipa-x-emic" displayed="false"></index>
    </indexes>