Go Back   Smogon Community > Contributions & Corrections > Projects
Register FAQ Social Groups Calendar Search Today's Posts Mark Forums Read

Reply
Categories: HTML, Programming, Other
 
Thread Tools
Old Jan 29th, 2009, 4:23:42 PM   #1
chaos**
chaos
is a Tournament Directoris a Battle Server Administratoris a Programmeris a Smogon IRC SOpis a Pokémon Researcheris a Contributor to Smogonis an Administratoris a Site Staff Alumnus
 
chaos's Avatar
 
Administrator
Join Date: Dec 2004
Posts: 8,765
Default Translating Mako -> Genshi

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)
__________________
!gabite fierce: y'd u mute me??
!gabite fierce: eh bro??
!gabite fierce: u scared that i might bash u cuz u r not replying?
~chaos: you can't honestly think that is the reason lol
!gabite fierce: tell me the reason oh is it cuz of bolding the writing?
!gabite fierce: eh?
!gabite fierce: u scared again?

Last edited by chaos; Jan 30th, 2009 at 1:15:46 PM.
chaos is offline   Reply With Quote
Old Jan 29th, 2009, 4:24:14 PM   #2
chaos**
chaos
is a Tournament Directoris a Battle Server Administratoris a Programmeris a Smogon IRC SOpis a Pokémon Researcheris a Contributor to Smogonis an Administratoris a Site Staff Alumnus
 
chaos's Avatar
 
Administrator
Join Date: Dec 2004
Posts: 8,765
Default

If there are any questions, please post them here
__________________
!gabite fierce: y'd u mute me??
!gabite fierce: eh bro??
!gabite fierce: u scared that i might bash u cuz u r not replying?
~chaos: you can't honestly think that is the reason lol
!gabite fierce: tell me the reason oh is it cuz of bolding the writing?
!gabite fierce: eh?
!gabite fierce: u scared again?
chaos is offline   Reply With Quote
Old Jan 30th, 2009, 5:28:02 PM   #3
chaos**
chaos
is a Tournament Directoris a Battle Server Administratoris a Programmeris a Smogon IRC SOpis a Pokémon Researcheris a Contributor to Smogonis an Administratoris a Site Staff Alumnus
 
chaos's Avatar
 
Administrator
Join Date: Dec 2004
Posts: 8,765
Default

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.
__________________
!gabite fierce: y'd u mute me??
!gabite fierce: eh bro??
!gabite fierce: u scared that i might bash u cuz u r not replying?
~chaos: you can't honestly think that is the reason lol
!gabite fierce: tell me the reason oh is it cuz of bolding the writing?
!gabite fierce: eh?
!gabite fierce: u scared again?
chaos is offline   Reply With Quote
Old Jan 30th, 2009, 5:59:56 PM   #4
Mekkah**
pfbwowbfobwobwobfwowbf
is a Tutoris a member of the Smogon Site Staffis a Smogon IRC SOpis a Contributor to Smogon Mediais a Contributor to Smogonis an Administrator
 
Mekkah's Avatar
 
Administrator
Join Date: Feb 2005
Posts: 13,847
Most of them are good
Default

Quote:
Originally Posted by Fat chaos View Post
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.
ryu is leaving for another month or so due to exams
Mekkah is offline   Reply With Quote
Old Jan 31st, 2009, 12:08:12 AM   #5
ryubahamut
is a Programmer Alumnusis a Contributor Alumnus
 
ryubahamut's Avatar
 
Join Date: Jan 2007
Posts: 999
Default

sorry :< i did try looking up on IRC you were afk apparenrtly. i will see if i can do something atm
__________________
Code:
 * !!!!!!!IF YOU CHANGE TABS TO SPACES, YOU WILL BE KILLED!!!!!!!
 *       !!!!!!!!!!!!!!DOING SO FUCKS THE BUILD PROCESS!!!!!!!!!!!!!!!!
ryubahamut is offline   Reply With Quote
Old Feb 2nd, 2009, 1:15:27 AM   #6
Shiv
mostly harmless
is a Site Staff Alumnusis a Forum Moderator Alumnusis a Smogon IRC AOp Alumnusis a past World Cup of Pokemon champion
 
Shiv's Avatar
 
Join Date: Apr 2005
Posts: 5,820
Default

I hadn't noticed this thread (or forum for that matter). I'm up for doing this :)
Shiv is offline   Reply With Quote
Old Feb 8th, 2009, 5:40:27 PM   #7
Polis4rule
 
Polis4rule's Avatar
 
Join Date: Jun 2008
Posts: 1,101
Atlanta
Default

If you don't mind me asking, is this just simply taking the old coding and turning it into Genshi new coding?
Polis4rule is offline   Reply With Quote
Old Dec 26th, 2009, 9:43:28 AM   #8
GAK
 
GAK's Avatar
 
Join Date: Oct 2008
Posts: 1,359
Ubers Master
Default

I can assist in this project if you still need it done.
__________________
It's a love story, baby just say yes.
GAK is offline   Reply With Quote
Reply Smogon Community > Contributions & Corrections > Projects

« Previous Thread | Next Thread »
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 2:04:42 AM.