Gael Pasgrimaud avatar Gael Pasgrimaud committed 21dcbe0

fix docs

Comments (0)

Files changed (8)

 develop-eggs/
 bin/
 dist/
-docs/.build/
+docs/_build/
 .installed.cfg
 *.egg-info
 *.pyc
 newest = false
 parts = eggs docs
 develop = .
+
 [eggs]
 recipe = zc.recipe.egg
 eggs =
     nose
 scripts =
     nosetests=test
-interpreter = python
     
 [docs]
 recipe = zc.recipe.egg
     ${eggs:eggs}
     Pygments
     Sphinx
-scripts=
-    sphinx-build=sphinx-build
+    sphinx-pypi-upload
+interpreter = python
 
 
 # Internal variables.
 PAPEROPT_a4     = -D latex_paper_size=a4
 PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS   = -d .build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+ALLSPHINXOPTS   = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
 
 .PHONY: help clean html web pickle htmlhelp latex changes linkcheck
 
 	@echo "  linkcheck to check all external links for integrity"
 
 clean:
-	-rm -rf .build/*
+	-rm -rf _build/*
 
 html:
-	mkdir -p .build/html .build/doctrees
-	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) .build/html
+	mkdir -p _build/html _build/doctrees
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
 	@echo
-	@echo "Build finished. The HTML pages are in .build/html."
+	@echo "Build finished. The HTML pages are in _build/html."
 
 open: html
-	open .build/html/index.html
+	open _build/html/index.html
 
 pickle:
-	mkdir -p .build/pickle .build/doctrees
-	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) .build/pickle
+	mkdir -p _build/pickle _build/doctrees
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
 	@echo
 	@echo "Build finished; now you can process the pickle files."
 
 web: pickle
 
 json:
-	mkdir -p .build/json .build/doctrees
-	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) .build/json
+	mkdir -p _build/json _build/doctrees
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
 	@echo
 	@echo "Build finished; now you can process the JSON files."
 
 htmlhelp:
-	mkdir -p .build/htmlhelp .build/doctrees
-	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) .build/htmlhelp
+	mkdir -p _build/htmlhelp _build/doctrees
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
 	@echo
 	@echo "Build finished; now you can run HTML Help Workshop with the" \
-	      ".hhp project file in .build/htmlhelp."
+	      ".hhp project file in _build/htmlhelp."
 
 latex:
-	mkdir -p .build/latex .build/doctrees
-	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) .build/latex
+	mkdir -p _build/latex _build/doctrees
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
 	@echo
-	@echo "Build finished; the LaTeX files are in .build/latex."
+	@echo "Build finished; the LaTeX files are in _build/latex."
 	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
 	      "run these through (pdf)latex."
 
 changes:
-	mkdir -p .build/changes .build/doctrees
-	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) .build/changes
+	mkdir -p _build/changes _build/doctrees
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
 	@echo
-	@echo "The overview file is in .build/changes."
+	@echo "The overview file is in _build/changes."
 
 linkcheck:
-	mkdir -p .build/linkcheck .build/doctrees
-	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) .build/linkcheck
+	mkdir -p _build/linkcheck _build/doctrees
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
 	@echo
 	@echo "Link check complete; look for any errors in the above output " \
-	      "or in .build/linkcheck/output.txt."
+	      "or in _build/linkcheck/output.txt."
 :mod:`~pyquery.pyquery` -- PyQuery complete API
-==============================================
+================================================
 
 .. automodule:: pyquery.pyquery
 
 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest']
 
 # Add any paths that contain templates here, relative to this directory.
-templates_path = ['.templates']
+templates_path = ['_templates']
 
 # The suffix of source filenames.
 source_suffix = '.txt'
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['.static']
+html_static_path = ['_static']
 
 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
 # using the given strftime format.
 
 # If false, no module index is generated.
 #latex_use_modindex = True
+
+# Custom stuff
+
+from os import path
+pkg_dir = path.abspath(__file__).split('/docs')[0]
+setup = path.join(pkg_dir, 'setup.py')
+if path.isfile(setup):
+    for line_ in open(setup):
+        if line_.startswith("version"):
+            version = line_.split('=')[-1]
+            version = version.strip()
+            version = version.strip("'\"")
+            release = version
+            break
+del pkg_dir, setup, path
+

pyquery/pyquery.py

         return self.__class__([e for e in self if e not in exclude], **dict(parent=self))
 
     def is_(self, selector):
-        """Returns True if selector matches at least one current element, else False.
+        """Returns True if selector matches at least one current element, else False::
+
             >>> d = PyQuery('<p class="hello">Hi</p><p>Bye</p><div></div>')
             >>> d('p').eq(0).is_('.hello')
             True
+
             >>> d('p').eq(1).is_('.hello')
             False
+
+        ..
         """
         return bool(self.__class__(selector, self))
 
     def find(self, selector):
-        """Find elements using selector traversing down from self.
+        """Find elements using selector traversing down from self::
 
             >>> m = '<p><span><em>Whoah!</em></span></p><p><em> there</em></p>'
             >>> d = PyQuery(m)
             [<em>, <em>]
             >>> d('p').eq(1).find('em')
             [<em>]
+
+        ..
         """
         xpath = selector_to_xpath(selector)
         results = [child.xpath(xpath) for tag in self for child in tag.getchildren()]
         return self.__class__(elements, **dict(parent=self))
 
     def eq(self, index):
-        """Return PyQuery of only the element with the provided index.
+        """Return PyQuery of only the element with the provided index::
 
             >>> d = PyQuery('<p class="hello">Hi</p><p>Bye</p><div></div>')
             >>> d('p').eq(0)
             [<p>]
             >>> d('p').eq(2)
             []
+
+        ..
         """
         # Use slicing to silently handle out of bounds indexes
         items = self[index:index+1]
         """Returns a new PyQuery after transforming current items with func.
 
         func should take two arguments - 'index' and 'element'.  Elements can
-        also be referred to as 'this' inside of func.
+        also be referred to as 'this' inside of func::
 
             >>> d = PyQuery('<p class="hello">Hi there</p><p>Bye</p><br />')
             >>> d('p').map(lambda i, e: PyQuery(e).text())
             >>> d('p').map(lambda i, e: PyQuery(this).text().split())
             ['Hi', 'there', 'Bye']
 
-            Added this
-
-
         """
         items = []
         try:
             >>> d.removeAttr('id')
             [<div>]
 
+        ..
         """
         for tag in self:
             del tag.attrib[name]
             >>> d.hasClass('myclass')
             True
 
+        ..
         """
         return self.is_('.%s' % name)
 
             >>> d.addClass('myclass')
             [<div.myclass>]
 
+        ..
         """
         for tag in self:
             values = value.split(' ')
         return self
 
     def removeClass(self, value):
-        """Remove a css class to elements
+        """Remove a css class to elements::
 
             >>> d = PyQuery('<div class="myclass"></div>')
             >>> d.removeClass('myclass')
             [<div>]
 
+        ..
         """
         for tag in self:
             values = value.split(' ')
     # CORE UI EFFECTS #
     ###################
     def hide(self):
-        """add display:none to elements style
+        """remove display:none to elements style
+
+            >>> print PyQuery('<div style="display:none;"/>').hide()
+            <div style="display: none"/>
+
         """
         return self.css('display', 'none')
 
     def show(self):
         """add display:block to elements style
+
+            >>> print PyQuery('<div />').show()
+            <div style="display: block"/>
+
         """
         return self.css('display', 'block')
 
     # HTML #
     ########
     def val(self, value=no_default):
-        """Set/get the attribute value::
+        """Set the attribute value::
 
             >>> d = PyQuery('<input />')
             >>> d.val('Youhou')
             [<input>]
+
+        Get the attribute value::
+
             >>> d.val()
             'Youhou'
 
         return self
 
     def outerHtml(self):
-        """Get the html representation of the first selected element.
+        """Get the html representation of the first selected element::
 
             >>> d = PyQuery('<div><span class="red">toto</span> rocks</div>')
             >>> print d('span')
             >>> S = PyQuery('<p>Only <b>me</b> & myself</p>')
             >>> S('b').outerHtml()
             '<b>me</b>'
+
+        ..
         """
 
         if not self:
             >>> print d('span').wrapAll('<div id="wrapper"></div>')
             <div id="wrapper"><span>Hey</span><span>you !</span></div>
 
+        ..
         """
         if not self:
             return self
         return self
 
     class Fn(object):
-        """Hook for defining custom funcion (like the jQuery.fn)
+        """Hook for defining custom function (like the jQuery.fn)
 
         >>> PyQuery.fn.listOuterHtml = lambda: this.map(lambda i, el: PyQuery(this).outerHtml())
         >>> S = PyQuery('<ol>   <li>Coffee</li>   <li>Tea</li>   <li>Milk</li>   </ol>')
 [nosetests]
 with-doctest=true
 verbosity=3
+
+[aliases]
+sphinx = build_sphinx
+release = sdist --formats=zip,gztar register upload build_sphinx upload_sphinx
+
+[build_sphinx]
+source-dir = docs/
+build-dir  = docs/_build
+all_files  = 1
+
+[upload_sphinx]
+upload-dir = docs/_build/html
       include_package_data=True,
       zip_safe=False,
       install_requires=[
-          #'lxml>=2.1'
+          'lxml>=2.1'
           # -*- Extra requirements: -*-
       ],
       entry_points="""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.