Permalink
Browse files

Added documentation page for CSS selectors.

Man pages now moved to section 7.

Added zombie.version.
  • Loading branch information...
1 parent f4800b4 commit 92ab43455e334acac2b7ab9b55a42da487e0ca20 @assaf committed Dec 28, 2010
Showing with 159 additions and 47 deletions.
  1. +1 −1 .gitignore
  2. +11 −1 CHANGELOG.md
  3. +29 −27 Cakefile
  4. +3 −14 README.md
  5. +1 −1 TODO.md
  6. +1 −0 doc/_layout.html
  7. +103 −0 doc/selectors.md
  8. +2 −2 doc/troubleshoot.md
  9. +1 −1 package.json
  10. +7 −0 src/index.coffee
View
@@ -2,5 +2,5 @@
clean
html
lib
-man1
+man7
node_modules
View
@@ -1,8 +1,18 @@
-zombie.js changelog(1) -- Changelog
+zombie.js-changelog(1) -- Changelog
===================================
## Version 0.7.5 2010-12-28
+Added documentation page for CSS selectors.
+
+Man pages now moved to section 7.
+
+Added zombie.version.
+
+
+
+## Version 0.7.5 2010-12-28
+
Previous fix for document.write was incomplete, this one works better.
189 Tests
View
@@ -52,7 +52,7 @@ task "watch", "Continously compile CoffeeScript to JavaScript", ->
task "clean", "Remove temporary files and such", ->
- exec "rm -rf html lib man1", onerror
+ exec "rm -rf html lib man7", onerror
## Testing ##
@@ -71,34 +71,37 @@ task "test", "Run all tests", -> runTests onerror
# Markdown to HTML.
toHTML = (source, callback)->
target = "html/#{path.basename(source, ".md").toLowerCase()}.html"
- fs.mkdir "html", 0777, ->
- fs.readFile "doc/_layout.html", "utf8", (err, layout)->
+ fs.readFile "doc/_layout.html", "utf8", (err, layout)->
+ onerror err
+ fs.readFile source, "utf8", (err, text)->
onerror err
- fs.readFile source, "utf8", (err, text)->
+ log "Creating #{target}", green
+ exec "ronn --html #{source}", (err, stdout, stderr)->
onerror err
- log "Creating #{target}", green
- exec "ronn --html #{source}", (err, stdout, stderr)->
- onerror err
- [name, title] = stdout.match(/<h1>(.*)<\/h1>/)[1].split(" -- ")
- name = name.replace(/\(\d\)/, "")
- body = stdout.replace(/<h1>.*<\/h1>/, "")
- html = layout.replace("{{body}}", body).replace(/{{title}}/g, title)
- fs.writeFile target, html, "utf8", (err)->
- callback err, target
+ [name, title] = stdout.match(/<h1>(.*)<\/h1>/)[1].split(" -- ")
+ name = name.replace(/\(\d\)/, "")
+ body = stdout.replace(/<h1>.*<\/h1>/, "")
+ html = layout.replace("{{body}}", body).replace(/{{title}}/g, title)
+ fs.writeFile target, html, "utf8", (err)->
+ callback err, target
documentPages = (callback)->
files = fs.readdirSync(".").filter((file)-> path.extname(file) == ".md").
concat(fs.readdirSync("doc").filter((file)-> path.extname(file) == ".md").map((file)-> "doc/#{file}"))
- convert = ->
- if file = files.pop()
- toHTML file, (err)->
- onerror err
- convert()
- else
- process.stdout.write "\n"
- exec "mv html/readme.html html/index.html", onerror
- exec "cp -f doc/*.css html/", callback
- convert()
+ fs.mkdir "html", 0777, ->
+ convert = ->
+ if file = files.pop()
+ toHTML file, (err)->
+ onerror err
+ convert()
+ else
+ process.stdout.write "\n"
+ fs.readFile "html/readme.html", "utf8", (err, html)->
+ html = html.replace(/<h1>(.*)<\/h1>/, "<h1>Zombie.js</h1><b>$1</b>")
+ fs.writeFile "html/index.html", html, "utf8", onerror
+ fs.unlink "html/readme.html", onerror
+ exec "cp -f doc/*.css html/", callback
+ convert()
documentSource = (callback)->
log "Documenting source files ...", green
@@ -111,19 +114,18 @@ documentSource = (callback)->
generateMan = (callback)->
files = fs.readdirSync(".").filter((file)-> path.extname(file) == ".md").
concat(fs.readdirSync("doc").filter((file)-> path.extname(file) == ".md").map((file)-> "doc/#{file}"))
- fs.mkdir "man1", 0777, (err)->
- onerror err
+ fs.mkdir "man7", 0777, (err)->
log "Generating man file ...", green
convert = ->
if file = files.pop()
- target = "man1/#{path.basename(file, ".md").toLowerCase()}.1"
+ target = "man7/#{path.basename(file, ".md").toLowerCase()}.7"
exec "ronn --roff #{file}", (err, stdout, stderr)->
onerror err
log "Creating #{target}", green
fs.writeFile target, stdout, "utf8", callback
convert()
else
- exec "mv man1/readme.1 man1/zombie.1", onerror
+ exec "mv man7/readme.7 man7/zombie.7", onerror
process.stdout.write "\n"
convert()
View
@@ -1,7 +1,6 @@
-zombie.js(1) -- Zombie.js
-=========================
+zombie.js(1) -- Insanely fast, headless full-stack testing using Node.js
+========================================================================
-**Insanely fast, headless full-stack testing using Node.js**
## The Bite
@@ -439,14 +438,4 @@ Zombie.js is written in
## See Also
-zombie-troubleshoot
-
-[Troubleshooting](troubleshoot.html)
-
-[Changelog](changelog.html)
-
-[DOM API](http://www.w3.org/DOM/DOMTR)
-
-[Sizzle.js](http://sizzlejs.com/)
-
-[Vows](http://vowsjs.org/)
+**zombie-troublshooting**(7), **zombie-selectors**(7), **zombie-changelog**(7), **zombie-todo**(7)
View
@@ -1,4 +1,4 @@
-zombie.js todo(1) -- Wishlist
+zombie.js-todo(1) -- Wishlist
=============================
* Navigation: Browser.open/close should work as a pair; look into supporting
View
@@ -10,6 +10,7 @@
<div class="title"><a href="/">Zombie.js</a></div>
<ul class="navigation">
<li><a href="/">Getting Started</a></li>
+ <li><a href="/selectors.html">CSS Selectors</a></li>
<li><a href="/troubleshoot.html">Troubleshooting</a></li>
<li><a href="/changelog.html">Changelog</a></li>
<li><a href="/todo.html">Todo</a></li>
View
@@ -0,0 +1,103 @@
+zombie.js-selectors(1) -- CSS Selectors
+=======================================
+
+
+Zombie.js uses [Sizzle.js](https://github.com/jeresig/sizzle/wiki) which
+provides support for most [CSS 3
+selectors](http://www.w3.org/TR/css3-selectors/) with a few useful
+extension. The following list summarizes which selectors are currently
+supported:
+
+
+`*` Any element
+
+`E` An element of type E
+
+`E#myid` An E element with ID equal to "myid"
+
+`E.foo` An E element whose class is "foo"
+
+`E[foo]` An E element with a "foo" attribute
+
+`E[foo="bar"]` An E element whose "foo" attribute value is exactly equal to "bar"
+
+`E[foo!="bar"]` An E element whose "foo" attribute value does not equal to "bar"
+
+`E[foo~="bar"]` An E element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar"
+
+`E[foo^="bar"]` An E element whose "foo" attribute value begins exactly with the string "bar"
+
+`E[foo$="bar"]` An E element whose "foo" attribute value ends exactly with the string "bar"
+
+`E[foo*="bar"]` An E element whose "foo" attribute value contains the substring "bar"
+
+`E[foo|="en"]` An E element whose "foo" attribute has a hyphen-separated list of values beginning (from the left) with "en"
+
+`E:nth-child(n)` An E element, the n-th child of its parent
+
+`E:first-child` An E element, first child of its parent
+
+`E:last-child` An E element, last child of its parent
+
+`E:only-child` An E element, only child of its parent
+
+`E:empty` An E element that has no children (including text nodes)
+
+`E:link` A link
+
+`E:focus` An E element during certain user actions
+
+`E:enabled` A user interface element E which is enabled
+
+`E:disabled` A user interface element E which is disabled
+
+`E:checked` A user interface element E which is checked (for instance a radio-button or checkbox)
+
+`E:input` An E element that is an input element (includes `textarea`, `select` and `button`)
+
+`E:text` An E element that is an input text field or text area
+
+`E:checkbox` An E element that is an input checkbox
+
+`E:file` An E element that is an input file
+
+`E:password` An E element that is an input password
+
+`E:submit` An E element that is an input or button of type `submit`
+
+`E:image` An E element that is an input of type `image`
+
+`E:button` An E element that is an input or button of type `button`
+
+`E:reset` An E element that is an input or button of type `reset`
+
+`E:header` An header element, one of h1, h2, h3, h4, h5, h6
+
+`E:parent` A parent element, an element that contains another element
+
+`E:not(s)` An E element that does not match the selector `s` (multiple selectors supported)
+
+`E:contains(t)` An E element whose textual contents contains `t` (case sensitive)
+
+`E:first` An E element whose position on the page is first in document order
+
+`E:last` An E element whose position on the page is last in document order
+
+`E:even` An E element whose position on the page is even numbered (counting starts at 0)
+
+`E:odd` An E element whose position on the page is odd numbered (counting starts at 0)
+
+`E:eq(n)/:nth(n)` An E element whose Nth element on the page (e.g `:eq(5)`)
+
+`E:lt(n)` An E element whose position on the page is less than `n`
+
+`E:gt(n)` An E element whose position on the page is less than `n`
+
+`E F` An F element descendant of an E element
+
+`E > F` An F element child of an E element
+
+`E + F` An F element immediately preceded by an E element
+
+`E ~ F` An F element preceded by an E element
+
View
@@ -1,5 +1,5 @@
-zombie.js troubleshoot(1) -- Troubleshooting
-============================================
+zombie.js-troubleshoot(1) -- Troubleshooting guide
+==================================================
## The Dump
View
@@ -13,7 +13,7 @@
"directories": {
"doc": "./doc",
"lib": "./lib",
- "man": "./man1"
+ "man": "./man7"
},
"scripts": {
"build": "cake",
View
@@ -24,3 +24,10 @@ exports.visit = (url, callback)->
browser = new exports.Browser
browser.visit url, callback
return
+
+# ### zombie.version : String
+try
+ exports.package = JSON.parse(require("fs").readFileSync("package.json"))
+ exports.version = exports.package.version
+catch err
+ console.log err

0 comments on commit 92ab434

Please sign in to comment.