Programming Translating Mako -> Genshi

chaos

is a Site Content Manageris a Battle Simulator Administratoris a Programmeris a Smogon Discord Contributoris a Contributor to Smogonis an Administratoris a Tournament Director Alumnusis a Researcher Alumnus
Owner
Volunteers needed! Code is in /branches/genshi.

www.makotemplates.org
http://genshi.edgewall.org/

Here's a template for regular pages in a section:

Code:
<html xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      py:strip="True">
      
      <py:match path="title" once="True">
          <title>Big Misty</title>
      </py:match>
      
      <py:match path="breadcrumbs" once="True">
          <breadcrumbs><a>This Page</a></breadcrumb>
      </py:match>
      
      <py:match path="content" once="True">
      <content>
          <p>The girth of the Misty is de big Misty</p>
          ...
      </content>
      </py:match>
      
      <xi:include href="base.html" />
</html>
Note: Not every page needs breadcrumbs. For instance, the index page should not have a breadcrumb.

----------

"Base" files in a section (like scms/base.html) need some special attention. They extend the main base template (in /base.html, which extends /raw.html). Here is an example:

Code:
<html xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      py:strip="True">
            
      <py:match path="title" once="True">
          <title>${select("text()"}} - SCMS</title>
      </py:match>
      
      <py:match path="head" once="True">
          <head>
              ... any css you need here ...
              ${select("*")}
          </head>
      </py:match>
      
      <py:match path="breadcrumbs" once="True">
          <breadcrumbs><a href="/scms/">SCMS</a> ${select("*")}</breadcrumbs>
      </py:match>
      
      <py:match path="content" once="True">
      <nav>
      <navbody section="SCMS">
          <a href="/scms/link1">Link1</a>
          <a href="/scms/link2">Link2</a>
          <a href="/scms/link3">Link3</a>
      </navbody>
      <content />
      </nav>
      </py:match>
      
      <xi:include href="base.html" />
</html>
(Note: I have a Genshi transformation filter that will remove the <a> on the current link and replace it with <strong>, and everything in the navbody will be listified. Don't worry about any of that! The whole purpose of switching template systems is to make our lives easier.)

(Note2: Not every base adds "- Section" to the output. If it doesn't currently, don't add the code)
 

chaos

is a Site Content Manageris a Battle Simulator Administratoris a Programmeris a Smogon Discord Contributoris a Contributor to Smogonis an Administratoris a Tournament Director Alumnusis a Researcher Alumnus
Owner
It'd be nice to get some volunteers. Shiv and ryu told me they'd be up for it but neither have posted in this thread.
 

Shiv

mostly harmless
is a Site Content Manager Alumnusis a Programmer Alumnusis a Forum Moderator Alumnusis a Smogon Discord Contributor Alumnusis a Battle Simulator Moderator Alumnusis a Two-Time Past WCoP Champion
I hadn't noticed this thread (or forum for that matter). I'm up for doing this :)
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top