diff --git a/Scripts/CentOS-Web/Apps/Home/__init__.py b/Scripts/CentOS-Web/Apps/Home/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Scripts/CentOS-Web/Apps/Home/__init__.py
diff --git a/Scripts/CentOS-Web/Apps/Home/page.py b/Scripts/CentOS-Web/Apps/Home/page.py
new file mode 100755
index 0000000..f703e1c
--- /dev/null
+++ b/Scripts/CentOS-Web/Apps/Home/page.py
@@ -0,0 +1,124 @@
+#!/usr/bin/python
+#
+# Apps.Home.page -- This module intantiates Apps.xhtml module to
+# create the xhtml output of home web applications.
+#
+# Copyright (C) 2009, 2010, 2011 The CentOS Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# ----------------------------------------------------------------------
+# $Id$
+# ----------------------------------------------------------------------
+
+from Apps import page
+
+app = page.Layout()
+
+def page_ads_release():
+ """Returns last-release advertisements."""
+ image = 'last-release.png'
+ return app.ads_release(image)
+
+
+def page_navibar_tabs():
+ """Returns application's main pages.
+
+ The application's main pages are organized as tabs in the
+ application navigation bar. There is one tab for each main page
+ inside the application.
+
+ """
+ names = ['Erratas', 'Articles', 'Events']
+ attrs = []
+
+ for i in names:
+ attrs.append({'href': '/centos-web/?p=' + i.lower()})
+
+ if 'p' in app.qs.keys():
+ focus = app.qs['p'][0]
+ else:
+ focus = names[0]
+
+ return app.navibar_app(names, attrs, focus)
+
+
+def page_content():
+ """Returns page content.
+
+ The page content to show is determined from the query string,
+ specifically from the value of `p' variable.
+
+ """
+ if 'p' in app.qs.keys():
+ p = app.qs['p'][0].lower()
+ else:
+ p = 'erratas'
+
+ if p == 'erratas':
+ output = app.tag_h1({'class': 'title'}, [12, 1], 'Erratas' )
+ output += app.tag_p({}, [12, 1], 'This is a paragraph. '*30 )
+ output += app.tag_p({}, [12, 1], 'This is a paragraph in the sense of improvement. '*30 )
+ output += app.tag_h2({'class': 'title'}, [12, 1], 'For A Better OS' )
+ output += app.tag_p({}, [12, 1], 'This is a paragraph. '*30 )
+ output += app.admonition('Caution', '', app.tag_p({}, [16, 1], 'This is a paragraph. '*5))
+ output += app.tag_p({}, [12, 1], 'This is a paragraph. '*30 )
+ elif p == 'articles':
+ output = app.tag_h1({'class': 'title'}, [12, 1], 'Articles' )
+ elif p == 'events':
+ output = app.tag_h1({'class': 'title'}, [12, 1], 'Events' )
+ else:
+ output = app.tag_p('', [12, 1], 'Page Empty.')
+
+ return app.content(output)
+
+
+def main():
+ """Returns final output."""
+
+ # Define application name. This value is used as reference to
+ # determine which application to load and what tab in the
+ # navigation bar to focus.
+ app.name = 'Home'
+
+ # Define application title. This value is dislayed on the
+ # browser's title bar. Notice that we concatenated the page class
+ # default value here.
+ app.title += ' :: Home'
+
+ page_header = app.logo()
+ page_header += app.ads_google()
+ page_header += app.navibar_top()
+ page_header += app.lastreleases()
+ page_header += app.appslinks()
+ page_header += page_navibar_tabs()
+ page_header = app.tag_div({'id': 'page-header'}, [4, 1], page_header, 1)
+
+ page_body = page_content() + app.separator(indent=[12,1])
+ page_body = app.tag_div({'id':'content'}, [8,1], page_body, 1)
+ page_body = app.tag_div({'id':'page-body'}, [4,1], page_body, 1)
+
+ page_footer = app.tag_div({'id': 'page-footer'}, [4,1], app.credits(), 1)
+
+ top = app.tag_a({'name':'top'}, [0,1])
+ wrap = app.tag_div({'id': 'wrap'}, [0,1], page_header + page_body + page_footer)
+ body = app.tag_body('', [0,1], top + wrap)
+
+ html = app.preamble()
+ html += app.tag_html({'xmlns': 'http://www.w3.org/1999/xhtml', 'dir': 'ltr',
+ 'lang': str(app.language), 'xml:lang':
+ str(app.language)}, [0,1], app.metadata() + body)
+
+ return html
diff --git a/Scripts/CentOS-Web/Apps/Sponsors/__init__.py b/Scripts/CentOS-Web/Apps/Sponsors/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Scripts/CentOS-Web/Apps/Sponsors/__init__.py
diff --git a/Scripts/CentOS-Web/Apps/Sponsors/page.py b/Scripts/CentOS-Web/Apps/Sponsors/page.py
new file mode 100755
index 0000000..ce7721d
--- /dev/null
+++ b/Scripts/CentOS-Web/Apps/Sponsors/page.py
@@ -0,0 +1,114 @@
+#!/usr/bin/python
+#
+# Apps.Home.page -- This module intantiates Apps.xhtml module to
+# create the xhtml output of home web applications.
+#
+# Copyright (C) 2009, 2010, 2011 The CentOS Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# ----------------------------------------------------------------------
+# $Id$
+# ----------------------------------------------------------------------
+
+from Apps import page
+
+app = page.Layout()
+
+
+def page_navibar_tabs():
+ """Returns application's main pages.
+
+ The application's main pages are organized as tabs in the
+ application navigation bar. There is one tab for each main page
+ inside the application.
+
+ """
+ names = ['Hardware', 'Hosting', 'Others']
+ attrs = []
+
+ for i in names:
+ if 'app' in app.qs.keys():
+ attrs.append({'href': '/centos-web/?app=' + app.qs['app'][0].lower() + '&p=' + i.lower()})
+ else:
+ attrs.append({'href': '/centos-web/?p=' + i.lower()})
+
+ if 'p' in app.qs.keys():
+ focus = app.qs['p'][0]
+ else:
+ focus = names[0]
+
+ return app.navibar_app(names, attrs, focus)
+
+
+def page_content():
+ """Returns page content.
+
+ The page content to show is determined from the query string,
+ specifically from the value of `p' variable.
+
+ """
+ if 'p' in app.qs.keys():
+ p = app.qs['p'][0].lower()
+ else:
+ p = 'hardware'
+
+ if p == 'hardware':
+ output = app.tag_h1({'class': 'title'}, [12, 1], 'Hardware Sponsors' )
+ elif p == 'hosting':
+ output = app.tag_h1({'class': 'title'}, [12, 1], 'Hosting Sponsors' )
+ elif p == 'others':
+ output = app.tag_h1({'class': 'title'}, [12, 1], 'Other Sponsors' )
+ else:
+ output = app.tag_p('', [12, 1], 'Page empty.')
+
+ return app.content(output)
+
+def main():
+ """Returns final output."""
+
+ # Define application name. This value is used as reference to
+ # determine which application to load and what tab in the
+ # navigation bar to focus.
+ app.name = 'Sponsors'
+
+ # Define application title. This value is dislayed on the
+ # browser's title bar. Notice that we concatenated the page class
+ # default value here.
+ app.title += ' :: Sponsors'
+
+ page_header = app.logo()
+ page_header += app.ads_google()
+ page_header += app.navibar_top()
+ page_header += app.appslinks()
+ page_header += page_navibar_tabs()
+ page_header = app.tag_div({'id': 'page-header'}, [4,1], page_header, 1)
+
+ page_body = page_content() + app.separator(indent=[12,1])
+ page_body = app.tag_div({'id':'content'}, [8,1], page_body, 1)
+ page_body = app.tag_div({'id':'page-body'}, [4,1], page_body, 1)
+
+ page_footer = app.tag_div({'id': 'page-footer'}, [4,1], app.credits(), 1)
+
+ top = app.tag_a({'name':'top'}, [0,1], '')
+ wrap = app.tag_div({'id': 'wrap'}, [0,1], page_header + page_body + page_footer, 1)
+ body = app.tag_body('', [0,1], wrap)
+
+ html = app.preamble()
+ html += app.tag_html({'xmlns': 'http://www.w3.org/1999/xhtml', 'dir': 'ltr',
+ 'lang': str(app.language), 'xml:lang':
+ str(app.language)}, [0,1], app.metadata() + body)
+
+ return html
diff --git a/Scripts/CentOS-Web/Apps/page.py b/Scripts/CentOS-Web/Apps/page.py
index ce958c6..18edcd6 100755
--- a/Scripts/CentOS-Web/Apps/page.py
+++ b/Scripts/CentOS-Web/Apps/page.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
#
-# Apps.xhtml -- This module encapsulates XHTML output code needed by
-# web applications.
+# Apps.page -- This module encapsulates the page layout of web
+# applications.
#
# Copyright (C) 2011 The CentOS Project
#
@@ -27,7 +27,9 @@ import os
import cgi
import cgitb; cgitb.enable()
-class Page:
+from Apps import xhtml
+
+class Layout(xhtml.Strict):
"""Xhtml page modeling."""
@@ -42,81 +44,7 @@ class Page:
self.language = 'en'
- def tag(self, name, attrs, indent=[8,1], content="", has_child=0):
- """Returns XHTML tag definition.
-
- Arguments:
-
- name: The XHTML tag's name. Notice that this function doesn't
- verify nor validate the XHTML tags you provide. It is up
- to you write them correctly considering the XHTML standard
- definition.
-
- attrs: The XHTML tag's attribute. Notice that this function
- doesn't verify the attributes assignation to tags. You
- need to know what attributes are considered valid to the
- tag you are creating in order to build a well-formed XHTML
- document. Such verification can be achived inside firefox
- browser through the `firebug' plugin.
-
- indent: The XHTML tag's indentation (Optional). This argument
- is a list of two numerical values. The first value in the
- list represents the amount of horizontal spaces between
- the beginning of line and the opening tag. The second
- value in the list represents the amount of vertical spaces
- (new lines) between tags.
-
- content: The XHTML tag's content (Optional). This argument
- provides the information the tag encloses. When this
- argument is empty, tag is rendered without content.
-
- has_child: The XHTML tag has a child? (Optional). This
- argument is specifies whether a tag has another tag inside
- (1) or not (0). When a tag has not a child tag,
- indentation is applied between the tag content and the
- closing tag provoking an unecessary spaces to be shown.
- Such kind of problems are prevented by setting this option
- to `0'. On the other hand, when a tag has a child tag
- inside, using the value `1' will keep the closing tag
- indentation aligned with the opening one.
-
- This function encapsulates the construction of XHTML tags.
- Use this function wherever you need to create XHTML tags. It
- helps to standardize tag constructions and their final output
- and. This function provides a consistent way of producing
- output for XHTML documents.
- """
- if indent[0] > 0:
- h_indent = ' '*indent[0]
- else:
- h_indent = ''
-
- if indent[1] > 0:
- v_indent = "\n"*indent[1]
- else:
- v_indent = ''
-
- output = v_indent + h_indent + '<' + str(name)
- if len(attrs) > 0:
- attr_names = attrs.keys()
- attr_names.sort()
- for attr_name in attr_names:
- output += ' ' + str(attr_name) + '="' + str(attrs[attr_name]) + '"'
- if content == '':
- output += ' />'
- else:
- output += '>'
- output += str(content)
- if has_child == 1:
- output += h_indent + '' + str(name) + '>'
- else:
- output += '' + str(name) + '>'
- output += v_indent
-
- return output
-
-
- def page_preamble(self):
+ def preamble(self):
"""Return XHTML code of page preamble.
The page preamble sets the document type definition required
@@ -131,7 +59,7 @@ class Page:
return output
- def page_logo(self):
+ def logo(self):
"""Returns XHTML code of page logo.
The page logo is displayed on the top-left corner of the page.
@@ -146,10 +74,10 @@ class Page:
attrs.append({'title': 'Community Enterprise Operating System', 'href': '/centos-web/'})
attrs.append({'src': '/centos-web-pub/Images/centos-logo.png', 'alt': 'CentOS'})
- return self.tag('div', attrs[0], [8,1], self.tag('a', attrs[1], [12,1], self.tag('img', attrs[2], [0,0], '', 0), 0), 1)
+ return self.tag_div(attrs[0], [8,1], self.tag_a(attrs[1], [12,1], self.tag_img(attrs[2], [0,0]), 0), 1)
- def page_ads_google(self):
+ def ads_google(self):
"""Returns XHTML code of Google advertisement (468x60 pixels)."""
output = """
@@ -178,7 +106,7 @@ class Page:
return output
- def page_navibar_top(self):
+ def navibar_top(self):
"""Returns XHTML code of top-level navigation bar.
The top-level navigation bar organizes links to the web
@@ -200,15 +128,18 @@ class Page:
focus = self.name
for i in range(len(names)):
- attrs.append({'href': '/centos-web/?app=' + names[i].lower()})
+ if names[i].lower() == 'home':
+ attrs.append({'href': '/centos-web/'})
+ else:
+ attrs.append({'href': '/centos-web/?app=' + names[i].lower()})
- tabs = self.page_navibar_tabs(names, attrs, focus)
- tabs += self.page_line()
+ tabs = self.navibar_tabs(names, attrs, focus)
+ tabs += self.separator()
return tabs
- def page_navibar_tabs(self, names, attrs, focus=''):
+ def navibar_tabs(self, names, attrs, focus=''):
"""Returns navigation tabs.
Arguments:
@@ -229,79 +160,84 @@ class Page:
navibar_tabs = ''
for i in range(len(names)):
- content = self.tag('span', '', [0,0], str(names[i]))
- content = self.tag('a', attrs[i], [16,1], content)
+ content = self.tag_span('', [0,0], str(names[i]))
+ content = self.tag_a(attrs[i], [16,1], content)
if str(names[i]).lower() == focus.lower():
- content = self.tag('span', {'class': 'current'}, [12,1], content, 1)
+ content = self.tag_span({'class': 'current'}, [12,1], content, 1)
else:
- content = self.tag('span', '', [12,1], content, 1)
+ content = self.tag_span('', [12,1], content, 1)
navibar_tabs += content
- return self.tag('div', {'class': 'tabs'}, [8,1], navibar_tabs, 1)
+ return self.tag_div({'class': 'tabs'}, [8,1], navibar_tabs, 1)
- def page_lastreleases(self, names=['6.0'], attrs=[{'href': '/centos-web/?p=releases&id=6.0'}]):
+ def lastreleases(self, names=['6.0'], attrs=[{'href': '/centos-web/?p=releases&id=6.0'}]):
"""Returns last-release information and related RSS link."""
releases = ''
- title = self.tag('a', {'href': '/centos-web/?p=releases'}, [0,0], 'Last Releases') + ':'
- title = self.tag('span', {'class': 'title'}, [16,1], title)
+ title = self.tag_a({'href': '/centos-web/?p=releases'}, [0,0], 'Last Releases') + ':'
+ title = self.tag_span({'class': 'title'}, [16,1], title)
for i in range(len(names)):
- link = self.tag('a', attrs[i], [20,1], names[i])
+ link = self.tag_a(attrs[i], [20,1], names[i])
if i == len(names) - 1:
- span = self.tag('span', {'class': 'last release'}, [16,1], link, 1)
+ span = self.tag_span({'class': 'last release'}, [16,1], link, 1)
else:
- span = self.tag('span', {'class': 'release'}, [16,1], link, 1)
+ span = self.tag_span({'class': 'release'}, [16,1], link, 1)
releases += span
- releases = self.tag('div', {'class': 'left'}, [12,1], title + releases, 1)
+ releases = self.tag_div({'class': 'left'}, [12,1], title + releases, 1)
- rsslink = self.tag('span', '', [0,0], 'RSS')
- rsslink = self.tag('a', {'href': '/centos-web/?print=rss', 'title': 'RSS'}, [20,1], rsslink)
- rsslink = self.tag('span', {'class': 'rss'}, [16,1], rsslink, 1)
- rsslink = self.tag('div', {'class': 'right'}, [12, 1], rsslink, 1)
+ rsslink = self.tag_span('', [0,0], 'RSS')
+ rsslink = self.tag_a({'href': '/centos-web/?print=rss', 'title': 'RSS'}, [20,1], rsslink)
+ rsslink = self.tag_span({'class': 'rss'}, [16,1], rsslink, 1)
+ rsslink = self.tag_div({'class': 'right'}, [12, 1], rsslink, 1)
- return self.tag('div', {'id': 'last-releases'}, [8,1], releases + rsslink, 1)
+ return self.tag_div({'id': 'last-releases'}, [8,1], releases + rsslink, 1)
- def page_appslinks(self):
+ def appslinks(self):
"""Returns application related links."""
- appslinks = self.page_userlinks()
- return self.tag('div', {'id': 'appslinks'}, [8,1], appslinks, 1)
+ appslinks = self.userlinks()
+ return self.tag_div({'id': 'appslinks'}, [8,1], appslinks, 1)
- def page_lastvisit(self):
- last_visit = self.tag('a', {'href': '/centos-web/?p=lastvisit'}, [0,0], 'Your last visit was at')
- last_visit = self.tag('span', {'class': 'title'}, [16, 1], last_visit)
- last_visit += self.tag('span', {'class': 'datetime'}, [16, 1], '...')
- return self.tag('div', {'class': 'lastvisit'}, [12, 1], last_visit, 1)
+ def lastvisit(self):
+ last_visit = self.tag_a({'href': '/centos-web/?p=lastvisit'}, [0,0], 'Your last visit was at')
+ last_visit = self.tag_span({'class': 'title'}, [16, 1], last_visit)
+ last_visit += self.tag_span({'class': 'datetime'}, [16, 1], '...')
+ return self.tag_div({'class': 'lastvisit'}, [12, 1], last_visit, 1)
- def page_session(self):
+ def session(self):
"""Returns information related to user's session."""
names = []
attrs = []
session = ''
+ if 'app' in self.qs:
+ app = 'app=' + self.qs['app'][0].lower() + '&'
+ else:
+ app = ''
+
names.append('Lost your password?')
- attrs.append({'href': '/centos-web/?p=lostpwd'})
+ attrs.append({'href': '/centos-web/?' + app + 'p=lostpwd'})
names.append('Register')
- attrs.append({'href': '/centos-web/?p=register'})
+ attrs.append({'href': '/centos-web/?' + app + 'p=register'})
names.append('Login')
- attrs.append({'href': '/centos-web/?p=login'})
+ attrs.append({'href': '/centos-web/?' + app + 'p=login'})
for i in range(len(names)):
- output = self.tag('a', attrs[i], [20,1], str(names[i]), 0)
+ output = self.tag_a(attrs[i], [20,1], str(names[i]), 0)
if i == len(names) - 1:
- output = self.tag('span', {'class': 'last'}, [16,1], output, 1)
+ output = self.tag_span({'class': 'last'}, [16,1], output, 1)
else:
- output = self.tag('span', '', [16,1], output, 1)
+ output = self.tag_span('', [16,1], output, 1)
session += output
- return self.tag('div', {'class': 'session'}, [12,1], session, 1)
+ return self.tag_div({'class': 'session'}, [12,1], session, 1)
- def page_trail(self, names=['None'], attrs=[{'href': '/centos-web/'}]):
+ def trail(self, names=['None'], attrs=[{'href': '/centos-web/'}]):
"""Returns page trails (a.k.a. breadcrumbs).
The page breadcrumbs record the last pages visited inside the
@@ -316,15 +252,15 @@ class Page:
for i in range(len(names)):
if i == len(names) - 1:
- content = self.tag('span', {'class':'last'}, [16,1], self.tag('a', attrs[i], [20, 1], names[i]), 1)
+ content = self.tag_span({'class':'last'}, [16,1], self.tag_a(attrs[i], [20, 1], names[i]), 1)
else:
- content = self.tag('span', '', [16,1], self.tag('a', attrs[i], [20, 1], names[i], 0), 1)
+ content = self.tag_span('', [16,1], self.tag_a(attrs[i], [20, 1], names[i], 0), 1)
links += content
- return self.tag('div', {'class': 'trail'}, [12,1], links, 1)
+ return self.tag_div({'class': 'trail'}, [12,1], links, 1)
- def page_userlinks(self):
+ def userlinks(self):
"""Returns user links.
Arguments:
@@ -340,59 +276,59 @@ class Page:
bar, just over the application navigation tabs.
"""
- userlinks = self.page_lastvisit()
- userlinks += self.page_session()
- userlinks += self.page_trail()
+ userlinks = self.lastvisit()
+ userlinks += self.session()
+ userlinks += self.trail()
- return self.tag('div', {'class': 'userlinks'}, [8,1], userlinks, 1)
+ return self.tag_div({'class': 'userlinks'}, [8,1], userlinks, 1)
- def page_navibar_app(self, names=['Welcome'], attrs=[{'href':'/centos-web/?p=welcome'}], focus='Welcome'):
+ def navibar_app(self, names=['Welcome'], attrs=[{'href':'/centos-web/?p=welcome'}], focus='Welcome'):
"""Returns application's navigation bar."""
- navibar_app = self.page_navibar_tabs(names, attrs, focus)
- navibar_app += self.page_line({'class': 'page-line white'}, [8,1])
+ navibar_app = self.navibar_tabs(names, attrs, focus)
+ navibar_app += self.separator({'class': 'page-line white'}, [8,1])
return navibar_app
- def page_line(self, attrs={'class': 'page-line'}, indent=[8,1]):
+ def separator(self, attrs={'class': 'page-line'}, indent=[16,1]):
"""Returns a division line."""
- page_line = self.tag('hr', {'style': 'display:none;'}, [0,0])
- page_line = self.tag('div', attrs, indent, page_line)
+ line = self.tag_hr({'style': 'display:none;'}, [0,0])
+ line = self.tag_div(attrs, indent, line)
- return page_line
+ return line
- def page_license(self):
+ def license(self):
"""Retruns link to page license."""
license = 'Creative Commons Attribution-Share Alike 3.0 Unported License'
- license = self.tag('a', {'href': 'http://creativecommons.org/licenses/by-sa/3.0/'}, [0,0], license) + '.'
+ license = self.tag_a({'href': 'http://creativecommons.org/licenses/by-sa/3.0/'}, [0,0], license) + '.'
return license
- def page_metadata(self):
+ def metadata(self):
"""Returns page metadata."""
- metadata = self.tag('meta', {'http-equiv': 'content-type', 'content': 'text/html; charset=UTF-8'}, [4,1])
- metadata += self.tag('meta', {'http-equiv': 'content-style-type', 'content': 'text/css'}, [4,0])
- metadata += self.tag('meta', {'http-equiv': 'content-language', 'content': str(self.language)}, [4,1])
- metadata += self.tag('meta', {'name': 'keywords', 'content': str(self.keywords)}, [4,0])
- metadata += self.tag('meta', {'name': 'description', 'content': str(self.description)}, [4,1])
- metadata += self.tag('meta', {'name': 'copyright', 'content': 'Copyright © ' + str(self.copyright)}, [4,0])
- metadata += self.tag('title', '', [4,1], self.title)
- metadata += self.tag('link', {'href': '/centos-web-pub/stylesheet.css','rel': 'stylesheet', 'type': 'text/css'}, [4,0])
- metadata += self.tag('link', {'href': '/centos-web-pub/Images/centos-fav.png', 'rel': 'shortcut icon', 'type': 'image/png'}, [4,1])
+ metadata = self.tag_meta({'http-equiv': 'content-type', 'content': 'text/html; charset=UTF-8'}, [4,1])
+ metadata += self.tag_meta({'http-equiv': 'content-style-type', 'content': 'text/css'}, [4,0])
+ metadata += self.tag_meta({'http-equiv': 'content-language', 'content': str(self.language)}, [4,1])
+ metadata += self.tag_meta({'name': 'keywords', 'content': str(self.keywords)}, [4,0])
+ metadata += self.tag_meta({'name': 'description', 'content': str(self.description)}, [4,1])
+ metadata += self.tag_meta({'name': 'copyright', 'content': 'Copyright © ' + str(self.copyright)}, [4,0])
+ metadata += self.tag_title('', [4,1], self.title)
+ metadata += self.tag_link({'href': '/centos-web-pub/stylesheet.css','rel': 'stylesheet', 'type': 'text/css'}, [4,0])
+ metadata += self.tag_link({'href': '/centos-web-pub/Images/centos-fav.png', 'rel': 'shortcut icon', 'type': 'image/png'}, [4,1])
- return self.tag('head', '', [0,1], metadata)
+ return self.tag_head('', [0,1], metadata)
- def page_content(self, content='Page empty.'):
+ def content(self, content='Empty Page.'):
"""Returns page content."""
return content
- def page_admonition(self, title='Note', subtitle="", content=""):
+ def admonition(self, title='Note', subtitle="", content=""):
"""Returns page admonition.
Arguments:
@@ -426,54 +362,54 @@ class Page:
if title in admonitions:
attrs = {'class': 'admonition ' + title.lower()}
- image = self.tag('img', {'src': '/centos-web-pub/Images/' + title.lower() + '.png', 'alt': title}, [0,0])
- title = self.tag('h3', {'class': 'title'}, [0,0], title + subtitle, 0)
- output = image + title + content + self.page_line()
+ image = self.tag_img({'src': '/centos-web-pub/Images/' + title.lower() + '.png', 'alt': title}, [16,1])
+ title = self.tag_h3({'class': 'title'}, [16,1], title + subtitle, 0)
+ output = image + title + content + self.separator()
else:
attrs = {'class': 'admonition unknown'}
- title = self.tag('h3', {'class': 'title'}, [16,1], title + subtitle, 1)
+ title = self.tag_h3({'class': 'title'}, [16,1], title + subtitle, 1)
output = title + content
- return self.tag('div', attrs, [12,1], output, 1)
+ return self.tag_div(attrs, [12,1], output, 1)
- def page_credits(self):
+ def credits(self):
"""Returns page credits."""
- copyright = self.tag('p', {'class': 'copyright'}, [12,1], 'Copyright © ' + str(self.copyright))
- license = self.tag('p', {'class': 'license'}, [12,1], 'This website is licensed under a ' + str(self.page_license()))
- credits = self.tag('img', {'src': '/centos-web-pub/Images/top.png', 'alt': 'Top'}, [0,0])
- credits = self.tag('a', {'title': 'Top', 'href': '#top'}, [16,1], credits)
- credits = self.tag('div', {'class': 'top'}, [12,1], credits, 1)
+ copyright = self.tag_p({'class': 'copyright'}, [12,1], 'Copyright © ' + str(self.copyright))
+ license = self.tag_p({'class': 'license'}, [12,1], 'This website is licensed under a ' + str(self.license()))
+ credits = self.tag_img({'src': '/centos-web-pub/Images/top.png', 'alt': 'Top'}, [0,0])
+ credits = self.tag_a({'title': 'Top', 'href': '#top'}, [16,1], credits)
+ credits = self.tag_div({'class': 'top'}, [12,1], credits, 1)
credits = str(credits) + str(copyright) + str(license)
- credits = self.tag('div', {'class': 'credits'}, [8,1], credits, 1)
+ credits = self.tag_div({'class': 'credits'}, [8,1], credits, 1)
return credits
def page(self):
"""Returns page final output."""
- page_header = self.page_logo()
- page_header += self.page_ads_google()
- page_header += self.page_navibar_top()
- page_header += self.page_lastreleases()
- page_header += self.page_appslinks()
- page_header += self.page_navibar_app()
- page_header = self.tag('div', {'id': 'page-header'}, [4,1], page_header, 1)
-
- page_body = self.page_content()
- page_body = self.tag('div', {'id':'content'}, [8,1], page_body, 1)
- page_body = self.tag('div', {'id':'page-body'}, [4,1], page_body, 1)
-
- page_footer = self.tag('div', {'id': 'page-footer'}, [4,1], self.page_credits(), 1)
+ header = self.logo()
+ header += self.ads_google()
+ header += self.navibar_top()
+ header += self.lastreleases()
+ header += self.appslinks()
+ header += self.navibar_app()
+ header = self.tag_div({'id': 'page-header'}, [4,1], header, 1)
+
+ body = self.content()
+ body = self.tag_div({'id':'content'}, [8,1], body, 1)
+ body = self.tag_div({'id':'page-body'}, [4,1], body, 1)
+
+ footer = self.tag_div({'id': 'page-footer'}, [4,1], self.credits(), 1)
- top = self.tag('a', {'name':'top'}, [0,1])
- wrap = self.tag('div', {'id': 'wrap'}, [0,1], page_header + page_body + page_footer, 1)
- body = self.tag('body', '', [0,1], top + wrap)
+ top = self.tag_a({'name':'top'}, [0,1])
+ wrap = self.tag_div({'id': 'wrap'}, [0,1], header + body + footer, 1)
+ body = self.tag_body('', [0,1], top + wrap)
- html = self.page_preamble()
- html += self.tag('html', {'xmlns': 'http://www.w3.org/1999/xhtml', 'dir': 'ltr',
+ html = self.preamble()
+ html += self.tag_html({'xmlns': 'http://www.w3.org/1999/xhtml', 'dir': 'ltr',
'lang': str(self.language), 'xml:lang':
- str(self.language)}, [0,1], self.page_metadata() + body)
+ str(self.language)}, [0,1], self.metadata() + body)
return html
diff --git a/Scripts/CentOS-Web/Apps/xhtml.py b/Scripts/CentOS-Web/Apps/xhtml.py
new file mode 100755
index 0000000..1d62dca
--- /dev/null
+++ b/Scripts/CentOS-Web/Apps/xhtml.py
@@ -0,0 +1,1426 @@
+# Copyright (C) 2011 The CentOS Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# ----------------------------------------------------------------------
+# $Id$
+# ----------------------------------------------------------------------
+"""
+This module (App.xhtml) encapsulates the output code needed by web
+applications, using the Extensible HTML version 1.0 DTDs
+(/usr/share/sgml/xhtml1/xhtml1-20020801/DTD/) as reference.
+"""
+
+
+class Strict:
+ """Implements XHTML strict document type definition."""
+
+
+ def __init__():
+ """Initialize class data."""
+
+ # Core attributes common to most elements.
+ self.coreattr = {'id':'', # document-wide unique id
+ 'class':'', # space separated list of classes
+ 'style':'', # associated style info
+ 'title':'' # advisory title/amplification
+ }
+
+ # Internationalization attributes.
+ self.i18n = {'lang':'', # language code (backwards compatible)
+ 'xml:lang':'', # language code (as per XML 1.0 spec)
+ 'dir':'' # direction for weak/neutral text
+ }
+
+ # Attributes for common UI events.
+ self.events = {'onclick':'', # a pointer button was clicked
+ 'ondblclick':'', # a pointer button was double clicked
+ 'onmousedown':'', # a pointer button was pressed down
+ 'onmouseup':'', # a pointer button was released
+ 'onmousemove':'', # a pointer was moved onto the element
+ 'onmouseout':'', # a pointer was moved away from the element
+ 'onkeypress':'', # a key was pressed and released
+ 'onkeydown':'', # a key was pressed down
+ 'onkeyup':'' # a key was released
+ }
+
+ # Attributes for elements that can get the focus.
+ self.focus = {'accesskey':'', # accessibility key character
+ 'tabindex':'', # position in tabbing order
+ 'onfocus':'', # the element got the focus
+ 'onblur':'' # the element lost the focus
+ }
+
+ # Attributes generic format.
+ self.attrs = self.coreattrs + self.i18n + self.events
+
+
+ def tag(self, name, attrs, indent=[8,1], content="", has_child=0):
+ """Returns generic XHTML tag definition.
+
+ Arguments:
+
+ name: The XHTML tag's name. Notice that this function doesn't
+ verify nor validate the XHTML tags you provide. It is up
+ to you write them correctly considering the XHTML standard
+ definition.
+
+ attrs: The XHTML tag's attribute. Notice that this function
+ doesn't verify the attributes assignation to tags. You
+ need to know what attributes are considered valid to the
+ tag you are creating in order to build a well-formed XHTML
+ document. Such verification can be achived inside firefox
+ browser through the `firebug' plugin.
+
+ indent: The XHTML tag's indentation (Optional). This argument
+ is a list of two numerical values. The first value in the
+ list represents the amount of horizontal spaces between
+ the beginning of line and the opening tag. The second
+ value in the list represents the amount of vertical spaces
+ (new lines) between tags.
+
+ content: The XHTML tag's content (Optional). This argument
+ provides the information the tag encloses. When this
+ argument is empty, tag is rendered without content.
+
+ has_child: The XHTML tag has a child? (Optional). This
+ argument is specifies whether a tag has another tag inside
+ (1) or not (0). When a tag has not a child tag,
+ indentation is applied between the tag content and the
+ closing tag provoking an unecessary spaces to be shown.
+ Such kind of problems are prevented by setting this option
+ to `0'. On the other hand, when a tag has a child tag
+ inside, using the value `1' will keep the closing tag
+ indentation aligned with the opening one.
+
+ This function encapsulates the construction of XHTML tags.
+ Use this function wherever you need to create XHTML tags. It
+ helps to standardize tag constructions and their final output
+ and. This function provides a consistent way of producing
+ output for XHTML documents.
+ """
+ if indent[0] > 0:
+ h_indent = ' '*indent[0]
+ else:
+ h_indent = ''
+
+ if indent[1] > 0:
+ v_indent = "\n"*indent[1]
+ else:
+ v_indent = ''
+
+ output = v_indent + h_indent + '<' + str(name)
+ if len(attrs) > 0:
+ attr_names = attrs.keys()
+ attr_names.sort()
+ for attr_name in attr_names:
+ output += ' ' + str(attr_name) + '="' + str(attrs[attr_name]) + '"'
+ if content == '':
+ output += ' />'
+ else:
+ output += '>'
+ output += str(content)
+ if has_child == 1:
+ output += h_indent + '' + str(name) + '>'
+ else:
+ output += '' + str(name) + '>'
+ output += v_indent
+
+ return output
+
+
+ # ----------------------------------------------------------------------
+ # Document Structure
+ # ----------------------------------------------------------------------
+
+ def tag_html(self, attrs, indent, content, has_child=1):
+ """Returns document structure definition.
+
+
+
+
+ The namespace URI designates the document profile.
+
+ """
+ return self.tag('html', attrs, indent, content, has_child=1)
+
+
+ # ----------------------------------------------------------------------
+ # Document Head
+ # ----------------------------------------------------------------------
+
+ def tag_head(self, attrs, indent, content, has_child=1):
+ """Returns document head definition.
+
+
+
+
+
+
+ Content model is %head.misc; combined with a single title and
+ an optional base element in any order.
+
+ """
+ return self.tag('head', attrs, indent, content, has_child)
+
+
+ def tag_title(self, attrs, indent, content, has_child=0):
+ """Returns title definition.
+
+
+
+
+ The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+
+ """
+ return self.tag('title', attrs, indent, content, has_child)
+
+
+ def tag_base(self, attrs, indent):
+ """Returns document base URI.
+
+
+
+
+ """
+ return self.tag('base', attrs, indent)
+
+
+ def tag_meta(self, attrs, indent):
+ """Returns generic metainformation.
+
+
+
+
+ """
+ return self.tag('meta', attrs, indent)
+
+
+ def tag_link(self, attrs, indent):
+ """Returns relationship values.
+
+
+
+
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used with the
+ link element in document head e.g. start, contents,
+ previous, next, index, end, help.
+
+ b) to link to a separate style sheet (rel="stylesheet").
+
+ c) to make a link to a script (rel="script").
+
+ d) by stylesheets to control how collections of html nodes
+ are rendered into printed documents.
+
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate"
+ media="print").
+
+ """
+ return self.tag('link', attrs, indent)
+
+
+ def tag_style(self, attrs, indent, content, has_child=0):
+ """Returns style info.
+
+
+
+
+ """
+ return self.tag('style', attrs, indent, content, has_child)
+
+
+ def tag_script(self, attrs, indent, content, has_child=0):
+ """Returns script statement.
+
+
+
+
+
+ """
+ return self.tag('script', attrs, indent, content, has_child)
+
+
+ def tag_noscript(self, attrs, indent, content, has_child=1):
+ """Returns alternate content container for non script-based
+ rendering.
+
+
+
+
+ """
+ return self.tag(self, attrs, indent, content, has_child)
+
+
+ # ----------------------------------------------------------------------
+ # Document Body
+ # ----------------------------------------------------------------------
+
+ def tag_body(self, attrs, indent, content, has_child=1):
+ """Returns document body definition.
+
+
+
+
+ """
+ return self.tag('body', attrs, indent, content, has_child)
+
+
+ def tag_div(self, attrs, indent, content, has_child=0):
+ """Returns generic language/style container.
+
+
+
+
+ """
+ return self.tag('div', attrs, indent, content, has_child)
+
+
+ # ----------------------------------------------------------------------
+ # Paragraphs
+ # ----------------------------------------------------------------------
+
+ def tag_p(self, attrs, indent, content, has_child=0):
+ """Returns paragraph definition.
+
+
+
+
+ """
+ return self.tag('p', attrs, indent, content, has_child)
+
+
+ # ----------------------------------------------------------------------
+ # Headings
+ # ----------------------------------------------------------------------
+ # There are six levels of headings from h1 (the most important) to
+ # h6 (the least important).
+ # ----------------------------------------------------------------------
+
+ def tag_h1(self, attrs, indent, content, has_child=0):
+ """Returns h1 definition.
+
+
+
+
+ """
+ return self.tag('h1', attrs, indent, content, has_child)
+
+
+ def tag_h2(self, attrs, indent, content, has_child=0):
+ """Returns h2 definition.
+
+
+
+
+ """
+ return self.tag('h2', attrs, indent, content, has_child)
+
+
+ def tag_h3(self, attrs, indent, content, has_child):
+ """Returns h3 definition.
+
+
+
+
+ """
+ return self.tag('h3', attrs, indent, content, has_child)
+
+
+ def tag_h4(self, attrs, indent, content, has_child):
+ """Returns h4 definition.
+
+
+
+
+ """
+ return self.tag('h4', attrs, indent, content, has_child)
+
+
+ def tag_h5(self, attrs, indent, content, has_child=0):
+ """Returns h5 definition.
+
+
+
+
+ """
+ return self.tag('h5', attrs, indent, content, has_child)
+
+
+ def tag_h6(self, attrs, indent, content, has_child=0):
+ """Returns h6 definition.
+
+
+
+
+ """
+ return self.tag('h6', attrs, indent, content, has_child)
+
+
+ # ----------------------------------------------------------------------
+ # Lists
+ # ----------------------------------------------------------------------
+
+ def tag_ul(self, attrs, indent, content, has_child=1):
+ """Returns unordered list definition.
+
+
+
+
+ """
+ return self.tag('ul', attrs, indent, content, has_child)
+
+
+ def tag_ol(self, attrs, indent, content, has_child=1):
+ """Returns ordered (numbered) list definition.
+
+
+
+
+ """
+ return self.tag('ol', attrs, indent, content, has_child)
+
+
+ def tag_li(self, attrs, indent, content, has_child=0):
+ """Returns item definition for both ordered (ol) and unordered
+ (ul) lists.
+
+
+
+
+ """
+ return self.tag('li', attrs, indent, content, has_child)
+
+
+ def tag_dl(self, attrs, indent, content, has_child=1):
+ """Returns definition list definition.
+
+
+
+
+ """
+ return self.tag('dl', attrs, indent, content, has_child)
+
+
+ def tag_dt(self, attrs, indent, content, has_child=0):
+ """Returns term of definition lists.
+
+
+
+
+ """
+ return self.tag('dt', attrs, indent, content, has_child)
+
+
+ def tag_dd(self, attrs, indent, content, has_child=0):
+ """Returns definition of definition lists.
+
+
+
+
+ """
+ return self.tag('dd', attrs, indent, content, has_child)
+
+
+ # ----------------------------------------------------------------------
+ # Address
+ # ----------------------------------------------------------------------
+
+ def tag_address(self, attrs, indent, content='', has_child=0):
+ """Returns information on author.
+
+
+
+
+ """
+ return self.tag('address', attrs, indent, content)
+
+
+ # ----------------------------------------------------------------------
+ # Horizontal Rule
+ # ----------------------------------------------------------------------
+
+ def tag_hr(self, attrs, indent):
+ """Returns horizontal rule.
+
+
+
+
+ """
+ return self.tag('hr', attrs, indent)
+
+
+ # ----------------------------------------------------------------------
+ # Preformatted text
+ # ----------------------------------------------------------------------
+
+ def tag_pre(self, attrs, indent, content):
+ """Returns preformatted text.
+
+
+
+
+ content is %Inline; excluding "img|object|big|small|sub|sup"
+
+ """
+ return self.tag('pre', attrs, indent, content)
+
+
+ # ----------------------------------------------------------------------
+ # Block-line Quotes
+ # ----------------------------------------------------------------------
+
+ def tag_blockquote(self, attrs, indent, content):
+ """Returns block-line quote.
+
+
+
+
+ """
+ return self.tag('blockquote', attrs, indent, content)
+
+
+ # ----------------------------------------------------------------------
+ # Inserted/Deleted Text
+ # ----------------------------------------------------------------------
+
+ def tag_ins(self, attrs, indent, content):
+ """Returns inserted text.
+
+
+
+
+ Inserted texts are allowed in block and inline content, but
+ its inappropriate to include block content within an ins
+ element occurring in inline content.
+
+ """
+ return self.tag('ins', attrs, indent, content)
+
+
+ def tag_del(self, attrs, indent, content):
+ """Returns deleted text.
+
+
+
+
+ Deleted texts are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+
+ """
+ return self.tag('ins', attrs, indent, content)
+
+
+ # ----------------------------------------------------------------------
+ # The Anchor Element
+ # ----------------------------------------------------------------------
+
+ def tag_a(self, attrs, indent, content='', has_child=0):
+ """Returns the anchor element.
+
+
+
+
+ content is %Inline; except that anchors shouldn't be nested.
+ """
+ return self.tag('a', attrs, indent, content, has_child)
+
+
+ # ----------------------------------------------------------------------
+ # Inline Elements
+ # ----------------------------------------------------------------------
+
+ def tag_span(self, attrs, indent, content, has_child=0):
+ """Returns span definition.
+
+
+
+
+ """
+ return self.tag('span', attrs, indent, content, has_child)
+
+
+ def tag_dbo(self, attrs, indent, content, has_child=0):
+ """Returns dbo definition.
+
+
+
+
+ """
+ return self.tag('dbo', attrs, indent, content, has_child)
+
+
+ def tag_br(self, attrs, indent):
+ """Returns break definition.
+
+
+
+
+ """
+ return self.tag('br', attrs, indent)
+
+
+ def tag_em(self, attrs, indent, content, has_child=0):
+ """Returns emphasis definition.
+
+
+
+
+ """
+ return self.tag('em', attrs, indent, content, has_child)
+
+
+ def tag_strong(self, attrs, indent, content, has_child=0):
+ """Returns strong emphasis definition.
+
+
+
+
+ """
+ return self.tag('strong', attrs, indent, content, has_child)
+
+
+ def tag_dfn(self, attrs, indent, content, has_child=0):
+ """Returns definitional definition.
+
+
+
+
+ """
+ return self.tag('dfn', attrs, indent, content, has_child)
+
+
+ def tag_code(self, attrs, indent, content, has_child=0):
+ """Returns program code definition.
+
+
+
+
+ """
+ return self.tag('code', attrs, indent, content, has_child)
+
+
+ def tag_samp(self, attrs, indent, content, has_child=0):
+ """Returns sample definition.
+
+
+
+
+ """
+ return self.tag('samp', attrs, indent, content, has_child)
+
+
+ def tag_kbd(self, attrs, indent, content, has_child=0):
+ """Returns definition for something user would type.
+
+
+
+
+ """
+ return self.tag('kbd', attrs, indent, content, has_child)
+
+
+ def tag_var(self, attrs, indent, content, has_child=0):
+ """Returns variable definition.
+
+
+
+
+ """
+ return self.tag('var', attrs, indent, content, has_child)
+
+
+ def tag_cite(self, attrs, indent, content, has_child=0):
+ """Returns citation definition.
+
+
+
+
+ """
+ return self.tag('cite', attrs, indent, content, has_child)
+
+
+ def tag_abbr(self, attrs, indent, content, has_child=0):
+ """Returns abbreviation definition.
+
+
+
+
+ """
+ return self.tag('abbr', attrs, indent, content, has_child)
+
+
+ def tag_acronym(self, attrs, indent, content, has_child=0):
+ """Returns the acronym definition.
+
+
+
+
+ """
+ return self.tag('acronym', attrs, indent, content, has_child)
+
+
+ def tag_q(self, attrs, indent, content, has_child=0):
+ """Returns inline quote definition.
+
+
+
+
+ """
+ return self.tag('q', attrs, indent, content, has_child)
+
+
+ def tag_sub(self, attrs, indent, content, has_child=0):
+ """Returns subscript definition.
+
+
+
+
+ """
+ return self.tag('sub', attrs, indent, content, has_child)
+
+
+ def tag_sup(self, attrs, indent, content, has_child=0):
+ """Returns superscript definition.
+
+
+
+
+ """
+ return self.tag('sup', attrs, indent, content, has_child)
+
+
+ def tag_tt(self, attrs, indent, content, has_child=0):
+ """Returns fixed pitch font definition.
+
+
+
+
+ """
+ return self.tag('tt', attrs, indent, content, has_child)
+
+
+ def tag_i(self, attrs, indent, content, has_child=0):
+ """Returns italic font definition.
+
+
+
+
+ """
+ return self.tag('i', attrs, indent, content, has_child)
+
+
+ def tag_b(self, attrs, indent, content, has_child=0):
+ """Returns bold font definition.
+
+
+
+
+ """
+ return self.tag('b', attrs, indent, content, has_child)
+
+
+ def tag_big(self, attrs, indent, content, has_child=0):
+ """Returns bigger font definition.
+
+
+
+
+ """
+ return self.tag('big', attrs, indent, content, has_child)
+
+
+ def tag_small(self, attrs, indent, content, has_child=0):
+ """Returns smaller font definition.
+
+
+
+
+ """
+ return self.tag('small', attrs, indent, content, has_child)
+
+
+ # ----------------------------------------------------------------------
+ # Object
+ # ----------------------------------------------------------------------
+
+ def tag_object(self, attrs, indent, content, has_child=1):
+ """Returns object definition.
+
+
+
+
+ The object definition is used to embed objects as part of HTML
+ pages. param elements should precede other content.
+ Parameters can also be expressed as attribute/value pairs on
+ the object element itself when brevity is desired.
+
+ """
+ return self.tag('object', attrs, indent, content, has_child)
+
+
+ def tag_param(self, attrs, indent):
+ """Returns param definition.
+
+
+
+
+ The param definition is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced by
+ attribute value pairs on the object start tag.
+
+ """
+ return self.tag('object', attrs, indent)
+
+
+ # ----------------------------------------------------------------------
+ # Images
+ # ----------------------------------------------------------------------
+
+ def tag_img(self, attrs, indent):
+ """Returns image definition.
+
+
+
+
+ To avoid accessibility problems for people who aren't able to
+ see the image, you should provide a text description using the
+ alt and longdesc attributes. In addition, avoid the use of
+ server-side image maps. Note that in this DTD there is no
+ name attribute. That is only available in the transitional
+ and frameset DTD.
+
+ usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely
+ supported.
+
+ """
+ return self.tag('img', attrs, indent)
+
+
+ # ----------------------------------------------------------------------
+ # Client-side image maps
+ # ----------------------------------------------------------------------
+
+ def tag_map(self, attrs, indent, content, has_child=1):
+ """Returns map definition.
+
+
+
+
+ This can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported.
+
+ """
+ return self.tag('map', attrs, indent, indent, content, has_child)
+
+
+ def tag_area(self, attrs, indent):
+ """Returns area definition.
+
+
+
+
+ This can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported.
+
+ """
+ return self.tag('area', attrs, indent)
+
+
+ # ----------------------------------------------------------------------
+ # Forms
+ # ----------------------------------------------------------------------
+
+ def tag_form(self, attrs, indent, content, has_child=1):
+ """Returns form definition.
+
+
+
+
+ """
+ return self.form('form', attrs, indent, content, has_child)
+
+
+ def tag_label(self, attrs, indent, content, has_child=0):
+ """Returns label definition.
+
+
+
+
+ Each label must not contain more than ONE field Label elements
+ shouldn't be nested.
+
+ """
+ return self.tag('label', attrs, indent, content, has_child)
+
+
+ def tag_input(self, attrs, indent):
+ """Returns input definition for form control.
+
+
+
+
+
+
+ The name attribute is required for all but submit & reset.
+
+ """
+ return self.tag('input', attrs, indent)
+
+
+ def tag_select(self, attrs, indent, content, has_child=0):
+ """Returns select definition.
+
+
+
+
+ """
+ return self.tag('select', attrs, indent, content, has_child)
+
+
+ def tag_optgroup(self, attrs, indent, content, has_child=1):
+ """Returns option group definition.
+
+
+
+
+ """
+ return self.tag('optgroup', attrs, indent, content, has_child)
+
+
+ def tag_option(self, attrs, indent, content, has_child=0):
+ """Returns option definition.
+
+
+
+
+ """
+ return self.tag('option', attrs, indent, content, has_child)
+
+
+ def tag_textarea(self, attrs, indent, content):
+ """Returns textarea definition.
+
+
+
+
+ """
+ return self.textarea('textarea', attrs, indent, content)
+
+
+ def tag_fieldset(self, attrs, indent, content, has_child=1):
+ """Returns fieldset definition.
+
+
+
+
+ The fieldset element is used to group form fields. Only one
+ legend element should occur in the content and if present
+ should only be preceded by whitespace.
+
+ """
+ return self.tag('filedset', attrs, indent, content, has_child)
+
+
+ def tag_legend(self, attrs, indent, content):
+ """Retruns legend definition.
+
+
+
+
+ """
+ return self.tag('legend', attrs, indent, content)
+
+
+ def tag_button(self, attrs, indent, content):
+ """Returns button definition.
+
+
+
+
+ content is %Flow; excluding a, form and form controls.
+
+ """
+ return self.tag('button', attrs, indent, content)
+
+
+ def tag_table(self, attrs, indent, content, has_child=1):
+ """Returns table definition.
+
+
+
+
+
+
+
+
+
+
+ Derived from IETF HTML table standard, see [RFC1942]
+
+ The border attribute sets the thickness of the frame around
+ the table. The default units are screen pixels. The frame
+ attribute specifies which parts of the frame around the table
+ should be rendered. The values are not the same as CALS to
+ avoid a name clash with the valign attribute. The rules
+ attribute defines which rules to draw between cells: If rules
+ is absent then assume: "none" if border is absent or
+ border="0" otherwise "all". Horizontal alignment attributes
+ for cell contents:
+ char alignment char, e.g. char=':'
+ charoff offset for alignment char
+
+ """
+ return self.tag('table', attrs, indent, content, has_child)
+
+
+ def tag_caption(self, attrs, indent, content):
+ """Returns caption definition.
+
+
+
+
+ """
+ return self.tag('caption', attrs, indent, content)
+
+
+ def tag_thead(self, attrs, indent, content, has_child=1):
+ """Returns thead definition.
+
+
+
+
+ Use thead to duplicate headers when breaking table across page
+ boundaries, or for static headers when tbody sections are
+ rendered in scrolling panel.
+
+ """
+ return self.tag('thead', attrs, indent, content, has_child)
+
+
+ def tag_tbody(self, attrs, indent, content, has_child=1):
+ """Returns tbody definition.
+
+
+
+
+ Use tbody to duplicate footers when breaking table across page
+ boundaries, or for static footers when tbody sections are
+ rendered in scrolling panel.
+
+ """
+ return self.tag('tbody', attrs, indent, content, has_child)
+
+
+ def tag_tbody(self, attrs, indent, content, has_child=1):
+ """Returns tbody definition.
+
+
+
+
+ Use multiple tbody sections when rules are needed between
+ groups of table rows.
+
+ """
+ return self.tag('tbody', attrs, indent, content, has_child)
+
+
+ def tag_colgroup(self, attrs, indent, content, has_child=1):
+ """Returns colgroup definition.
+
+
+
+
+ colgroup groups a set of col elements. It allows you to group
+ several semantically related columns together.
+
+ """
+ return self.tag('colgroup', attrs, indent, content, has_child)
+
+
+ def tag_col(self, attrs, indent):
+ """Returns col definition.
+
+
+
+
+ col elements define the alignment properties for cells in one
+ or more columns. The width attribute specifies the width of
+ the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one col element to
+ apply to more than one column.
+
+ """
+ return self.tag('col', attrs, indent)
+
+
+ def tag_tr(self, attrs, indent, content, has_child=1):
+ """Returns table row definition.
+
+
+
+
+ """
+ return self.tag('tr', attrs, indent, content, has_child)
+
+
+ def tag_th(self, attrs, indent, content, has_child):
+ """Returns table header definition.
+
+
+
+
+
+
+ Scope is simpler than headers attribute for common tables. th
+ is for headers, td for data and for cells acting as both.
+
+ """
+ return self.tab('th', attrs, indent, content, has_child)
+
+
+ def tag_td(self, attrs, indent, content, has_child=1):
+ """Returns table data definition.
+
+
+
+
+ """
+ return self.tag('td', attrs, indent, content, has_child)