veganstraightedge-htmldog 1.0.0.200903121450

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2008-11-08
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
data/Manifest.txt ADDED
@@ -0,0 +1,6 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/htmldog
6
+ lib/htmldog.rb
data/README.txt ADDED
@@ -0,0 +1,41 @@
1
+ = htmldog
2
+
3
+ * http://theresistancearmy.com/gems/htmldog
4
+ * http://rubyforge.org/projects/htmldog
5
+
6
+ == DESCRIPTION:
7
+
8
+ * A command line tool for html tag / css property documentation using htmldog.com as the data source.
9
+
10
+ == FEATURES/PROBLEMS:
11
+
12
+ * Fetches documentation including for html tags and css properties from htmldog.com.
13
+
14
+ == SYNOPSIS:
15
+
16
+ htmldog img
17
+
18
+ Image.
19
+ Note: When an image is used as a link, many browsers will show a border around the image. To get rid of this you should use CSS (border: 0).
20
+ Required Attributes
21
+ * src is used to specify the location of the image file.
22
+ * alt is used to specify the alternative text of the image, which should be a short description.
23
+ Optional Attributes
24
+ * longdesc can be used to specify the location (in the form of a URI) of a description of the image.
25
+ * height can be used to define the height of the image (in pixels). This can also be done with CSS.
26
+ * width can be used to define the width of the image (in pixels). This can also be done with CSS.
27
+ Example
28
+
29
+ <img src="http://www.htmldog.com/images/logo.gif" alt="HTML Dog" />
30
+
31
+ == REQUIREMENTS:
32
+
33
+ * rubygems, hpricot
34
+
35
+ == INSTALL:
36
+
37
+ * sudo gem install htmldog
38
+
39
+ == LICENSE:
40
+
41
+ Public Domain. Free as the air you breathe. Do whatever you want. No warranty given.
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require './lib/htmldog.rb'
6
+
7
+ HOE = Hoe.new('htmldog', Htmldog::VERSION) do |p|
8
+ p.rubyforge_name = 'htmldog'
9
+ p.developer('shane becker', 'veganstraightedge@gmail.com')
10
+ p.remote_rdoc_dir = '' # Release to root
11
+ end
12
+
13
+ namespace :gem do
14
+ task :spec do
15
+ File.open("#{HOE.name}.gemspec", 'w') do |f|
16
+ HOE.spec.version = "#{HOE.version}.#{Time.now.strftime("%Y%m%d%H%M%S")}"
17
+ f.write(HOE.spec.to_ruby)
18
+ end
19
+ end
20
+ end
data/bin/htmldog ADDED
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'hpricot'
5
+ require 'open-uri'
6
+ require 'htmldog'
7
+
8
+ include Htmldog
9
+
10
+ # checks for at least one arg
11
+ if ARGV.size.zero?
12
+ puts <<-END_OF_STRING
13
+
14
+ Example Usage: h float
15
+ where "float" is a CSS property,
16
+ or it can be an HTML tag like "div".
17
+ Only one search item at a time (for now).
18
+
19
+ END_OF_STRING
20
+ exit 1
21
+ end
22
+
23
+ # deals with namespacing based on the q arg
24
+ q = ARGV.shift
25
+ if HTML_TAGS.include?(q)
26
+ name_space = "htmltags"
27
+ elsif CSS_PROPERTIES.include?(q)
28
+ name_space = "cssproperties"
29
+ else
30
+ puts <<-END_OF_STRING
31
+ #{q}: No results found.
32
+ Maybe you mispelled it or it doesn't exist.
33
+ htmldog.com is used as the data source,
34
+ so if they don't have it, I can't find it.
35
+
36
+ END_OF_STRING
37
+ exit 1
38
+ end
39
+
40
+ # is the q one of the headings?
41
+ # on htmldog.com all of the h1-h6 tags are on one page
42
+ # h1h2h3h4h5h6
43
+ q = HEADINGS_URL if HEADINGS.include?(q)
44
+
45
+ # gets htmldog.com page for q tag or property
46
+ doc = Hpricot(open("http://htmldog.com/reference/#{name_space}/#{q}/"))
47
+
48
+ # chews up the html and prepares slimmed down version
49
+ intro = (doc/"#intro")
50
+ antiintro = (doc/"#ai2").inner_html
51
+
52
+ # header output
53
+ (intro/:p).each do |p|
54
+ puts p.inner_text
55
+ end
56
+
57
+ # possible values/attributes
58
+ title = (doc/"#c1").inner_html
59
+ h2s = (doc/"div[@id=ai2]/h2")
60
+ uls = (doc/"div[@id=ai2]/ul")
61
+ example = (doc/"div[@id=ai2]/pre/code")
62
+
63
+ h2s.zip(uls).each do |h2, ul|
64
+ puts h2.inner_text
65
+
66
+ if ul
67
+ ul.search("/li").each do |li|
68
+ puts " * #{li.inner_text}" unless li.inner_text == "Common attributes"
69
+ end
70
+ else
71
+ puts example.first.inner_text
72
+ end
73
+ end
data/lib/htmldog.rb ADDED
@@ -0,0 +1,10 @@
1
+ module Htmldog
2
+ VERSION = '1.0.0'
3
+
4
+ HTML_TAGS = %w[a abbr acronym address area b base bdo big blockquote body br button caption cite code col colgroup dd del dfn div dl DOCTYPE dt em fieldset form h1 h2 h3 h4 h5 h6 head html hr i img input ins kbd label legend li link map meta noscript object ol optgroup option p param pre q samp script select small span strong style sub sup table tbody td textarea tfoot th thead title tr tt ul var]
5
+
6
+ HEADINGS = %w[h1 h2 h3 h4 h5 h6]
7
+ HEADINGS_URL = "h1h2h3h4h5h6"
8
+
9
+ CSS_PROPERTIES = %w[background background-attachment background-color background-image background-position background-repeat border border-collapse border-color border-spacing border-style border-width bottom caption-side clear clip color content counter-increment counter-reset cursor direction display empty-cells float font font-family font-size font-style font-variant font-weight height left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin max-height max-width min-height min-width orphans outline outline-color outline-style outline-width overflow padding page-break-after page-break-before page-break-inside position quotes right table-layout text-align text-decoration text-indent text-transform top unicode-bidi vertical-align visibility white-space widows width word-spacing z-index]
10
+ end
File without changes
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: veganstraightedge-htmldog
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.200903121450
5
+ platform: ruby
6
+ authors:
7
+ - shane becker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-08 00:00:00 -08:00
13
+ default_executable: htmldog
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.2
24
+ version:
25
+ description: "* A command line tool for html tag / css property documentation using htmldog.com as the data source."
26
+ email:
27
+ - veganstraightedge@gmail.com
28
+ executables:
29
+ - htmldog
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - History.txt
34
+ - Manifest.txt
35
+ - README.txt
36
+ files:
37
+ - History.txt
38
+ - Manifest.txt
39
+ - README.txt
40
+ - Rakefile
41
+ - bin/htmldog
42
+ - lib/htmldog.rb
43
+ - test/test_htmldog.rb
44
+ has_rdoc: true
45
+ homepage: http://theresistancearmy.com/gems/htmldog
46
+ post_install_message:
47
+ rdoc_options:
48
+ - --main
49
+ - README.txt
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ requirements: []
65
+
66
+ rubyforge_project: htmldog
67
+ rubygems_version: 1.2.0
68
+ signing_key:
69
+ specification_version: 2
70
+ summary: "* A command line tool for html tag / css property documentation using htmldog.com as the data source."
71
+ test_files:
72
+ - test/test_htmldog.rb