Commits

Manfred Moitzi committed 600e9de

added docs for the script tag

Comments (0)

Files changed (5)

doc/classes/script.rst

+Script
+=========
+
+The **script** element indicate links to a client-side language.
+
+.. autoclass:: svgwrite.container.Script
+
+.. seealso:: http://www.w3.org/TR/SVG/script.html
+
+.. automethod:: svgwrite.container.Script.__init__
+
+Parent Classes
+--------------
+
+* :class:`svgwrite.base.BaseElement`
+* :class:`svgwrite.mixins.Presentation`
+
+SVG Attributes
+--------------
+
+* **type** -- `string`
+
+  Identifies the scripting language for the given *script* element. The value
+  content-type specifies a media type, per MIME. If a *type* is not provided,
+  the value of **contentScriptType** on the **svg** element shall be used,
+  which in turn defaults to ``'application/ecmascript'``. If a *script* element
+  falls outside of the outermost svg element and the *type* is not provided,
+  the *type* must default to ``'application/ecmascript'``
+
+* **externalResourcesRequired** -- `bool`
+
+  *False*: if document rendering can proceed even if external resources are
+  unavailable else: *True*
+
+* **xlink:href** -- `string` -- **href** parameter
+
+* **xlink:show** -- ``'new|replace'``
+
+* **xlink:acuate** -- ``'onRequest'``
+
+  This attribute provides documentation to XLink-aware processors that an
+  application should traverse from the starting resource to the ending
+  resource only on a post-loading event triggered for the purpose of traversal.
+
+Standard SVG Attributes
+-----------------------
+
+* :doc:`Core Attributes </attributes/core>`
+* :doc:`Conditional Processing Attributes </attributes/conditional_processing>`
+* :doc:`Graphical Event Attributes </attributes/graphical_event>`
+* :doc:`Presentation Attributes </attributes/presentation>`
+* :doc:`XLink Attributes </attributes/xlink>`
    classes/marker
    classes/use
    classes/hyperlink
+   classes/script
 
 Graphical Objects
 -----------------

svgwrite/container.py

 * :class:`svgwrite.Marker`
 * :class:`svgwrite.Use`
 * :class:`svgwrite.Hyperlink`
+* :class:`svgwrite.Script`
 
 set/get SVG attributes::
 

svgwrite/shapes.py

 
         """
         super(Polyline, self).__init__(**extra)
+        self.points = list(points)
         if self.debug:
-            for point in points:
+            for point in self.points:
                 x, y = point
                 self.validator.check_svg_type(x, 'number')
                 self.validator.check_svg_type(y, 'number')
-        self.points = list(points)
 
     def get_xml(self):
         self.attribs['points'] = self.points_to_string(self.points)

tests/test_script.py

 # Copyright (C) 2010, Manfred Moitzi
 # License: GPLv3
 
-import sys
 import unittest
 
 from svgwrite.container import Script
 
-class TestUse(unittest.TestCase):
+class TestScript(unittest.TestCase):
     def test_constructor(self):
         script = Script('test.js', "text/ecmascript")
         self.assertEqual(script.tostring(), '<script type="text/ecmascript" xlink:href="test.js" />')
 
 if __name__=='__main__':
-    unittest.main()
+    unittest.main()