You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by je...@apache.org on 2002/12/26 15:11:49 UTC

cvs commit: xml-forrest/src/documentation/content/xdocs/community index.xml

jefft       2002/12/26 06:11:49

  Modified:    src/documentation/content/xdocs Tag: LINKMAP_BRANCH
                        index.xml
               src/documentation/content/xdocs/community Tag:
                        LINKMAP_BRANCH index.xml
  Added:       src/documentation/content/xdocs Tag: LINKMAP_BRANCH site.xml
  Log:
  Linkmap, and a few test modifications demonstrating the site: scheme
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.18.2.1  +6 -6      xml-forrest/src/documentation/content/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/documentation/content/xdocs/index.xml,v
  retrieving revision 1.18
  retrieving revision 1.18.2.1
  diff -u -r1.18 -r1.18.2.1
  --- index.xml	11 Dec 2002 11:20:59 -0000	1.18
  +++ index.xml	26 Dec 2002 14:11:49 -0000	1.18.2.1
  @@ -36,21 +36,21 @@
         <title>Project Status</title>
         <p>The Forrest project is new and needs your help.</p>
         <ul>
  -      <li>Read our <link href="primer.html">Forrest Primer</link> to
  +      <li>Read our <link href="site:primer">Forrest Primer</link> to
         understand what Forrest is and how you can use and contribute to it.</li>
  -      <li>Please see the <link href="faq.html">FAQ</link> and join the
  +      <li>Please see the <link href="site:faq">FAQ</link> and join the
         discussion on the forrest-dev&lt;at&gt;xml.apache.org
  -      <link href="mail-lists.html">mail list</link>.
  +      <link href="site:mail-lists">mail list</link>.
         </li>
  -      <li>Follow the <link href="your-project.html">Using Forrest</link>
  +      <li>Follow the <link href="site:your-project">Using Forrest</link>
          document to generate a website for your own project.
         </li>
  -      <li>There is also a fledgling <link href="dreams.html">Dream List</link>
  +      <li>There is also a fledgling <link href="site:dreams">Dream List</link>
         to help provide some direction.</li>
         <li>The 
          <link href="http://xml.apache.org/forrest/">Forrest website</link>
          is updated irregularly and manually, while we develop the
  -       <link href="forrestbot.html">forrestbot</link> facility.
  +       <link href="site:forrestbot">forrestbot</link> facility.
          <!--which produces
          the temporary
          <link href="http://www.outerthought.net/forrest/">automatically generated</link> site.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +0 -0      xml-forrest/src/documentation/content/xdocs/Attic/site.xml
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.4.1   +3 -3      xml-forrest/src/documentation/content/xdocs/community/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/documentation/content/xdocs/community/index.xml,v
  retrieving revision 1.2
  retrieving revision 1.2.4.1
  diff -u -r1.2 -r1.2.4.1
  --- index.xml	10 Nov 2002 00:27:35 -0000	1.2
  +++ index.xml	26 Dec 2002 14:11:49 -0000	1.2.4.1
  @@ -7,7 +7,7 @@
    <body>
     <section>
      <title>Introduction</title>
  -    <p>Forrest has certain <link href="../dreams.html">dreams</link> to
  +    <p>Forrest has certain <link href="site:dreams">dreams</link> to
       provide community resources for all Apache projects. Here are some
       that have become reality.
       </p>
  @@ -15,13 +15,13 @@
   
     <section>
      <title>Forrestbot - automated documentation building robot</title>
  -    <p>See <link href="../forrestbot.html">Forrestbot Introduction</link>.
  +    <p>See <link href="site:forrestbot">Forrestbot Introduction</link>.
       </p>
     </section>
   
     <section>
      <title>Your Project - plant the seed for a new documentation project</title>
  -    <p>See <link href="../your-project.html">Using Forrest</link>.
  +    <p>See <link href="site:your-project">Using Forrest</link>.
       </p>
     </section>
   
  
  
  

Linkmaps implemented

Posted by Jeff Turner <je...@apache.org>.
On Thu, Dec 26, 2002 at 02:11:49PM -0000, jefft@apache.org wrote:
>   Log:
>   Linkmap, and a few test modifications demonstrating the site: scheme
...  
>      <section>
>       <title>Forrestbot - automated documentation building robot</title>
>   -    <p>See <link href="../forrestbot.html">Forrestbot Introduction</link>.
>   +    <p>See <link href="site:forrestbot">Forrestbot Introduction</link>.
>        </p>
>      </section>

As you can see, linkmaps are working in the branch.  Compared to the
original linkmap RT:

http://marc.theaimsgroup.com/?l=forrest-dev&m=103444028129281&w=2

I've implemented the section labeled "2) Mapping nodes to rendered (HTML)
files".



Linkmap Implementation
----------------------

The implementation is fairly straightforward.  We start with a 'linkmap',
content/xdocs/site.xml:

<site href="" label="Forrest">
  <about label="About">
    <index label="Index" href="index.html"/>
    <download label="Download" href="http://www.apache.org/dyn/closer.cgi/xml/forrest/"/>
    <license label="License" href="license.html"/>
    ...
  </about>
  <documentation label="Documentation">
    <primer label="Forrest Primer" href="primer.html">
      <cvs href="#cvs"/>
    </primer>
    <forrest-contract label="Our Contract" href="forrest-contract.html"/>
    <forrestbot label="The Forrestbot" href="forrestbot.html"/>
    ...
  </documentation>
  ...
</site>


Each XML node represents an addressible unit of site information.  The
@href points to its Destination URI location.

When we encounter a link like <link href="site:forrestbot">, we first
convert it to a simpler URI, <link
href="linkmap:/site//forrestbot/@href">, with a SimpleMappingMetaModule
configured in sitemap.xmap as follows:

  <input-module name="site">
    <input-module name="linkmap" src="{src}" reloadable="true"/>
    <prefix>/site//</prefix>
    <suffix>/@href</suffix>
  </input-module>


Then the 'linkmap' InputModule uses the '/site//forrestbot/@href' part as
an XPath address into site.xml, and returns the @href.

A small complication is that the @href must be relative to the directory
of the file doing the linking.  Eg community/index.html must have
'../forrestbot.html'.  This is done through sitemap rules which generate
a 'relativized' linkmap:

   <map:match pattern="abs-linkmap">
     <map:generate src="content/xdocs/site.xml"/>
     <map:transform src="library/xslt/absolutize-linkmap.xsl"/>
     <map:serialize type="xml"/>
   </map:match>
   
   <map:match pattern="**linkmap">
     <map:generate src="cocoon:/abs-linkmap"/>
     <map:transform src="library/xslt/relativize-linkmap.xsl">
       <map:parameter name="path" value="{0}"/>
     </map:transform>
     <map:serialize type="xml"/>
   </map:match>

This relativized linkmap is then fed to the InputModule.


Auto-generated book.xml
-----------------------

While I was doing this, it occurred to me that book.xml files can be
generated from a single suitably hierarchical site.xml file.  I've
implemented this such that if a hand-edited book.xml is not present, then
it will be auto-generated from site.xml.  This means that most sites can
get away with the auto-generated menus, while still having the option to
use a hand-generated book.xml for 'unusual' directories.  The option of
being able to use a hand-created book.xml makes the system fully
backwards-compatible.

One particularly nice possibility of generating book.xml from site.xml,
is that we can generate different book.xml's based on site metadata, like
language, or file datestamp:

1) It should be pretty trivial to implement a switch to read site_de.xml,
site_fr.xml etc, instead of site.xml, and thereby generate multi-langauge
sites.
2) Imagine if site.xml entry had a timestamp next to it, indicating when
that page was last edited:

<site href="" label="Forrest">
  <about label="About">
    <index label="Index" href="index.html" timestamp="2002-12-27"/>
    <license label="License" href="license.html" timestamp="2002-03-02"/>
    <who label="Who we are" href="who.html" timestamp="2002-12-02/>
    <dreams label="Dream list" href="dreams.html" timestamp="2002-07-01"/>
  </about>
</site>

We could then auto-generate a book.xml containing only pages edited, say,
within the last month.  Or we could implement an auto-expiry policy, to
eliminate docs over a year old.

There are lots of interesting possibilities here.  Eg, a
audience="{user,developer}" attribute could be used to implement 'views'
of a site for different user groups, @access to implement access control,
etc.  Useful stuff for implementing a CMS-like system.  In fact the
general idea comes from Robert Koberg's LiveStoryBoard CMS's site.xml
file, which is swimming in metadata (@status, @printer_friendly, lots of
presentation stuff).


All suggestions on this stuff welcome.  I thought I'd leave it in the
branch for a few days to get general feedback, and then if everyone seems
happy, move to CVS HEAD.


--Jeff