W3C home > Mailing lists > Public > spec-prod@w3.org > April to June 2010

Re: ReSpec 2 repository is up

From: Gregg Kellogg <gregg@kellogg-assoc.com>
Date: Wed, 5 May 2010 11:06:37 -0400
To: Robin Berjon <robin@berjon.com>
CC: Spec Prod <spec-prod@w3.org>
Message-ID: <30D899DF-73C2-437F-B4CC-AF776EED0556@kellogg-assoc.com>
On May 5, 2010, at 3:39 AM, Robin Berjon wrote:

On May 4, 2010, at 17:52 , Gregg Kellogg wrote:
I actually took a copy of it from CVS last week to evaluate for use in creating the Connected Media Experience (http://connectedmediaexperience.org) specs.

Heh, I didn't know anyone knew that the code was already in there :)

It proved to be fairly easy to work with.

I'm glad to hear that you could use it easily. Note though that I wouldn't recommend using it right now, even though the syntax of the content will be 100% compatible with v1, the code is still in flux and may break randomly!

I do expect to have to re-sync to keep up-to-date, but that's the beauty of this system, that the document contains a single reference to the ReSpec library. I haven't tested the ability to have my own plugins be remote; right now, it  just works off of a copy of the library directory layout. It's certainly in good enough shape for us to begin work creating docs with.


It does (did) seem to be missing the Ctrl+Shift+Alt+S save functionality, which I presume will come eventually.

Yup, since it wasn't functional at a level that I could use I hadn't ported over the saving console. But since you mentioned it and it wasn't much work... it's now in the latest hg.

Thanks.


I just implemented my own version of headers.js, style.js and created a cme-headers.html.

If it's stuff you can show, I'd be curious to see what you did. Also, note that I don't know when you took your snapshot, but I changed the templating engine from Simplate to the JS version of Template Toolkit.

It was still the Simplate version.

Don't have them online to view right now, but I added the to the bottom of this email. Note that cme-headers.html and headers.js just a minimal change from W3C right now; our document process is pretty different. For example, we haven't yet defined when the equivalent of FPWD happens.


--
Robin Berjon - http://berjon.com/


Gregg Kellogg
http://kellogg-assoc.com

cme-headers.html
<!--
  XXX
    - we will have problems with white space, see as we go
 -->
<script type='application/x-simplate' id='cme-headers'><![CDATA[
  <div class='bug'>CME [%= specStatusText %]</div>
  <div class='head'>
    <p>
    [% if (specStatus != "unofficial") { %]
      <a href='http://www.connectedmediaexperience.org/'><img width='434' height='53' src='http://connectedmediaexperience.org/images/imgmediaexp.jpg' alt='CME'/></a>
    [% } %]
    </p>
    <h1 class='title' id='title'>[%= title %]</h1>
    [% if (subtitle) { %]
      <h2 id='subtitle'>[%= subtitle %]</h2>
    [% } %]
    <h2>[%= specStatus === "unofficial" ? "" : "CME " %][%= specStatusText %] [%= publishHumanDate %]</h2>
    <dl>
      [% if (!isNoTrack) { %]
        <dt>This Version:</dt><dd>[%= CALL('link-uri', {uri: thisVersion}) %]</dd>
        <dt>Latest Published Version:</dt><dd>[%= CALL('link-uri', {uri: latestVersion}) %]</dd>
        [% if (edDraftURI) { %]
          <dt>Latest Editor&apos;s Draft:</dt><dd>[%= CALL('link-uri', {uri: edDraftURI}) %]</dd>
        [% }
      }
      if (specStatus != 'FPWD' && specStatus != 'ED' && !isNoTrack) {
        if (!prevED) { %]
          <dt>Previous version:</dt><dd>[%= CALL('link-uri', {uri: prevVersion}) %]</dd>
        [% }
        else { %]
          <dt>Previous editor&apos;s draft:</dt><dd>[%= CALL('link-uri', {uri: prevED}) %]</dd>
        [% }
      }
      if (prevRecShortname) { %]
        <dt>Latest Recommendation:</dt><dd>[%= CALL('link-uri', {uri: prevRecURI}) %]</dd>
      [% } %]
      [%= CALL('show-people', {name: 'Editor', people: editors}) %]
      [%= CALL('show-people', {name: 'Author', people: authors}) %]
    </dl>
    [% if (errata) { %]
      <p>Please refer to the <a href='[%= errata %]'>errata</a> for this document, which may include
      some normative corrections.</p>
    [% } %]
    [%= CALL('alternate-formats', {formats: alternateFormats}) %]
    [% if (specStatus === "REC") { %]
      <p>The English version of this specification is the only normative version. Non-normative
      <a href='http://www.connectedmediaexperience.org/Consortium/Translation/'>translations</a> may also be available.</p>
    [% } %]
    <p class='copyright'>
    [% if (specStatus === "unofficial") { %]
      [% if (additionalCopyrightHolders) { %]
        [%= additionalCopyrightHolders %]
      [% } else { %]
        This document is licensed under a <a class='subfoot' href='http://creativecommons.org/licenses/by/3.0/' rel='license'>Creative
        Commons Attribution 3.0 License</a>.
      [% }
    } else { %]
      <a href='http://connectedmediaexperience.com/IPR_Policy.pdf'>Copyright</a> &copy;
      [% if (copyrightStart) { %][%= copyrightStart %]-[% } %][%= publishYear %]
      [% if (additionalCopyrightHolders) { %] [%= additionalCopyrightHolders %] &amp;[% } %]
      <a href='http://www.connectedmediaexperience.org/'><acronym title='Connected Media Experience'>CME</acronym></a>, All Rights Reserved.
    [% } %]
    </p><hr/></div>
]]></script>

<script type='application/x-simplate' id='link-uri'><a href='[%= uri %]'>[%= uri %]</a></script>

<script type='application/x-simplate' id='show-people'>
  [% if (people.length == 0) return ''; %]
  <dt>[%= name %][% if (people.length > 1) { %]s[% } %]:</dt>
  [% for (var i = 0, n = people.length; i < n; i++) { var person = people[i]; %]
      [%= CALL('show-person', person) %]
  [% } %]
</script>

<script type='application/x-simplate' id='show-person'>
  <dd>
    [% if (url) { %]<a href='[%= url %]'>[%= name %]</a>[% } else { %][%= name %][%}
    %][% if (company) { %], [% if (companyURL) { %]<a href='[%= companyURL %]'>[%= company %]</a>[% } else { %][%= company %][%}%][%}
    %][% if (mailto) { %] <a href='mailto:[%= mailto %]'>[%= mailto %]</a>[%}
    %][% if (note) { %] ([%= note %])[%}%]
  </dd>
</script>

<script type='application/x-simplate' id='alternate-formats'>
  [% if (!formats || formats.length == 0) return ''; %]
  <p>
    This document is also available in [%= formats.length == 1 ? "this" : "these" %] non-normative
    format[% if (formats.length > 1) { %]s[% } %]:
    [% for (var i = 0, n = formats.length; i < n; i++) { var fmt = formats[i]; %]
      [% if (i > 0) {%][% if (n == 2) {%] [%} else {%], [%}%][% if (i == n-1) {%]and [%}%][%}%]
      <a href='[%= fmt.uri %]'>[%= fmt.label %]</a>
    [% } %]
  .</p>
</script>

<script type='application/x-simplate' id='cme-sotd'><![CDATA[
  [% if (specStatus === "unofficial") { %]
    <section id='sotd' class='introductory'><h2>Status of This Document</h2>
    <p>This document is merely a working draft of a potential specification. It has
    no official standing of any kind and does not represent the support or consensus of any
    standards organisation.</p></section>
  [% } else if (isNoTrack) { %]
    [% var mc = specStatus === "MO" ? "member-confidential " : ""; %]
    <section id='sotd' class='introductory'><h2>Status of This Document</h2>
    <p>This document is merely a CME-internal[%= mc %] document. It has no
    official standing of any kind and does not represent consensus of the CME Membership.</p></section>
  [% } else { %]
    [% var art = (specStatus == "ED" || specStatus == "XGR" || specStatus == "IG-NOTE") ? "an" : "a"; %]
    <section id='sotd' class='introductory'>
      <h2>Status of This Document</h2>
      <p><em>This section describes the status of this document at the time of its publication. Other
      documents may supersede this document.</p>
      [% if (custom) { %][%= custom %][% } %]
      <p>
        This document was published by the <a href='[%= wgURI %]'>[%= wg %]</a> as [%= art %]
        [%= longStatus %].
        [% if (isRecTrack && specStatus != "REC") { %] This document is intended to become a CME Recommendation.[% } %]
        [% if (wgPublicList) {%]
        If you wish to make comments regarding this document, please send them to
        <a href='mailto:[%= wgPublicList %]@connectedmediaexperience.org'>[%= wgPublicList %]@connectedmediaexperience.org</a>
        (<a href='mailto:[%= wgPublicList %]-request@connectedmediaexperience.org?subject=subscribe'>subscribe</a>,
        <a href='http://lists.connectedmediaexperience.org/Archives/Public/[%= wgPublicList %]/'>archives</a>).
        [% } %]
        [% if (specStatus === "LC") { %]The Last Call period ends [%= humanLCEnd %].[% } %]
        [% if (specStatus === "CR") { %]
          CME publishes a Candidate Recommendation to indicate that the document is believed to be stable and
          to encourage implementation by the developer community. This Candidate Recommendation is expected to
          advance to Proposed Recommendation on [%= humanCREnd %].
        [% } %]
        [% if (wgPublicList) {%] All feedback is welcome. [% } %]
      </p>
      [% if (specStatus != "REC") { %]
        <p>
          Publication as a [%= longStatus %] does not imply endorsement by the CME Membership. This is a draft
          document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate
          to cite this document as other than work in progress.
        </p>
      [% } %]
      [% if (specStatus == "LC") { %]
        <p>
          This is a Last Call Working Draft and thus the Working Group has determined that this document has satisfied the
          relevant technical requirements and is sufficiently stable to advance through the Technical Recommendation process.
        </p>
      [% } %]
      <p>
        This document was produced by a group operating under the
        <a href='http://connectedmediaexperience.com/IPR_Policy.pdf'>CME Patent Policy</a>.
        [% if (!isRecTrack && maturity == "WD") { %]The group does not expect this document to become a CME Recommendation.[% } %]
      </p>
    </section>
  [% } %]
]]></script>

<script type='application/x-simplate' id='cme-conformance'><![CDATA[
  <p>
    As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
    and notes in this specification are non-normative. Everything else in this specification is
    normative.
  </p>
  <p>
    The key words MUST, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, RECOMMENDED, MAY,
    and OPTIONAL in this specification are to be interpreted as described in [[!RFC2119]].
  </p>
]]></script>

headers.js

// XXX untested
// XXX also handle abstract and sotd here, it's the same logical unit (especially for configuration)
// @@ configuratoin
//  - lots of configuration to list...
require.def(
    "cme/headers",
    ["core/simplate", "core/utils"],
    function (simplate, utils) {
        return {
            status2text: {
                NOTE:           "Note",
                "WG-NOTE":      "Working Group Note",
                "CG-NOTE":      "Co-ordination Group Note",
                "IG-NOTE":      "Interest Group Note",
                "Member-SUBM":  "Member Submission",
                "Team-SUBM":    "Team Submission",
                XGR:            "Incubator Group Report",
                MO:             "Member-Only Document",
                ED:             "Editor's Draft",
                FPWD:           "Working Draft",
                WD:             "Working Draft",
                "FPWD-NOTE":    "Working Draft",
                "WD-NOTE":      "Working Draft",
                "LC-NOTE":      "Working Draft",
                LC:             "Working Draft",
                CR:             "Candidate Recommendation",
                PR:             "Proposed Recommendation",
                PER:            "Proposed Edited Recommendation",
                REC:            "Recommendation",
                RSCND:          "Rescinded Recommendation",
                unofficial:     "Unofficial Draft",
                base:           "Document"
            },
            status2maturity: {
                FPWD:       "WD",
                LC:         "WD",
                "FPWD-NOTE":"WD",
                "WD-NOTE":  "WD",
                "LC-NOTE":  "LC",
                "WG-NOTE":  "NOTE"
            },
            status2long:    {
                FPWD:           "First Public Working Draft",
                "FPWD-NOTE":    "First Public Working Draft",
                LC:             "Last Call Working Draft",
                "LC-NOTE":      "Last Call Working Draft"
            },
            recTrackStatus: ["FPWD", "WD", "LC", "CR", "PR", "PER", "REC"],
            noTrackStatus:  ["MO", "unofficial", "base"],

            run:    function (conf, doc, cb) {
                progress("adding document headers");

                for (var k in this.status2text) {
                    if (this.status2long[k]) continue;
                    this.status2long[k] = this.status2text[k];
                }

                // --- CONFIGURATION PROCESSING
                if (!conf.specStatus) error("Missing required configuration: specStatus");
                conf.specStatusText = this.status2text[conf.specStatus];
                conf.title = doc.title ? doc.title : "No Title";
                if (!conf.subtitle) conf.subtitle = "";
                if (!conf.publishDate) {
                    conf.publishDate = utils.parseLastModified(doc.lastModified);
                    // the above is experimental, use this if it fails:
                    // conf.publishDate = new Date();
                }
                else {
                    if (!conf.publishDate instanceof Date) conf.publishDate = utils.parseSimpleDate(conf.publishDate);
                }
                conf.publishYear = conf.publishDate.getFullYear();
                conf.publishHumanDate = utils.humanDate(conf.publishDate);
                if (!conf.shortName) error("Missing required configuration: shortName");
                if (!conf.edDraftURI) {
                    conf.edDraftURI = null;
                    if (conf.specStatus === "ED") warn("Editor's Drafts should set edDraftURI.");
                }
                conf.maturity = (this.status2maturity[conf.specStatus]) ? this.status2maturity[conf.specStatus] : conf.specStatus;
                // Must define conf.docNumber to indicate Kavi document number for generating URL
                if (!conf.docNumber) {
                    conf.docNumber = "0";
                    warn("Kavi document number must be set.");
                }
                var docUrl = "http://members.connectedmediaexperience.org/apps/org/workgroup/cme-twg/download.php/" + conf.docNumber + "/";
                conf.thisVersion = docUrl + conf.maturity + "-" + conf.shortName + "-" + utils.concatDate(conf.publishDate) + "/";
                conf.latestVersion = docUrl + conf.maturity + "-" + conf.shortName + "/latest";
                if (conf.previousPublishDate) {
                    if (!conf.previousMaturity) error("previousPublishDate is set, but not previousMaturity");
                    if (!(conf.previousPublishDate instanceof Date))
                        conf.previousPublishDate = utils.parseSimpleDate(conf.previousPublishDate);
                    var pmat = (this.status2maturity[conf.previousMaturity]) ? this.status2maturity[conf.previousMaturity] :
                                                                               conf.previousMaturity;
                    conf.prevVersion = docUrl + pmat + "-" +
                                       conf.shortName + "-" + utils.concatDate(conf.previousPublishDate) + "/";
                }
                else {
                    if (conf.specStatus != "FPWD" && conf.specStatus != "ED" && conf.specStatus != "MO" && !conf.isNoTrack)
                        error("Document on track but no previous version.");
                    conf.prevVersion = null;
                }
                conf.isRecTrack = $.inArray(conf.specStatus, this.recTrackStatus) >= 0;
                conf.isNoTrack = $.inArray(conf.specStatus, this.noTrackStatus) >= 0;
                if (!conf.prevED) conf.prevED = null;
                if (!conf.prevRecShortname) conf.prevRecShortname = null;
                if (!conf.prevRecURI) conf.prevRecURI = null;
                if (!conf.editors || conf.editors.length === 0) error("At least one editor is required");
                if (!conf.authors) conf.authors = [];
                var peopCheck = function (i, it) {
                    if (!it.name) error("All authors and editors must have a name.");
                    if (!it.uri) it.uri = "";
                    if (!it.company) it.company = "";
                    if (!it.companyURL) it.companyURL = "";
                    if (!it.mailto) it.mailto = "";
                    if (!it.note) it.note = "";
                };
                $.each(conf.editors, peopCheck);
                $.each(conf.authors, peopCheck);
                if (!conf.errata) conf.errata = null;
                if (!conf.alternateFormats) conf.alternateFormats = null;
                else {
                    $.each(conf.alternateFormats, function (i, it) {
                        if (!it.uri || !it.label) error("All alternate formats must have a uri and a label.");
                    });
                }
                if (!conf.additionalCopyrightHolders) conf.additionalCopyrightHolders = null;
                if (!conf.copyrightStart) conf.copyrightStart = null;

                var $sotd = $("#sotd");
                if ($sotd) {
                    conf.custom = $sotd.html();
                    $sotd.remove();
                }
                else {
                    if (conf.isRecTrack) {
                        warn("Rec-track documents should have a custom SotD paragraph.")
                        conf.custom = "";
                    }
                    else {
                        conf.custom = null;
                    }
                }
                if (conf.specStatus != "unofficial" && !conf.isNoTrack) {
                    if (!conf.wgURI || !conf.wg || !conf.wgPatentURI)
                        error("All of the following must be configured: wgURI, wg, wgPatentURI");
                }
                if (conf.specStatus === "LC") {
                    if (!conf.lcEnd) error("LC drafts must have lcEnd set.");
                    conf.humanLCEnd = utils.humanDate(conf.lcEnd);
                }
                if (conf.specStatus === "CR") {
                    if (!conf.crEnd) error("CR drafts must have crEnd set.");
                    conf.humanCREnd = utils.humanDate(conf.crEnd);
                }
                conf.longStatus = this.status2long[conf.specStatus];
                progress("headers configuration done");

                // --- RUN THE TEMPLATES
                simplate.loadRemote(conf.respecBase + "js/templates/cme-headers.html", doc, function () {
                    progress("running simplate for headers");
                    // headers
                    $("body", doc).prepend($(simplate.exec("cme-headers", conf)));

                    // abstract
                    progress("handling abstract");
                    var $abs = $("#abstract");
                    if (!$abs) error("Document must have one element with ID 'abstract'");
                    $abs.prepend("<h2>Abstract</h2>");
                    $abs.addClass("introductory");

                    // SotD
                    progress("running simplate for sotd");
                    $abs.after($(simplate.exec("cme-sotd", conf)));

                    // conformance
                    progress("handling conformance");
                    var $confo = $("#conformance");
                    if ($confo) {
                        $confo.prepend($(simplate.exec("cme-conformance", conf)));
                        $confo.prepend("<h2>Conformance</h2>");
                    }

                    progress("done adding document headers");
                    cb();
                });
            },
        };
    }
);

style.js

// XXX untested
// @@ CONFIG
//      - specStatus
require.def(
    "cme/style",
    ["core/utils"],
    function (utils) {
        return {
            run:    function (conf, doc, cb) {
                progress("inserting CME CSS");
                if (!conf.specStatus) error("Configuration specStatus is not set, required for cme/style");
                var statStyle = conf.specStatus;
                if (statStyle == "FPWD" || statStyle == "LC") statStyle = "WD";
                var css;
                if (statStyle == "unofficial") {
                    css = "../stylesheets/cme-unofficial.css";
                }
                else if (statStyle == "base") {
                    css = "../stylesheets/cme.css";
                }
                else {
                    css = "../stylesheets/cme-" + statStyle + ".css";
                }
                utils.linkCSS(doc, css);
                cb();
            },
            ieDummy: 1
        };
    }
);
Received on Wednesday, 5 May 2010 15:09:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:19:17 GMT