Skip to content

Commit 9a022f2

Browse files
author
cthedot
committed
newly generated
1 parent eb3e620 commit 9a022f2

13 files changed

Lines changed: 203 additions & 284 deletions

docs/html/_sources/docs/css.txt

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
========================
22
package ``cssutils.css``
33
========================
4-
:Version: $Id: css.txt 1609 2009-01-03 21:07:17Z cthedot $
4+
:Version: $Id: css.txt 1624 2009-01-03 21:47:53Z cthedot $
55

66
.. module:: cssutils.css
77

@@ -111,6 +111,37 @@ CSSStyleDeclaration
111111
:members:
112112
:inherited-members:
113113

114+
The official DOM provides no method to obtain all values set for a property. Cssutils from 0.9.4 implements the additional method :meth:`~cssutils.css.CSSStyleDeclaration.getProperties`, example::
115+
116+
>>> cssText = '''background: white url(paper.png) scroll; /* for all UAs */
117+
... background: white url(ledger.png) fixed; /* for UAs that do fixed backgrounds */
118+
... '''
119+
>>> # omit comments for this example
120+
>>> cssutils.ser.prefs.keepComments = False
121+
>>> style = cssutils.css.CSSStyleDeclaration(cssText=cssText)
122+
>>> print style.cssText
123+
background: white url(paper.png) scroll;
124+
background: white url(ledger.png) fixed;
125+
>>> # work with properties:
126+
>>> proplist = style.getProperties('background', all=True)
127+
>>> proplist
128+
[cssutils.css.Property(name='background', value=u'white url(paper.png) scroll', priority=u''), cssutils.css.Property(name='background', value=u'white url(ledger.png) fixed', priority=u'')]
129+
>>> for prop in proplist: print prop.value
130+
white url(paper.png) scroll
131+
white url(ledger.png) fixed
132+
>>> # overwrite the current property, to overwrite all iterate over proplist
133+
>>> style['background'] = ('red', '!important')
134+
>>> # importance in DOM ist 'important' but '!important' works too
135+
>>> print style['background'], style.getPropertyPriority('background')
136+
red important
137+
>>> print style.cssText
138+
background: white url(paper.png) scroll;
139+
background: red !important;
140+
>>> # output only "effective" properties
141+
>>> cssutils.ser.prefs.keepAllProperties = False
142+
>>> print style.cssText
143+
background: red !important;
144+
114145

115146
Property
116147
--------

docs/html/_sources/docs/scripts.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,54 @@ Options:
5353
-u UA, --useragent=UA
5454
useragent to use for request of URL, default is urllib2s default
5555

56+
The following example outputs a list of stylesheets found with title and href of the found stylesheet. (``PYTHONHOME/Scripts`` should be on your ``PATH``. Additional log output is not shown.)::
57+
58+
> csscapture http://cthedot.de/static/cssutils/examples/capturefrom.html -n
59+
60+
1.
61+
encoding: 'utf-8'
62+
title: u'html 1: link1'
63+
href: u'http://cthedot.de/css/default.css'
64+
2.
65+
encoding: 'utf-8'
66+
title: u'html 2: style1'
67+
href: None
68+
3.
69+
encoding: 'utf-8'
70+
title: u'HTML 2.1: @import'
71+
href: u'http://cthedot.de/static/cssutils/examples/inlineimport1.css'
72+
4.
73+
encoding: 'utf-8'
74+
title: u'html 3: link2'
75+
href: u'http://cthedot.de/static/cssutils/examples/link1.css'
76+
5.
77+
encoding: 'utf-8'
78+
title: u'link1: s1'
79+
href: u'http://cthedot.de/static/cssutils/examples/linkimport1.css'
80+
6.
81+
encoding: 'utf-8'
82+
title: None
83+
href: u'http://cthedot.de/static/cssutils/examples/css/linkimportimport1.css'
84+
7.
85+
encoding: 'utf-8'
86+
title: None
87+
href: u'http://cthedot.de/static/cssutils/examples/css/linkimportimport2.css'
88+
8.
89+
encoding: 'iso-8859-1'
90+
title: u'link1: s2'
91+
href: u'http://cthedot.de/static/cssutils/examples/linkimport2.css'
92+
9.
93+
encoding: 'utf-8'
94+
title: u'html 4: style2'
95+
href: None
96+
10.
97+
encoding: 'utf-8'
98+
title: None
99+
href: u'http://cthedot.de/static/cssutils/examples/css/inlineimport2.css'
100+
11.
101+
encoding: 'utf-8'
102+
title: None
103+
href: u'http://cthedot.de/static/cssutils/examples/css/inlineimportimport1.css'
56104

57105
CSSCombine
58106
==========

docs/html/docs/codec.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<link rel="index" title="Index" href="../genindex.html" />
2121
<link rel="search" title="Search" href="../search.html" />
2222
<link rel="top" title="cssutils v0.9.6a1 documentation" href="../index.html" />
23-
<link rel="next" title="cssutils scripts" href="scripts.html" />
24-
<link rel="prev" title="profiles" href="profiles.html" />
23+
<link rel="next" title="profiles" href="profiles.html" />
24+
<link rel="prev" title="package cssutils.stylesheets" href="stylesheets.html" />
2525
</head>
2626
<body>
2727
<div class="related">
@@ -34,10 +34,10 @@ <h3>Navigation</h3>
3434
<a href="../modindex.html" title="Global Module Index"
3535
accesskey="M">modules</a> |</li>
3636
<li class="right" >
37-
<a href="scripts.html" title="cssutils scripts"
37+
<a href="profiles.html" title="profiles"
3838
accesskey="N">next</a> |</li>
3939
<li class="right" >
40-
<a href="profiles.html" title="profiles"
40+
<a href="stylesheets.html" title="package cssutils.stylesheets"
4141
accesskey="P">previous</a> |</li>
4242
<li><a href="../index.html">cssutils v0.9.6a1 documentation</a> &raquo;</li>
4343
</ul>
@@ -88,9 +88,9 @@ <h1>CSS codec<a class="headerlink" href="#module-cssutils.codec" title="Permalin
8888
<div class="sphinxsidebar">
8989
<div class="sphinxsidebarwrapper">
9090
<h4>Previous topic</h4>
91-
<p class="topless"><a href="profiles.html" title="previous chapter">profiles</a></p>
91+
<p class="topless"><a href="stylesheets.html" title="previous chapter">package <tt class="docutils literal"><span class="pre">cssutils.stylesheets</span></tt></a></p>
9292
<h4>Next topic</h4>
93-
<p class="topless"><a href="scripts.html" title="next chapter"><tt class="docutils literal"><span class="pre">cssutils</span></tt> scripts</a></p>
93+
<p class="topless"><a href="profiles.html" title="next chapter">profiles</a></p>
9494
<h3>This Page</h3>
9595
<ul class="this-page-menu">
9696
<li><a href="../_sources/docs/codec.txt">Show Source</a></li>
@@ -115,10 +115,10 @@ <h3>Navigation</h3>
115115
<a href="../modindex.html" title="Global Module Index"
116116
accesskey="M">modules</a> |</li>
117117
<li class="right" >
118-
<a href="scripts.html" title="cssutils scripts"
118+
<a href="profiles.html" title="profiles"
119119
accesskey="N">next</a> |</li>
120120
<li class="right" >
121-
<a href="profiles.html" title="profiles"
121+
<a href="stylesheets.html" title="package cssutils.stylesheets"
122122
accesskey="P">previous</a> |</li>
123123
<li><a href="../index.html">cssutils v0.9.6a1 documentation</a> &raquo;</li>
124124
</ul>

docs/html/docs/css.html

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <h1>package <tt class="docutils literal"><span class="pre">cssutils.css</span></
5454
<col class="field-name" />
5555
<col class="field-body" />
5656
<tbody valign="top">
57-
<tr class="field"><th class="field-name">Version:</th><td class="field-body">$Id: css.txt 1609 2009-01-03 21:07:17Z cthedot $</td>
57+
<tr class="field"><th class="field-name">Version:</th><td class="field-body">$Id: css.txt 1624 2009-01-03 21:47:53Z cthedot $</td>
5858
</tr>
5959
</tbody>
6060
</table>
@@ -1376,6 +1376,37 @@ <h3>CSSStyleDeclaration<a class="headerlink" href="#cssstyledeclaration" title="
13761376

13771377
</dd></dl>
13781378

1379+
<p>The official DOM provides no method to obtain all values set for a property. Cssutils from 0.9.4 implements the additional method <a title="cssutils.css.CSSStyleDeclaration.getProperties" class="reference internal" href="#cssutils.css.CSSStyleDeclaration.getProperties"><tt class="xref docutils literal"><span class="pre">getProperties()</span></tt></a>, example:</p>
1380+
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">cssText</span> <span class="o">=</span> <span class="s">&#39;&#39;&#39;background: white url(paper.png) scroll; /* for all UAs */</span>
1381+
<span class="gp">... </span><span class="s">background: white url(ledger.png) fixed; /* for UAs that do fixed backgrounds */</span>
1382+
<span class="gp">... </span><span class="s">&#39;&#39;&#39;</span>
1383+
<span class="gp">&gt;&gt;&gt; </span><span class="c"># omit comments for this example</span>
1384+
<span class="gp">&gt;&gt;&gt; </span><span class="n">cssutils</span><span class="o">.</span><span class="n">ser</span><span class="o">.</span><span class="n">prefs</span><span class="o">.</span><span class="n">keepComments</span> <span class="o">=</span> <span class="bp">False</span>
1385+
<span class="gp">&gt;&gt;&gt; </span><span class="n">style</span> <span class="o">=</span> <span class="n">cssutils</span><span class="o">.</span><span class="n">css</span><span class="o">.</span><span class="n">CSSStyleDeclaration</span><span class="p">(</span><span class="n">cssText</span><span class="o">=</span><span class="n">cssText</span><span class="p">)</span>
1386+
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">style</span><span class="o">.</span><span class="n">cssText</span>
1387+
<span class="go">background: white url(paper.png) scroll;</span>
1388+
<span class="go">background: white url(ledger.png) fixed;</span>
1389+
<span class="gp">&gt;&gt;&gt; </span><span class="c"># work with properties:</span>
1390+
<span class="gp">&gt;&gt;&gt; </span><span class="n">proplist</span> <span class="o">=</span> <span class="n">style</span><span class="o">.</span><span class="n">getProperties</span><span class="p">(</span><span class="s">&#39;background&#39;</span><span class="p">,</span> <span class="n">all</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
1391+
<span class="gp">&gt;&gt;&gt; </span><span class="n">proplist</span>
1392+
<span class="go">[cssutils.css.Property(name=&#39;background&#39;, value=u&#39;white url(paper.png) scroll&#39;, priority=u&#39;&#39;), cssutils.css.Property(name=&#39;background&#39;, value=u&#39;white url(ledger.png) fixed&#39;, priority=u&#39;&#39;)]</span>
1393+
<span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">prop</span> <span class="ow">in</span> <span class="n">proplist</span><span class="p">:</span> <span class="k">print</span> <span class="n">prop</span><span class="o">.</span><span class="n">value</span>
1394+
<span class="go">white url(paper.png) scroll</span>
1395+
<span class="go">white url(ledger.png) fixed</span>
1396+
<span class="gp">&gt;&gt;&gt; </span><span class="c"># overwrite the current property, to overwrite all iterate over proplist</span>
1397+
<span class="gp">&gt;&gt;&gt; </span><span class="n">style</span><span class="p">[</span><span class="s">&#39;background&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;red&#39;</span><span class="p">,</span> <span class="s">&#39;!important&#39;</span><span class="p">)</span>
1398+
<span class="gp">&gt;&gt;&gt; </span><span class="c"># importance in DOM ist &#39;important&#39; but &#39;!important&#39; works too</span>
1399+
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">style</span><span class="p">[</span><span class="s">&#39;background&#39;</span><span class="p">],</span> <span class="n">style</span><span class="o">.</span><span class="n">getPropertyPriority</span><span class="p">(</span><span class="s">&#39;background&#39;</span><span class="p">)</span>
1400+
<span class="go">red important</span>
1401+
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">style</span><span class="o">.</span><span class="n">cssText</span>
1402+
<span class="go">background: white url(paper.png) scroll;</span>
1403+
<span class="go">background: red !important;</span>
1404+
<span class="gp">&gt;&gt;&gt; </span><span class="c"># output only &quot;effective&quot; properties</span>
1405+
<span class="gp">&gt;&gt;&gt; </span><span class="n">cssutils</span><span class="o">.</span><span class="n">ser</span><span class="o">.</span><span class="n">prefs</span><span class="o">.</span><span class="n">keepAllProperties</span> <span class="o">=</span> <span class="bp">False</span>
1406+
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">style</span><span class="o">.</span><span class="n">cssText</span>
1407+
<span class="go">background: red !important;</span>
1408+
</pre></div>
1409+
</div>
13791410
</div>
13801411
<div class="section" id="property">
13811412
<h3>Property<a class="headerlink" href="#property" title="Permalink to this headline"></a></h3>
@@ -1773,7 +1804,7 @@ <h3><a href="../index.html">Table Of Contents</a></h3>
17731804
<h4>Previous topic</h4>
17741805
<p class="topless"><a href="serialize.html" title="previous chapter">serializing CSS</a></p>
17751806
<h4>Next topic</h4>
1776-
<p class="topless"><a href="stylesheets.html" title="next chapter">package <tt class="docutils literal"><span class="pre">cssutils.stylesheets</span></tt></a></p>
1807+
<p class="topless"><a href="stylesheets.html" title="next chapter">package <tt class="docutils literal docutils literal"><span class="pre">cssutils.stylesheets</span></tt></a></p>
17771808
<h3>This Page</h3>
17781809
<ul class="this-page-menu">
17791810
<li><a href="../_sources/docs/css.txt">Show Source</a></li>

0 commit comments

Comments
 (0)