Starting in Xierpa
A simple page
Xierpa run Python scripts as page application. A simple example of such page can be seen below:
# -*- coding: UTF-8 -*-
from xpyth.xierpa.builders.xierpabuilder import XierpaBuilder
class Home(XierpaBuilder):
def build(self):
self.doctype('xhtml-transitional')
self.html()
self.head()
self.title()
self.text('Title of "Hello world" page')
self._title()
self._head()
self.body()
self.text('Hello world')
self._body()
self._html()
Home(e, result).build()
This simple page shows in the browser as follows:
(click on the image to see the page in the browser)
What the Xierpa code lines do
# -*- coding: UTF-8 -*-
from xpyth.xierpa.builders.xierpabuilder import XierpaBuilder
class Home(XierpaBuilder):
The we define an additional methods (=tags) for the Home class: build.
def build(self):
self.doctype('xhtml-transitional')
self.html()
self.head()
self.title()
self.text('Title of "Hello world" page')
self._title()
self._head()
self.body()
self.text('Hello world')
self._body()
self._html()
self.doctype('xhtml-transitional')
self.html() ... self._html()
self.head() ... self._head()
self.title()
self.text('Title of "Hello world" page')
self._title()
self.body() ... self._body()
Finally the text tag displays the only text line of this page.
self.text('Hello world')
