diff --git a/bin/docserv-createconfig b/bin/docserv-createconfig index 976efe00..895f216d 100755 --- a/bin/docserv-createconfig +++ b/bin/docserv-createconfig @@ -164,9 +164,9 @@ def generate_config(args, git_url, branches, version=SCHEMAVERSION): branch = "trans/%s" % tmp etree.SubElement(lang, "branch").text = branch etree.SubElement(lang, "subdir").text = FIXME - # TODO: add external/links as comments - # externallinks = etree.SubElement(docset, "external") - # etree.SubElement(externallinks, "link", href=FIXME).text = "SOME DESCRIPTION" + # TODO: add weblinks/links as comments + # weblinks = etree.SubElement(docset, "weblinks") + # etree.SubElement(weblinks, "link", href=FIXME).text = "SOME DESCRIPTION" tree = etree.ElementTree(root) configfile = os.path.join(os.getcwd(), "{}.xml".format(args.productid)) diff --git a/config/product-config/docserv2.xml b/config/product-config/docserv2.xml index dbca3408..2074b8ff 100644 --- a/config/product-config/docserv2.xml +++ b/config/product-config/docserv2.xml @@ -36,13 +36,13 @@ - + - + diff --git a/config/product-config/example_product.xml b/config/product-config/example_product.xml index d967c7df..4cb0aca3 100644 --- a/config/product-config/example_product.xml +++ b/config/product-config/example_product.xml @@ -138,15 +138,15 @@ - + - + - + @@ -167,7 +167,7 @@ - + @@ -207,7 +207,7 @@ - + @@ -223,7 +223,7 @@ - + diff --git a/docs/adoc/config-product.adoc b/docs/adoc/config-product.adoc index 8bf7f199..bc345a4d 100644 --- a/docs/adoc/config-product.adoc +++ b/docs/adoc/config-product.adoc @@ -43,17 +43,17 @@ A very reduced example of a product configuration file may look like this: - + - - + + - + @@ -138,10 +138,10 @@ The optional `@navigation` attribute of docsets defines whether to create naviga {ds2} will automatically create ZIP archives of these documents. + However, to update the navigational pages for such documents, the documents need to remain buildable within {ds2}, even if the product is no longer supported. -* ``: References to {ds2} navigational pages or documents defined elsewhere in the product configuration. +* ``: References to {ds2} navigational pages or documents defined elsewhere in the product configuration. {ds2} will extract the URL and metadata such as the document title from their original context in the product configuration. -* ``: References to documents created outside of {ds2}. +* ``: References to documents created outside of {ds2}. Such documents can be located anywhere on the internet. They can also be located on the same host as {ds2}-created documents, placed in such a way that they do not interfere with the directory structure created by {ds2}. URLs and document titles of such documents must be defined manually. @@ -200,21 +200,21 @@ Within a `` element of a non-default `` element, the nu [#config-product-external-reference] -### References to documents not generated within {ds2}, `` +### References to documents not generated within {ds2}, `` -The `` element collects links to documents that are not generated using {ds2}. +The `` element collects links to documents that are not generated using {ds2}. {ds2} makes no effort to ensure availability of such documents, meaning all links to them must be checked manually. Such documents can be co-hosted along with {ds2} or be on another host altogether. -For each required document, add a `` element to the `` element. +For each required document, add a `` element to the `` element. A `` can reference documents in multiple formats and multiple languages. The primary language (``) must be listed first. [#config-product-internal-reference] -### {ds2}-internal references, `` +### {ds2}-internal references, `` -Within the `` element, reference documents already defined elsewhere in the {ds2} configuration. +Within the `` element, reference documents already defined elsewhere in the {ds2} configuration. Document references (using the `` element) will inherit all properties of the original document, such as available formats and languages and reduce duplication. You can also reference related product pages within this element. @@ -256,9 +256,9 @@ Likewise, within a `` section, the `@lang` attributes' values of `` attributes) must be unique within the `` that contains them. After removing the `DC-` prefix, DC file names are used as path components. -These identifiers can be used for `` references to generated documents. -* `` is an optional identifier for `` links. -These identifiers can be used for `` references to such links. +These identifiers can be used for `` references to generated documents. +* `` is an optional identifier for `` links. +These identifiers can be used for `` references to such links. * URLs referenced within external links (``) elements must be unique within the context of the docset they are used in. diff --git a/share/build-navigation/build-navigation-json.xsl b/share/build-navigation/build-navigation-json.xsl index fe7bd2e3..4fd9a746 100644 --- a/share/build-navigation/build-navigation-json.xsl +++ b/share/build-navigation/build-navigation-json.xsl @@ -405,8 +405,8 @@ select="( builddocs/language[@default = 'true']/deliverable[not(subdeliverable)][not(@category)] | builddocs/language[@default = 'true']/deliverable/subdeliverable[not(@category)] )" mode="generate-docset-json"/> - - + + @@ -436,8 +436,8 @@ select="( $node/builddocs/language[@default = 'true']/deliverable[not(subdeliverable)][contains(concat(' ', @category,' '), $categoryid)] | $node/builddocs/language[@default = 'true']/deliverable/subdeliverable[contains(concat(' ',@category,' '), $categoryid)] )" mode="generate-docset-json"/> - - + + @@ -724,7 +724,7 @@ - + @@ -740,7 +740,7 @@ - + @@ -840,7 +840,7 @@ - + diff --git a/share/validate-product-config/checks/check-duplicated-format-in-extralinks.sh b/share/validate-product-config/checks/check-duplicated-format-in-extralinks.sh index b01a55ea..c3f998c5 100644 --- a/share/validate-product-config/checks/check-duplicated-format-in-extralinks.sh +++ b/share/validate-product-config/checks/check-duplicated-format-in-extralinks.sh @@ -5,14 +5,14 @@ file=$1 -links=$($starlet sel -t -v "count(//language[parent::link/parent::external])" $file) +links=$($starlet sel -t -v "count(//language[parent::link/parent::weblinks])" $file) for link in $(seq 1 "$links"); do - current_id=$($starlet sel -t -v '(//language[parent::link/parent::external])['"$link"']/url[1]/@href' $file | sort) - formats=$($starlet sel -t -v '(//language[parent::link/parent::external])['"$link"']/url/@format' $file | sort) + current_id=$($starlet sel -t -v '(//language[parent::link/parent::weblinks])['"$link"']/url[1]/@href' $file | sort) + formats=$($starlet sel -t -v '(//language[parent::link/parent::weblinks])['"$link"']/url/@format' $file | sort) uniqueformats=$(echo -e "$formats" | sort -u) [[ ! "$formats" == "$uniqueformats" ]] && \ echo -e \ - "For the link with the URL \"$current_id\", some of the values of format attributes in url elements are duplicated. Check for occurrences of the following duplicated format attribute(s) in the link \"$current_id\": "$(comm -2 -3 <(echo -e "$formats") <(echo -e "$uniqueformats") | tr '\n' ' ')".\n---" + "For the link with the URL \"$current_id\", some of the values of format attributes in url elements are duplicated. Check for occurrences of the following duplicated format attribute(s) in the web link \"$current_id\": "$(comm -2 -3 <(echo -e "$formats") <(echo -e "$uniqueformats") | tr '\n' ' ')".\n---" done exit 0 diff --git a/share/validate-product-config/checks/check-duplicated-linkid.sh b/share/validate-product-config/checks/check-duplicated-linkid.sh index 3032a149..d6cd7ea0 100644 --- a/share/validate-product-config/checks/check-duplicated-linkid.sh +++ b/share/validate-product-config/checks/check-duplicated-linkid.sh @@ -6,13 +6,13 @@ file=$1 -externals=$($starlet sel -t -v "count(//external)" $file) +externals=$($starlet sel -t -v "count(//weblinks)" $file) for external in $(seq 1 $externals); do - linkids=$($starlet sel -t -v '(//external)['"$external"']/link/@linkid' $file | sort) + linkids=$($starlet sel -t -v '(//weblinks)['"$external"']/link/@linkid' $file | sort) uniquelinkids=$(echo -e "$linkids" | sort -u) - curdocset=$($starlet sel -t -v '(//external)['"$external"']/ancestor::docset/@setid' $file) + curdocset=$($starlet sel -t -v '(//weblinks)['"$external"']/ancestor::docset/@setid' $file) [[ ! "$linkids" == "$uniquelinkids" ]] && \ echo -e \ diff --git a/share/validate-product-config/checks/check-duplicated-url-in-extralinks.sh b/share/validate-product-config/checks/check-duplicated-url-in-extralinks.sh index 996740ab..f84fc453 100644 --- a/share/validate-product-config/checks/check-duplicated-url-in-extralinks.sh +++ b/share/validate-product-config/checks/check-duplicated-url-in-extralinks.sh @@ -4,17 +4,17 @@ file=$1 -externallinks_sections=$($starlet sel -t -v "count(//external)" $file) +externallinks_sections=$($starlet sel -t -v "count(//weblinks)" $file) for externallinks_section in $(seq 1 "$externallinks_sections"); do - current_id=$($starlet sel -t -v '(//external)['"$externallinks_section"']/ancestor::docset/@setid' $file) + current_id=$($starlet sel -t -v '(//weblinks)['"$externallinks_section"']/ancestor::docset/@setid' $file) # FIXME: The removal of http(s):// here is a bit unkosher -- especially # since we don't add it back at the end before displaying the result to # the user. - urls=$($starlet sel -t -v '(//external)['"$externallinks_section"']/descendant::url/@href' $file | sed -r 's%^https?://%%' | sort) + urls=$($starlet sel -t -v '(//weblinks)['"$externallinks_section"']/descendant::url/@href' $file | sed -r 's%^https?://%%' | sort) uniqueurls=$(echo -e "$urls" | sort -u) [[ ! "$urls" == "$uniqueurls" ]] && \ echo -e \ - "Within the external links section of docset $current_id, some URLs are duplicated. Check for occurrences of the following duplicated URL(s) within the external links of docset \"$current_id\": "$(comm -2 -3 <(echo -e "$urls") <(echo -e "$uniqueurls") | tr '\n' ' ')".\n---" + "Within the external links section of docset $current_id, some URLs are duplicated. Check for occurrences of the following duplicated URL(s) within the web links of docset \"$current_id\": "$(comm -2 -3 <(echo -e "$urls") <(echo -e "$uniqueurls") | tr '\n' ' ')".\n---" done exit 0 diff --git a/share/validate-product-config/checks/check-lang-code-in-extralinks.sh b/share/validate-product-config/checks/check-lang-code-in-extralinks.sh index ec4cf84b..000b0046 100644 --- a/share/validate-product-config/checks/check-lang-code-in-extralinks.sh +++ b/share/validate-product-config/checks/check-lang-code-in-extralinks.sh @@ -5,14 +5,14 @@ file=$1 -links=$($starlet sel -t -v "count(//link[parent::external])" $file) +links=$($starlet sel -t -v "count(//link[parent::weblinks])" $file) for link in $(seq 1 "$links"); do - current_id=$($starlet sel -t -v '(//link[parent::external])['"$link"']/language[1]/url[1]/@href' $file | sort) - langcodes=$($starlet sel -t -v '(//link[parent::external])['"$link"']/language/@lang' $file | sort) + current_id=$($starlet sel -t -v '(//link[parent::weblinks])['"$link"']/language[1]/url[1]/@href' $file | sort) + langcodes=$($starlet sel -t -v '(//link[parent::weblinks])['"$link"']/language/@lang' $file | sort) uniquelangcodes=$(echo -e "$langcodes" | sort -u) [[ ! "$langcodes" == "$uniquelangcodes" ]] && \ echo -e \ - "Some of the localized versions of \"$current_id\" have non-unique lang attributes. Check for occurrences of the following duplicated lang attribute(s) in the language elements of link \"$current_id\": "$(comm -2 -3 <(echo -e "$langcodes") <(echo -e "$uniquelangcodes") | tr '\n' ' ')".\n---" + "Some of the localized versions of \"$current_id\" have non-unique lang attributes. Check for occurrences of the following duplicated lang attribute(s) in the language elements of web link \"$current_id\": "$(comm -2 -3 <(echo -e "$langcodes") <(echo -e "$uniquelangcodes") | tr '\n' ' ')".\n---" done exit 0 diff --git a/share/validate-product-config/global-check-ref-list.xsl b/share/validate-product-config/global-check-ref-list.xsl index e21312b1..60a3808a 100644 --- a/share/validate-product-config/global-check-ref-list.xsl +++ b/share/validate-product-config/global-check-ref-list.xsl @@ -51,7 +51,7 @@ all exist. --> + test="not(//product[@productid = $product]/docset[@setid = $docset]/weblinks/link[@linkid = $link])"> Reference (ref) to failed. Referenced external link does not exist. @@ -67,15 +67,6 @@ all exist. --> --- - - - Reference (ref) to - - failed. Referenced product does not exist. - --- - - Reference failed. This issue should have been caught by the RNC validation. This is a docserv-stitch bug. --- diff --git a/share/validate-product-config/product-config-schema.rnc b/share/validate-product-config/product-config-schema.rnc index 47e5b5eb..07ce1472 100644 --- a/share/validate-product-config/product-config-schema.rnc +++ b/share/validate-product-config/product-config-schema.rnc @@ -331,11 +331,11 @@ ds.docset = ds.overridedesc?, ( (ds.builddocs, - ds.internal?, - ds.external?) | - (ds.internal, - ds.external?) | - ds.external + ds.crossrefs?, + ds.weblinks?) | + (ds.crossrefs, + ds.weblinks?) | + ds.weblinks ) } @@ -571,9 +571,9 @@ ds.subdeliverablerestricted = ds.type.id } -ds.internal = +ds.crossrefs = ## Container for Docserv²-internal references - element internal { + element crossrefs { ds.ref+ } @@ -589,48 +589,43 @@ ds.ref = element ref { ## Product ID of referenced document or navigational page attribute product { ds.type.id }, + ## Docset ID of referenced document or navigational page + attribute docset { ds.type.id }, ( - ## Docset ID of referenced navigational page - attribute docset { ds.type.id }? | ( - ## Docset ID of referenced document - attribute docset { ds.type.id }, - ( - ( - ## DC file name of referenced document - attribute dc { ds.type.id }, - ## Subdeliverable (DocBook/AsciiDoc ID) of referenced document - attribute subdeliverable { ds.type.id }?, - ## How to display the document title on the product version navigational page, a combination of the following values: - ## * `title`: title as extracted from the document - ## * `subtitle`: subtitle as extracted from the document (can be empty) - ## * `docset`: product and version number as classified in the Docserv² product configuration - ## * `product`: product and version number as extracted from the document (can be empty) - ## Note the following: - ## * `title` is mandatory - ## * `docset` and `product` are mutually exclusive. - ## * the order of values must be `title`, `subtitle`, `docset`/`product` - ## Default: `title subtitle docset` - attribute titleformat { ds.type.titleformat.build }?) | - (attribute link { ds.type.id }, - ## How to display the document title on the product version navigational page, a combination of the following values: - ## * `title`: title as extracted from the document - ## * `docset`: product and version number as classified in the Docserv² product configuration - ## Note the following: - ## * `title` is mandatory - ## * the order of values must be `title`, `docset` - ## Default: `title docset` - attribute titleformat { ds.type.titleformat.link }?) - ) - ) - ), + ## DC file name of referenced document + attribute dc { ds.type.id }, + ## Subdeliverable (DocBook/AsciiDoc ID) of referenced document + attribute subdeliverable { ds.type.id }?, + ## How to display the document title on the product version navigational page, a combination of the following values: + ## * `title`: title as extracted from the document + ## * `subtitle`: subtitle as extracted from the document (can be empty) + ## * `docset`: product and version number as classified in the Docserv² product configuration + ## * `product`: product and version number as extracted from the document (can be empty) + ## Note the following: + ## * `title` is mandatory + ## * `docset` and `product` are mutually exclusive. + ## * the order of values must be `title`, `subtitle`, `docset`/`product` + ## Default: `title subtitle docset` + attribute titleformat { ds.type.titleformat.build }?) | + ( + attribute link { ds.type.id }, + ## How to display the document title on the product version navigational page, a combination of the following values: + ## * `title`: title as extracted from the document + ## * `docset`: product and version number as classified in the Docserv² product configuration + ## Note the following: + ## * `title` is mandatory + ## * the order of values must be `title`, `docset` + ## Default: `title docset` + attribute titleformat { ds.type.titleformat.link }?) + )?, attribute category { ds.type.idmulti }?, empty } -ds.external = +ds.weblinks = ## Container for references to externally-hosted documents - element external { + element weblinks { ds.link* } diff --git a/src/docserv/bih.py b/src/docserv/bih.py index 6e8c535e..eda7c76a 100644 --- a/src/docserv/bih.py +++ b/src/docserv/bih.py @@ -433,7 +433,7 @@ def read_conf_dir(self): return False # check if there is any buildable documentation in the language - # requested -- it's possible that there only are internal/external + # requested -- it's possible that there only are crossrefs/weblinks # sections but there is no builddocs section (or none for the language # in question). self.build_docs = True