w3c / wpub

W3C Web Publications
https://w3c.github.io/wpub/
Other
78 stars 19 forks source link

Manifest generation script reinstated #367

Closed iherman closed 6 years ago

iherman commented 6 years ago

With https://github.com/w3c/echidna/issues/596 and https://github.com/w3c/specberus/pull/781 closed, the additional script that generates a manifest into our spec is now reinstated.

@mattgarrish @BigBlueHat


Preview | Diff

iherman commented 6 years ago

For reference, this is the WP Manifest added automatically to the WP draft. A best attempt is made to add the full "boundaries" to the resources' list (per the TPAC decisions), ie, the images with relative URI-s; this is important if the WP gets packaged...

<link rel="publication" href="#wp_manifest">
<script type="application/ld+json" id="wp_manifest">
    {
    "@context": [
        "https://schema.org",
        "https://www.w3.org/ns/wp-context"
    ],
    "type": "TechArticle",
    "accessMode": [
        "textual",
        "diagramOnVisual"
    ],
    "accessModeSufficient": [
        "textual"
    ],
    "resources": [
        {
            "type": "LinkedResource",
            "url": "https://www.w3.org/StyleSheets/TR/2016/logos/W3C",
            "encodingFormat": "image/svg+xml",
            "description": "W3C Logo"
        },
        {
            "type": "LinkedResource",
            "url": "https://www.w3.org/StyleSheets/TR/2016/base.css",
            "rel": "stylesheet",
            "encodingFormat": "text/css",
            "description": "Generic CSS file for W3C TR documents"
        },
        {
            "type": "LinkedResource",
            "url": "https://www.w3.org/StyleSheets/TR/2016/W3C-ED",
            "rel": "stylesheet",
            "encodingFormat": "text/css",
            "description": "CSS file depending on the status of the document"
        },
        {
            "type": "LinkedResource",
            "url": "https://www.w3.org/StyleSheets/TR/2016/logos/ED",
            "encodingFormat": "image/svg+xml",
            "description": "Sidebar logo reflecting the status of the document"
        },
        {
            "type": "LinkedResource",
            "url": "images/orcid.gif",
            "encodingFormat": "image/gif",
            "description": "ORCID logo"
        },
        {
            "type": "LinkedResource",
            "url": "images/WP-diagram.svg",
            "encodingFormat": "image/svg+xml"
        },
        {
            "type": "LinkedResource",
            "url": "images/manifest_lifecycle.svg",
            "encodingFormat": "image/svg+xml"
        },
        {
            "type": "LinkedResource",
            "url": "images/find_manifest.svg",
            "encodingFormat": "image/svg+xml"
        },
        {
            "type": "LinkedResource",
            "url": "images/canonicalize_manifest.svg",
            "encodingFormat": "image/svg+xml"
        },
        {
            "type": "LinkedResource",
            "url": "images/convert_manifest.svg",
            "encodingFormat": "image/svg+xml"
        },
        {
            "type": "LinkedResource",
            "url": "images/clean_up_data.svg",
            "encodingFormat": "image/svg+xml"
        },
        {
            "type": "LinkedResource",
            "url": "images/WP-diagram.png",
            "encodingFormat": "image/png",
            "description": "PNG image of the structure of Web Publications"
        },
        {
            "type": "LinkedResource",
            "url": "images/manifest_lifecycle.png",
            "encodingFormat": "image/png",
            "description": "PNG image of the lifecycle algorithm overview"
        },
        {
            "type": "LinkedResource",
            "url": "images/find_manifest.png",
            "encodingFormat": "image/png",
            "description": "PNG image of the algorithm for finding the manifest"
        },
        {
            "type": "LinkedResource",
            "url": "images/canonicalize_manifest.png",
            "encodingFormat": "image/png",
            "description": "PNG SVG image of the canonicalization algorithm"
        },
        {
            "type": "LinkedResource",
            "url": "images/convert_manifest.png",
            "encodingFormat": "image/png",
            "description": "PNG image of converting the manifest into a data structure implementing the WebIDL representation"
        },
        {
            "type": "LinkedResource",
            "url": "images/clean_up_data.png",
            "encodingFormat": "image/png",
            "description": "PNG image on cleaning up the final data"
        }
    ],
    "links": [
        {
            "type": "LinkedResource",
            "url": "https://www.w3.org/Consortium/Legal/privacy-statement-20140324",
            "encodingFormat": "text/html",
            "rel": "privacy-policy"
        },
        {
            "type": "LinkedResource",
            "url": "https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document",
            "encodingFormat": "text/html",
            "rel": "license describedby"
        },
        {
            "type": "LinkedResource",
            "url": "http://www.w3.org/Consortium/Legal/ipr-notice#Copyright",
            "encodingFormat": "text/html",
            "rel": "copyright"
        }
    ],
    "id": "https://www.w3.org/TR/wpub/",
    "url": "https://w3c.github.io/wpub/",
    "datePublished": "2018-11-12",
    "editor": [
        {
            "type": "Person",
            "name": "Matt Garrish",
            "affiliation": {
                "type": "Organization",
                "name": "DAISY Consortium",
                "url": "http://www.daisy.org"
            }
        },
        {
            "type": "Person",
            "name": "Ivan Herman",
            "id": "https://www.w3.org/People/Ivan/",
            "affiliation": {
                "type": "Organization",
                "name": "W3C",
                "url": "https://www.w3.org"
            }
        }
    ]
}
</script>
iherman commented 6 years ago

(I would prefer to merge this only if #363 is merged to avoid problems...)

HadrienGardeur commented 6 years ago

@iherman don't overthink it too much when it comes to packaging and relative URIs.

To package a WP using a ZIP container requires a lot more work than just relative URIs, you also need to potentially rewrite a lot of URIs in HTML/CSS (ouch) and even JS (argh). Web Packaging would solve that issue since everything is tied back to a URI, but that's not our focus for now.

iherman commented 6 years ago

@HadrienGardeur right, but in this case (which is extremely special) the relative URL-s do signal what belongs to the WP, logically. Per W3C publication rules a spec must be, sort of, mostly self-contained when it comes to images, svg files, etc, and there are very few extra files (mostly W3C wide css files and logos) that are genuinely part of a formal document and are not relative to the index file. Ie, collecting those to be part of the 'bounds' of the WP for a W3C spec is the right choice.

For the general case, I agree with what you said, mainly related to Web Packaging. When I wrote the the script that can dump a W3C spec (based on respec) to EPUB, I had to do those rewriting:-(

mattgarrish commented 6 years ago

What happens when we go to publish with the publication link? Is it going to have to be manually stripped?

iherman commented 6 years ago

@mattgarrish: nop:-) That is what With w3c/echidna#596 and w3c/specberus#781 were all about: we got a special exception for wpub!

mattgarrish commented 6 years ago

Ah, I didn't read all the way back to the beginning... :)