On Jul 9, 2011, at 3:40 AM, Raphael Bircher wrote:

> Hi at all
> 
> Is there any possibility to put head information in a markdown file. At the 
> OpenOffice.org Kenai infrastrukture sam head info are phrased into the final 
> website. (mainly CSS and JavaScript)
> 
> Atm. I see any possibility to do the same with markdown. If we have no 
> possibility in this case, we have to write much more different templates. Ok, 
> this is also the chance to eliminate souveral ugly hacks who works around the 
> kenai Infra. But in same case it would be good to have the possiblity to put 
> header informations in the mdtext files directly.

Here is a quick overview of how mdtext is converted to html by the Apache CMS.

See ooo/site/trunk/templates/skeleton.html, ooo/site/trunk/lib/view.pm, and  
ooo/site/trunk/lib/path.pm

path.pm has the pattern matching for mdtext. We can add other patterns like 
dita.

our @patterns = (
        [qr!\.mdtext$!, single_narrative => { template => 
"single_narrative.html" }],
) ;

view.pm has functions for converting and wrapping pages. There are several 
functions, we currently only use single_narrative.

Other examples include:

news_page - used on http://www.apache.org/index.html - among other examples 
this chooses three random projects from a set of apache project doap files.

sitemap - this collects the names of the mdtext files in a directory and makes 
a sorted list.

export - this does an xslt transform on a xml table - in this case for eccn - 
cryptography export information in www.apache.org

sort_tables - a routine that Joe added that sorts mdtext table markup - see our 
people.mdtext

It is worth looking at pages in http://www.apache.org/ for various examples. 
Here is index.html

{% extends "skeleton.html" %}

{% block title %}Welcome to The Apache Software Foundation!{% endblock %}
{% block tagline %}{{ tagline.content }}{% endblock %}
{% block content %}
    <div id="intro" class="grid_16">
      <div class="grid_5">
        {{ top_left.content|markdown }}
      </div>
      <div class="grid_5">
        {{ top_center.content|markdown }}
      </div>
      <div class="grid_5">
        {{ top_right.content|markdown }}
      </div>
    </div>
    <div class="clear"></div>
  </div>
  <div id="content" class="container_16">
    <div id="featured_switcher" class="grid_16">
      <ul>
        <li id="label">Featured Projects &raquo;</li>
                                {% for e in projects %}
        <li id='switcher_{% cycle "1" "2" "3" %}'><a href="{{ e.url }}"
                                title="Learn more about {{ e.name }}">{{ e.name
                                }} </a></li>
                                {% endfor %}
      </ul>
                </div>
    <div id="featured_intro" class="grid_16">
      <div class="grid_6">
        {{ project_info.content|markdown }}
      </div>
            <div id="featured_projs" class="grid_10">
      <ul>
                                {% for e in projects %}
        <li id='feature_{% cycle "1" "2" "3" %}'>
          <h4><a href="{{ e.url }}">{{ e.name }}</a></h4>
                                        <p>{{ e.shortdesc }}</p>
          <p class="description">{{ e.description|truncatewords:100
                                        }}</p>
        </li>
                                {% endfor %}
      </ul>
      </div>
    </div>
    <div class="clear"></div>
  </div>
  <div class="clear"></div>
  <div id="news" class="container_16">
    <div id="news_feed" class="grid_9 suffix_1">
      <h3>Latest News</h3>
      <p><em>If you would like to keep up with news and
      announcements from the foundation and all its projects,
      you can subscribe to the <a
      href="foundation/mailinglists.html#foundation-announce">Apache
      Announcements List</a> or follow the <a
      href="http://blogs.apache.org/foundation/";>Foundation Blog</a></em>.</p>
                   {% for e in blog.list %}
                         <h4><a href="{{ e.url }}">{{ e.title }}</a></h4>
                         <div class="section-content">{{ 
e.content|safe|truncatewords_html:50 }}</div>
                         <hr>
                         {% endfor %}
                   {% for e in announce.list %}
                         <h4><a href="{{ e.url }}">{{ e.title }}</a></h4>
                         <div class="section-content">{{ 
e.content|safe|truncatewords_html:50 }}</div>
                         <hr>
                         {% endfor %}
    </div>
    <div id="latest_activity" class="grid_5">

      <h3>Latest Activity</h3>
      <div class="section-content">
        <p><em>This is an overview of activity going on with our projects. SVN 
commits, bug reports, tweets, you name it</em>.</p>
      </div>

                         {% for e in twitter.list %}
                         <div class="section-content">
                         <a href="{{ e.url }}">@</a>{{ e.title|safe }}
                         </div>
                         {% endfor %}

                        {% for e in svn.list %}
                        <div class="section-content">
                        <a class="svn" 
href="http://svn.apache.org/viewvc?revision={{ e.revision }};view=revision">r{{ 
e.revision }}</a>
                          {{ e.message|safe|truncatewords_html:20 }} ({{
                          e.projects|safe }}) &mdash;
                          <a 
href="http://people.apache.org/committer-index.html#{{ e.author }}">{{ e.author 
}}</a>
                        </div>
                        {% endfor %}

                         {% for e in jira.list %}
                         <div class="section-content">
                         <a class="bug" href="{{ e.url }}">{{ e.title|safe 
}}</a><br/>
                         {{ e.content|safe|truncatewords_html:20 }}
                         </div>
                         {% endfor %}

    </div>
    <div class="clear"></div>
{% endblock %}
{% block footer %}
    <div id="impact" class="grid_6">
                        <h4>The Apache Blogs</h4>
                        {% for e in planet.list %}
                        <div><h5><a class="entryTitle" href="{{ e.url }}">{{ 
e.title }}</a></h5>
                         <p>{{ e.content|safe|truncatewords_html:30 }}</p>
                        </div>
                        <hr><br />
                        {% endfor %}

      <div>
        <h5><a href="http://blogs.apache.org"; title="Read More from the 
blogs">Read More &raquo;</a></h5>
      </div>
           </div>
    </div>
    <div class="clear"></div>
{% endblock %}

These blocks are inserted into 
https://svn.apache.org/viewvc/infrastructure/site/trunk/templates/skeleton.html?view=markup

Regards,
Dave

> 
> Greetings Raphael
> -- 
> My private Homepage: http://www.raphaelbircher.ch/

Reply via email to