Permalink
Browse files

Document the page3 module.

  • Loading branch information...
1 parent dd04504 commit 30218e5c8ddc68d135bb9d44fa629cf4066e2870 @SimonSapin SimonSapin committed Mar 31, 2012
Showing with 47 additions and 14 deletions.
  1. +7 −0 docs/_static/custom.css
  2. +2 −1 docs/css3.rst
  3. +5 −3 docs/parsing.rst
  4. +33 −10 tinycss/page3.py
View
@@ -15,3 +15,10 @@ div.document ul ul {
table.field-list p, table.field-list ul {
margin-bottom: .5em;
}
+table {
+ border-collapse: collapse;
+ margin-bottom: 1em;
+}
+table.docutils td, table.docutils th {
+ padding: .2em .5em;
+}
View
@@ -45,4 +45,5 @@ a function that can help parse property values, as
Paged Media 3
-------------
-TODO
+.. autoclass:: CSSPage3Parser
+.. autoclass:: MarginRule
View
@@ -44,9 +44,11 @@ Parsing a stylesheet
Parser classes have three different methods to parse CSS stylesheet,
depending on whether you have a file, a byte string, or an Unicode string.
-.. automethod:: CSS21Parser.parse_stylesheet_file
-.. automethod:: CSS21Parser.parse_stylesheet_bytes
-.. automethod:: CSS21Parser.parse_stylesheet
+.. autoclass:: CSS21Parser
+
+ .. automethod:: parse_stylesheet_file
+ .. automethod:: parse_stylesheet_bytes
+ .. automethod:: parse_stylesheet
Parsing a ``style`` attribute
View
@@ -20,15 +20,36 @@ class MarginRule(object):
"""A parsed at-rule for margin box.
.. attribute:: at_keyword
- One of the 16 at-keywords for margin boxes, eg. ``'@top-left'``
+
+ One of the 16 following strings:
+
+ * ``@top-left-corner``
+ * ``@top-left``
+ * ``@top-center``
+ * ``@top-right``
+ * ``@top-right-corner``
+ * ``@bottom-left-corner``
+ * ``@bottom-left``
+ * ``@bottom-center``
+ * ``@bottom-right``
+ * ``@bottom-right-corner``
+ * ``@left-top``
+ * ``@left-middle``
+ * ``@left-bottom``
+ * ``@right-top``
+ * ``@right-middle``
+ * ``@right-bottom``
.. attribute:: declarations
- A list of :class:`PropertyDeclaration`
+
+ A list of :class:`~.css21.Declaration`
.. attribute:: line
+
Source line where this was read.
.. attribute:: column
+
Source column where this was read.
"""
@@ -41,13 +62,18 @@ def __init__(self, at_keyword, declarations, line, column):
class CSSPage3Parser(CSS21Parser):
- """Extend the parser for CSS 3 Paged Media syntax.
+ """Extend :class:`~.css21.CSS21Parser` for `CSS 3 Paged Media`_ syntax.
- Compared to CSS 2.1, the ``selector`` and ``at_rules`` attributes of
- :class:`PageRule` objects are modified:
+ .. _CSS 3 Paged Media: http://dev.w3.org/csswg/css3-page/
- ``selector``, instead of a single string, is a tuple of the page name
- and the pseudo class. Each of these may be a ``None`` or a string.
+ Compared to CSS 2.1, the ``at_rules`` and ``selector`` attributes of
+ :class:`~.css21.PageRule` objects are modified:
+
+ * ``at_rules`` is not always empty, it is a list of :class:`MarginRule`
+ objects.
+
+ * ``selector``, instead of a single string, is a tuple of the page name
+ and the pseudo class. Each of these may be a ``None`` or a string.
======================== ======================
CSS Parsed selector
@@ -58,9 +84,6 @@ class CSSPage3Parser(CSS21Parser):
``@page table:right {}`` ``('table', 'right')``
======================== ======================
- ``at_rules`` is not always empty, it is a list of :class:`MarginRule`
- objects.
-
"""
PAGE_MARGIN_AT_KEYWORDS = [

0 comments on commit 30218e5

Please sign in to comment.