gitdoc 3.10.0 → 3.13.0

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.
data/Rakefile CHANGED
@@ -1,21 +1,13 @@
1
- begin
2
- require 'jeweler'
3
- Jeweler::Tasks.new do |gs|
4
- gs.name = "gitdoc"
5
- gs.homepage = "http://github.com/quackingduck/gitdoc"
6
- gs.summary = "A light-weight web app for serving up a folder of markdown files"
7
- gs.email = "myles@myles.id.au"
8
- gs.authors = ["Myles Byrne"]
9
- gs.require_path = '.'
10
- gs.add_dependency('rdiscount', '~>1.5.8')
11
- gs.add_dependency('haml', '~>3.0.25')
12
- gs.add_dependency('sinatra', '~>1.0')
13
- gs.add_dependency('unicorn','~>3.1.0')
14
- gs.add_dependency('coffee-script', '~>2.1.1')
15
- gs.add_dependency('json','~>1.4.6') # dependency of coffee-script
16
- gs.add_dependency('livereload', '~>1.5')
17
- end
18
- Jeweler::GemcutterTasks.new
19
- rescue LoadError
20
- puts "Install jeweler to build gem"
21
- end
1
+ def gemfile
2
+ Dir['pkg/*'].sort.last
3
+ end
4
+
5
+ task :install do
6
+ sh 'gem build gitdoc.gemspec'
7
+ sh 'mv *.gem pkg/'
8
+ sh "gem install -l #{gemfile}"
9
+ end
10
+
11
+ task :tag do
12
+ sh "git tag -a v`cat VERSION` `git rev-parse HEAD` -m ''"
13
+ end
data/TODO.md ADDED
@@ -0,0 +1,73 @@
1
+ # config.ru for build
2
+
3
+ custom 404
4
+
5
+ # .htaccess for build
6
+
7
+ custom 404
8
+
9
+ # Set verison via set
10
+
11
+ right now there's a file_read in not_found
12
+
13
+ # Remove livereload support
14
+
15
+ Because Chris whines about it. Add instructions for adding to documentation
16
+
17
+ # Embedded HAML support
18
+
19
+ Would allow dynamic indexes and rss generation (by implementors). Example:
20
+
21
+ ///haml
22
+ - generate_rss
23
+ = article_list
24
+ ///
25
+
26
+ # Remove unicorn dependency
27
+
28
+ webrick is probably fine
29
+
30
+ # horizontal scrollbars to code elements
31
+
32
+ Can get this style from centro blog
33
+
34
+ # Rename to Goat
35
+
36
+ The program has very little to do with git
37
+
38
+ # Factor out ExtendedHTMLCompiler
39
+
40
+ Supports inline coffeescript and inline stylus
41
+
42
+ # Factor out DocumentCompiler
43
+
44
+ Supports embedded style/script and embedded syntax-highlighted code.
45
+
46
+ # New Interface
47
+
48
+ Goat.set :default_styles, false
49
+ Goat! "Default Title"
50
+
51
+ # Features load on boot
52
+
53
+ A log message appears when Goat can't load CoffeeScript, Stylus or Pygments
54
+
55
+ Something like
56
+
57
+ Couldn't find `coffee` in path, CoffeeScript to JavaScript compiler not loaded
58
+ Couldn't find `stylus` node package, Stylus to CSS compiler not loaded
59
+ Couldn't find `pygments` in path, Pgyments syntax highlighter not loaded
60
+
61
+ # Reasonable Errors for features that are not loaded
62
+
63
+ # Custom Error pages
64
+
65
+ The sinatra one is just ugly
66
+
67
+ # Bundle non-ruby dependencies
68
+
69
+ The priority is stylus (0.6), then coffeescript.
70
+
71
+ Might be a little tricky but it would be nice to ship vendored CoffeeScript, Stylus and Pygments so that these things don't unexpectedly break.
72
+
73
+ There's arguments for and against this one
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.10.0
1
+ 3.13.0
data/doc.haml CHANGED
@@ -4,4 +4,8 @@
4
4
  %meta{:charset => "utf-8"}
5
5
  %link{:rel => :stylesheet, :href => '/.css'}
6
6
  = settings.header
7
- #doc!= @doc
7
+
8
+ - if custom_body?
9
+ = custom_body
10
+ - else
11
+ #doc!= @doc
data/gitdoc.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |gs|
2
+ gs.name = "gitdoc"
3
+ gs.version = File.read(File.dirname(__FILE__)+'/VERSION')
4
+ gs.homepage = "http://github.com/quackingduck/gitdoc"
5
+ gs.summary = "A light-weight web app for serving up a folder of markdown files"
6
+ gs.email = "myles@myles.id.au"
7
+ gs.author = "Myles Byrne"
8
+ gs.require_path = '.'
9
+
10
+ gs.extra_rdoc_files = ["README.md"]
11
+
12
+ gs.files = Dir['**/**/*']
13
+
14
+ gs.add_dependency 'rdiscount', '~>1.5.8'
15
+ gs.add_dependency 'haml', '~>3.0.25'
16
+ gs.add_dependency 'sinatra', '~>1.0'
17
+ gs.add_dependency 'unicorn','~>3.1.0'
18
+ gs.add_dependency 'coffee-script', '~>2.1.1'
19
+ gs.add_dependency 'json','~>1.4.6' # dependency of coffee-script
20
+ gs.add_dependency 'livereload', '~>1.5'
21
+ end
data/gitdoc.rb CHANGED
@@ -30,7 +30,9 @@ end
30
30
 
31
31
  ## The Implementation
32
32
 
33
- set :haml, {:format => :html5}
33
+ GitDoc = Sinatra::Application
34
+
35
+ set :haml, :format => :html5
34
36
  set :views, lambda { root }
35
37
  disable :logging # the server always writes its own log anyway
36
38
 
@@ -43,12 +45,28 @@ helpers do
43
45
  # Compiles a GitDoc document (basically markdown with code highlighting)
44
46
  # into html
45
47
  def gd source
46
- source_without_code = extract_code source
47
- html = RDiscount.new(source_without_code).to_html
48
+ html = extract_code source
49
+ html = process_haml html
50
+ html = extract_styles html
51
+ html = RDiscount.new(html).to_html
48
52
  html = highlight_code html
49
53
  newline_entities_for_tag :pre, html
50
54
  end
51
55
 
56
+ def process_haml source
57
+ # only supports single lines atm
58
+ source.gsub %r{///\s*haml\s*(.+)?$} do
59
+ haml $1
60
+ end
61
+ end
62
+
63
+ def extract_styles source
64
+ # only suppors css atm, also a dirty hack
65
+ source.gsub(/^<style\s?(?:type=['"]?text\/css['"])?>\r?\n(.+?)<\/style>?$/m) do |match|
66
+ "<div><style type='text/css'>\n#{scss $1}</style></div>"
67
+ end
68
+ end
69
+
52
70
  # `extract_code` and `highlight_code` based on:
53
71
  # https://github.com/github/gollum/blob/0b8bc597a7e9495b272e5dbb743827f56ccd2fe6/lib/gollum/markup.rb#L367
54
72
 
@@ -138,6 +156,16 @@ stylus.render str, {paths: ['#{File.dirname file}']}, (err,css) -> sys.puts css
138
156
  `coffee --eval #{Shellwords.escape stylus_compiler}`.chomp
139
157
  end
140
158
 
159
+ # Custom templates
160
+
161
+ def custom_body?
162
+ File.exists? settings.dir + '/body.haml'
163
+ end
164
+
165
+ def custom_body
166
+ haml File.read(settings.dir + '/body.haml')
167
+ end
168
+
141
169
  end
142
170
 
143
171
  # If the path doesn't have a file extension and a matching GitDoc document
@@ -176,6 +204,7 @@ get '*.html' do |name|
176
204
  html file
177
205
  end
178
206
 
207
+ # Deprecated
179
208
  get '*._plain' do |name|
180
209
  file = settings.dir + '/' + name
181
210
  pass unless File.exist? file
@@ -183,6 +212,13 @@ get '*._plain' do |name|
183
212
  File.read(file)
184
213
  end
185
214
 
215
+ get '*.txt' do |name|
216
+ file = settings.dir + '/' + name
217
+ pass unless File.exist? file
218
+ content_type :text
219
+ File.read(file)
220
+ end
221
+
186
222
  # If the path matches any file in the directory then send that down
187
223
  get '*.*' do |name,ext|
188
224
  file = File.join(settings.dir + '/' + name + '.' + ext)
Binary file
Binary file
Binary file
Binary file
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: 47
4
+ hash: 51
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
- - 10
8
+ - 13
9
9
  - 0
10
- version: 3.10.0
10
+ version: 3.13.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Myles Byrne
@@ -15,8 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-28 00:00:00 +11:00
19
- default_executable: gitdoc
18
+ date: 2011-04-07 00:00:00 +10:00
19
+ default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rdiscount
@@ -130,34 +130,37 @@ dependencies:
130
130
  version_requirements: *id007
131
131
  description:
132
132
  email: myles@myles.id.au
133
- executables:
134
- - gitdoc
133
+ executables: []
134
+
135
135
  extensions: []
136
136
 
137
137
  extra_rdoc_files:
138
138
  - README.md
139
- - TODO
140
139
  files:
141
- - .gitignore
142
- - README.md
143
- - Rakefile
144
- - TODO
145
- - VERSION
146
140
  - bin/gitdoc
147
141
  - default.sass
148
142
  - doc.haml
149
143
  - favicon.ico
150
- - gitdoc.rb
151
144
  - gitdoc/tasks.rb
145
+ - gitdoc.gemspec
146
+ - gitdoc.rb
152
147
  - highlight.css
148
+ - pkg/gitdoc-3.10.1.gem
149
+ - pkg/gitdoc-3.11.0.gem
150
+ - pkg/gitdoc-3.11.1.gem
151
+ - pkg/gitdoc-3.12.0.gem
152
+ - Rakefile
153
+ - README.md
153
154
  - reset.sass
155
+ - TODO.md
156
+ - VERSION
154
157
  has_rdoc: true
155
158
  homepage: http://github.com/quackingduck/gitdoc
156
159
  licenses: []
157
160
 
158
161
  post_install_message:
159
- rdoc_options:
160
- - --charset=UTF-8
162
+ rdoc_options: []
163
+
161
164
  require_paths:
162
165
  - .
163
166
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- *.gemspec
2
- pkg
data/TODO DELETED
@@ -1,9 +0,0 @@
1
- * Push the current path level into the load path for sass
2
- * Add nice horizontal scrollbars to code elements
3
- * Support inline coffee compilation in html
4
- * Open web browser after server launches
5
- * Less http logging
6
- * A :scriptable option that supports script embedding and an /index.json call
7
- * Don't run the server on a port that's in use
8
- * Support ///cs syntax
9
- * running `gitdoc` launches gitdoc in current directory