gitdoc 3.7.0 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/TODO +1 -0
  2. data/VERSION +1 -1
  3. data/gitdoc.rb +22 -3
  4. metadata +4 -4
data/TODO CHANGED
@@ -1,3 +1,4 @@
1
+ * Push the current path level into the load path for sass
1
2
  * Add nice horizontal scrollbars to code elements
2
3
  * Support inline coffee compilation in html
3
4
  * Open web browser after server launches
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.0
1
+ 3.8.0
data/gitdoc.rb CHANGED
@@ -102,9 +102,10 @@ helpers do
102
102
 
103
103
  ### HTML Extensions
104
104
 
105
- def html extended_html
106
- html = compile_sass_tags extended_html
107
- compile_scss_tags html
105
+ def html html
106
+ html = compile_sass_tags html
107
+ html = compile_scss_tags html
108
+ compile_stylus_tags html
108
109
  end
109
110
 
110
111
  def compile_scss_tags source
@@ -119,6 +120,24 @@ helpers do
119
120
  end
120
121
  end
121
122
 
123
+ def compile_stylus_tags source
124
+ source.gsub(/^<style type=['"]?text\/stylus['"]?>\r?\n(.+?)<\/style>?$/m) do |match|
125
+ "<style type='text/css'>\n#{stylus $1}</style>"
126
+ end
127
+ end
128
+
129
+ require 'shellwords'
130
+
131
+ # Hacked in. Requires node and the coffee and stylus npm packages installed
132
+ def stylus src
133
+ stylus_compiler = <<-COFFEE
134
+ sys = require 'sys' ; stylus = require 'stylus'
135
+ str = """\n#{src}\n"""
136
+ stylus.render str, {}, (err,css) -> sys.puts css
137
+ COFFEE
138
+ `coffee --eval #{Shellwords.escape stylus_compiler}`.chomp
139
+ end
140
+
122
141
  end
123
142
 
124
143
  # If the path doesn't have a file extension and a matching GitDoc document
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitdoc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 39
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
- - 7
8
+ - 8
9
9
  - 0
10
- version: 3.7.0
10
+ version: 3.8.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Myles Byrne
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-20 00:00:00 +11:00
18
+ date: 2011-02-25 00:00:00 +11:00
19
19
  default_executable: gitdoc
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency