Core-Gadget - Content-Rewriting

This is a DRAFT

  <section title="Content Rewriting Feature">
    <t>The Content Rewriting Feature defines a set of content 
    modification operations that a container can perform when 
    processing HTML and Proxied Content and defines rules that
    allow developers to control which content the rewriter can
    operate on.</t>

    <t>The Content Rewriting Feature is specified within the &lt;ModulePrefs&gt;
    with the feature name "content-rewrite" using either the &lt;Optional&gt;
    or &lt;Require&gt; element. Multiple &lt;Param&gt; elements are used to 
    specify specific configuration options for the feature. 
    Containers MAY support the Content Rewriting Feature.</t>

    <figure>
      <preamble>For example:</preamble>
      <artwork xml:space="preserve">
&lt;Optional feature="content-rewrite"&gt;
    &lt;Param name="expires"&gt;86400&lt;/Param&gt;
    &lt;Param name="include-url"&gt;&lt;/Param&gt;
    &lt;Param name="exclude-url"&gt;excluded&lt;/Param&gt;
    &lt;Param name="exclude-url"&gt;moreexcluded&lt;/Param&gt;
    &lt;Param name="minify-css"&gt;true&lt;/Param&gt;
    &lt;Param name="minify-js"&gt;true&lt;/Param&gt;
    &lt;Param name="minify-html"&gt;true&lt;/Param&gt;
&lt;/Optional&gt;
</artwork>
     </figure>

     <t>The parameters supported by the "content-rewrite" feature are:

     <list type="hanging">
      <t hangText="expires">The duration in seconds to force as minimum HTTP 
      cache time for content fetched through the proxy via a rewritten URL. 
      The default is 86400 seconds.</t>
      <t hangText="include-url">Any URL which contains this parameters value as a
      case-insensitive substring is considered rewriteable. The literal string
      "*" is a special case and implies all URLs. If not specified an entry
      with the value "*" is assumed. This parameter MAY appear multiple times
      within the &lt;Optional&gt; or &lt;Require&lt; tags.</t>
      <t hangText="exclude-url">Any URL which contains this parameters value as a
      case-insensitive substring is excluded from rewriting. The literal string
      "*" implies all URLs and effectively disables all rewriting. This parameter 
      MAY appear multiple times within the &lt;Optional&gt; or &lt;Require&lt; tags.</t>
      <t hangText="minify-css">Controls whether the container can attempt to 
      minify css in style tags and referenced css files. Valid values are 
      "true"|"false". Default is "true".</t>
      <t hangText="minify-js">Controls whether the container can attempt to 
      minify JS in script tags and referenced JS files. Valid values are "true"
      and "false". Default is "true".</t>
      <t hangText="minify-html">Controls whether the container can attempt to minify
      HTML content. Valid values are "true" and "false". Default is "true".</t>
     </list></t>

     <t>When values for both the "exclude-url" and "include-url" are specified,
     Matches for "exclude-url" take precedence over matches for "include-url".</t>

     <t>Note that the special use of "*" to denote all URLs should not be
     interpreted as support for GLOB or RegEx matching on strings.</t>

     <t>Containers are free to perform additional optimizations when rewriting
     links including but not limited to:

     <list type="symbols">
      <t>Extracting @import directives from style tags and converting them into 
      link tags in the head tag of the containing HTML content.</t>
      <t>Merging multiple CSS fetches from successive link tags into one link tag
      that causes the proxy to concatenate the content fetched from the
      individual URLs.</t>
      <t>Merging contiguous &lt;script src=xxx&gt; tags into one concatenating
      proxy fetch.</t>
     </list></t>

     <t>TODO: Need useful examples.. the ones currently in the spec aren't helpful.</t>
   </section>

   <!-- END CONTENT REWRITING -->