Skip to content

Commit 2581075

Browse files
authored
Merge pull request #138 from Gallaecio/documentation-introduction
Improve the README.rst file
2 parents 8d6feb4 + 4c3d914 commit 2581075

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

README.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
===============================
1+
======
22
Parsel
3-
===============================
3+
======
44

55
.. image:: https://img.shields.io/travis/scrapy/parsel/master.svg
66
:target: https://travis-ci.org/scrapy/parsel
@@ -15,22 +15,18 @@ Parsel
1515
:alt: Coverage report
1616

1717

18-
Parsel is a library to extract data from HTML and XML using XPath and CSS selectors
18+
Parsel is a BSD-licensed Python_ library to extract and remove data from HTML_
19+
and XML_ using XPath_ and CSS_ selectors, optionally combined with
20+
`regular expressions`_.
1921

20-
* Free software: BSD license
21-
* Documentation: https://parsel.readthedocs.org.
22+
Find the Parsel online documentation at https://parsel.readthedocs.org.
2223

23-
Features
24-
--------
24+
Example (`open online demo`_):
2525

26-
* Extract text using CSS or XPath selectors
27-
* Remove elements using CSS or XPath selectors
28-
* Regular expression helper methods
29-
30-
Example (`open online demo`_)::
26+
.. code-block:: python
3127
3228
>>> from parsel import Selector
33-
>>> sel = Selector(text=u"""<html>
29+
>>> selector = Selector(text=u"""<html>
3430
<body>
3531
<h1>Hello, Parsel!</h1>
3632
<ul>
@@ -39,16 +35,20 @@ Example (`open online demo`_)::
3935
</ul>
4036
</body>
4137
</html>""")
42-
>>>
43-
>>> sel.css('h1::text').get()
38+
>>> selector.css('h1::text').get()
4439
'Hello, Parsel!'
45-
>>>
46-
>>> sel.css('h1::text').re('\w+')
40+
>>> selector.xpath('//h1/text()').re(r'\w+')
4741
['Hello', 'Parsel']
48-
>>>
49-
>>> for e in sel.css('ul > li'):
50-
... print(e.xpath('.//a/@href').get())
42+
>>> for li in selector.css('ul > li'):
43+
... print(li.xpath('.//@href').get())
5144
http://example.com
5245
http://scrapy.org
5346
54-
.. _open online demo: https://colab.research.google.com/drive/149VFa6Px3wg7S3SEnUqk--TyBrKplxCN#forceEdit=true&sandboxMode=true
47+
48+
.. _CSS: https://en.wikipedia.org/wiki/Cascading_Style_Sheets
49+
.. _HTML: https://en.wikipedia.org/wiki/HTML
50+
.. _open online demo: https://colab.research.google.com/drive/149VFa6Px3wg7S3SEnUqk--TyBrKplxCN#forceEdit=true&sandboxMode=true
51+
.. _Python: https://www.python.org/
52+
.. _regular expressions: https://docs.python.org/library/re.html
53+
.. _XML: https://en.wikipedia.org/wiki/XML
54+
.. _XPath: https://en.wikipedia.org/wiki/XPath

0 commit comments

Comments
 (0)