tdreyno-staticmatic 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. data/bin/staticmatic +2 -14
  2. data/lib/staticmatic/actionpack_support/remove_controller_caching.rb +7 -0
  3. data/lib/staticmatic/autoload.rb +16 -14
  4. data/lib/staticmatic/base.rb +97 -126
  5. data/lib/staticmatic/builder.rb +64 -86
  6. data/lib/staticmatic/config.rb +31 -37
  7. data/lib/staticmatic/previewer.rb +16 -28
  8. data/lib/staticmatic/template_handlers/haml.rb +6 -10
  9. data/lib/staticmatic/template_handlers/liquid.rb +3 -7
  10. data/lib/staticmatic/template_handlers/markdown.rb +3 -7
  11. data/lib/staticmatic/template_handlers/sass.rb +3 -7
  12. data/lib/staticmatic/template_handlers/textile.rb +3 -7
  13. data/lib/staticmatic.rb +16 -12
  14. data/lib/templates/script/builder +6 -0
  15. data/lib/templates/script/server +4 -0
  16. data/spec/action_view_helpers_spec.rb +12 -0
  17. data/spec/asset_helpers_spec.rb +22 -0
  18. data/spec/base_spec.rb +42 -0
  19. data/spec/builder_spec.rb +44 -0
  20. data/spec/config_spec.rb +31 -0
  21. data/spec/deprecation_spec.rb +18 -0
  22. data/spec/fixtures/sample/Rakefile +4 -0
  23. data/spec/fixtures/sample/build/haml_test.html +11 -0
  24. data/spec/fixtures/sample/build/hello_world.html +9 -0
  25. data/spec/fixtures/sample/build/index.html +9 -0
  26. data/spec/fixtures/sample/build/page_with_error.html +61 -0
  27. data/spec/fixtures/sample/build/services/index.html +9 -0
  28. data/spec/fixtures/sample/build/services/web_development.html +9 -0
  29. data/spec/fixtures/sample/build/stylesheets/site.css +3 -0
  30. data/spec/fixtures/sample/config.rb +3 -0
  31. data/spec/fixtures/sample/src/helpers/speech_helper.rb +5 -0
  32. data/spec/fixtures/sample/src/layouts/site.html.erb +9 -0
  33. data/spec/fixtures/sample/src/layouts/specified_layout.html.erb +3 -0
  34. data/spec/fixtures/sample/src/pages/_form.html.erb +1 -0
  35. data/spec/fixtures/sample/src/pages/haml_test.html.haml +3 -0
  36. data/spec/fixtures/sample/src/pages/hello_world.html.erb +1 -0
  37. data/spec/fixtures/sample/src/pages/index.html.erb +1 -0
  38. data/spec/fixtures/sample/src/pages/liquid_test.html.liquid +3 -0
  39. data/spec/fixtures/sample/src/pages/markdown_test.html.markdown +3 -0
  40. data/spec/fixtures/sample/src/pages/page_with_error.html.haml +3 -0
  41. data/spec/fixtures/sample/src/pages/services/index.html.erb +1 -0
  42. data/spec/fixtures/sample/src/pages/services/web_development.html.erb +1 -0
  43. data/spec/fixtures/sample/src/pages/specify_layout.html.erb +1 -0
  44. data/spec/fixtures/sample/src/pages/textile_test.html.textile +3 -0
  45. data/spec/fixtures/sample/src/stylesheets/site.css.sass +3 -0
  46. data/spec/layouts_spec.rb +29 -0
  47. data/spec/rendering_spec.rb +83 -0
  48. metadata +78 -22
  49. data/Rakefile +0 -12
  50. data/app_generators/staticmatic/staticmatic_generator.rb +0 -74
  51. data/app_generators/staticmatic/templates/Rakefile +0 -3
  52. data/lib/staticmatic/rescue.rb +0 -14
  53. data/lib/tasks/staticmatic.rb +0 -9
  54. data/staticmatic.gemspec +0 -52
  55. data/vendor/html-scanner/html/document.rb +0 -68
  56. data/vendor/html-scanner/html/node.rb +0 -530
  57. data/vendor/html-scanner/html/sanitizer.rb +0 -173
  58. data/vendor/html-scanner/html/selector.rb +0 -828
  59. data/vendor/html-scanner/html/tokenizer.rb +0 -105
  60. data/vendor/html-scanner/html/version.rb +0 -11
  61. /data/{app_generators/staticmatic → lib}/templates/src/helpers/site_helper.rb +0 -0
  62. /data/{app_generators/staticmatic → lib}/templates/src/layouts/site.html.haml +0 -0
  63. /data/{app_generators/staticmatic → lib}/templates/src/pages/index.html.haml +0 -0
  64. /data/{app_generators/staticmatic → lib}/templates/src/stylesheets/site.css.sass +0 -0
@@ -1,105 +0,0 @@
1
- require 'strscan'
2
-
3
- module HTML #:nodoc:
4
-
5
- # A simple HTML tokenizer. It simply breaks a stream of text into tokens, where each
6
- # token is a string. Each string represents either "text", or an HTML element.
7
- #
8
- # This currently assumes valid XHTML, which means no free < or > characters.
9
- #
10
- # Usage:
11
- #
12
- # tokenizer = HTML::Tokenizer.new(text)
13
- # while token = tokenizer.next
14
- # p token
15
- # end
16
- class Tokenizer #:nodoc:
17
-
18
- # The current (byte) position in the text
19
- attr_reader :position
20
-
21
- # The current line number
22
- attr_reader :line
23
-
24
- # Create a new Tokenizer for the given text.
25
- def initialize(text)
26
- @scanner = StringScanner.new(text)
27
- @position = 0
28
- @line = 0
29
- @current_line = 1
30
- end
31
-
32
- # Return the next token in the sequence, or +nil+ if there are no more tokens in
33
- # the stream.
34
- def next
35
- return nil if @scanner.eos?
36
- @position = @scanner.pos
37
- @line = @current_line
38
- if @scanner.check(/<\S/)
39
- update_current_line(scan_tag)
40
- else
41
- update_current_line(scan_text)
42
- end
43
- end
44
-
45
- private
46
-
47
- # Treat the text at the current position as a tag, and scan it. Supports
48
- # comments, doctype tags, and regular tags, and ignores less-than and
49
- # greater-than characters within quoted strings.
50
- def scan_tag
51
- tag = @scanner.getch
52
- if @scanner.scan(/!--/) # comment
53
- tag << @scanner.matched
54
- tag << (@scanner.scan_until(/--\s*>/) || @scanner.scan_until(/\Z/))
55
- elsif @scanner.scan(/!\[CDATA\[/)
56
- tag << @scanner.matched
57
- tag << @scanner.scan_until(/\]\]>/)
58
- elsif @scanner.scan(/!/) # doctype
59
- tag << @scanner.matched
60
- tag << consume_quoted_regions
61
- else
62
- tag << consume_quoted_regions
63
- end
64
- tag
65
- end
66
-
67
- # Scan all text up to the next < character and return it.
68
- def scan_text
69
- "#{@scanner.getch}#{@scanner.scan(/[^<]*/)}"
70
- end
71
-
72
- # Counts the number of newlines in the text and updates the current line
73
- # accordingly.
74
- def update_current_line(text)
75
- text.scan(/\r?\n/) { @current_line += 1 }
76
- end
77
-
78
- # Skips over quoted strings, so that less-than and greater-than characters
79
- # within the strings are ignored.
80
- def consume_quoted_regions
81
- text = ""
82
- loop do
83
- match = @scanner.scan_until(/['"<>]/) or break
84
-
85
- delim = @scanner.matched
86
- if delim == "<"
87
- match = match.chop
88
- @scanner.pos -= 1
89
- end
90
-
91
- text << match
92
- break if delim == "<" || delim == ">"
93
-
94
- # consume the quoted region
95
- while match = @scanner.scan_until(/[\\#{delim}]/)
96
- text << match
97
- break if @scanner.matched == delim
98
- text << @scanner.getch # skip the escaped character
99
- end
100
- end
101
- text
102
- end
103
- end
104
-
105
- end
@@ -1,11 +0,0 @@
1
- module HTML #:nodoc:
2
- module Version #:nodoc:
3
-
4
- MAJOR = 0
5
- MINOR = 5
6
- TINY = 3
7
-
8
- STRING = [ MAJOR, MINOR, TINY ].join(".")
9
-
10
- end
11
- end