blogdown 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +23 -23
- data/.travis.yml +5 -0
- data/1.PNG +0 -0
- data/2.PNG +0 -0
- data/Gemfile +3 -3
- data/LICENSE.txt +22 -22
- data/README.md +53 -54
- data/Rakefile +13 -2
- data/blogdown.gemspec +33 -31
- data/lib/blogdown.rb +13 -13
- data/lib/blogdown/app.rb +7 -27
- data/lib/blogdown/cli.rb +0 -13
- data/lib/blogdown/file_pipeline.rb +5 -3
- data/lib/blogdown/publisher.rb +22 -21
- data/lib/blogdown/version.rb +1 -1
- data/lib/public/css/blogdown.css +131 -0
- data/lib/public/css/bootstrap-theme.css +347 -0
- data/lib/public/css/bootstrap-theme.css.map +1 -0
- data/lib/public/css/bootstrap-theme.min.css +7 -0
- data/lib/public/css/bootstrap.css +5785 -0
- data/lib/public/css/bootstrap.css.map +1 -0
- data/lib/public/css/bootstrap.min.css +7 -0
- data/lib/public/css/prettify.css +30 -0
- data/lib/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/lib/public/fonts/glyphicons-halflings-regular.svg +229 -0
- data/lib/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/lib/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/lib/public/js/blogdown.js +8 -0
- data/lib/public/js/bootstrap.js +1951 -0
- data/lib/public/js/bootstrap.min.js +6 -0
- data/lib/public/js/jquery.js +9154 -0
- data/lib/views/index.erb +29 -0
- data/lib/views/layout.erb +36 -0
- data/spec/blogdown/blogdown_spec.rb +3 -14
- data/spec/fixtures/hello.md +1 -0
- data/spec/spec_helper.rb +7 -0
- metadata +42 -40
- data/features/server.feature +0 -8
- data/features/step_definitions/blogdown_steps.rb +0 -15
- data/features/support/env.rb +0 -2
- data/lib/public/images/body-bg.png +0 -0
- data/lib/public/images/highlight-bg.jpg +0 -0
- data/lib/public/images/hr.png +0 -0
- data/lib/public/images/octocat-icon.png +0 -0
- data/lib/public/images/tar-gz-icon.png +0 -0
- data/lib/public/images/zip-icon.png +0 -0
- data/lib/public/javascripts/main.js +0 -0
- data/lib/public/stylesheets/print.css +0 -226
- data/lib/public/stylesheets/pygment_trac.css +0 -69
- data/lib/public/stylesheets/stylesheet.css +0 -371
- data/lib/views/base.erb +0 -42
- data/lib/views/home.erb +0 -18
- data/lib/views/post.erb +0 -438
- data/spec/fixtures/posts/hello.md +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 885b01ce2126bc63a1cfbd7043146d4882420246
|
4
|
+
data.tar.gz: b1376f914ae814507e524b5d557a3067a694501f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 471ca516d1c92eb37546ae2e9985d9d82aab8aa2fce4ae3dc387758235a2351037e3b6f5f8717b3b173bcbe7e63649851bd18191acbe528c89dcc14f527bd3be
|
7
|
+
data.tar.gz: f5c7ac656ddc99104fcdbe438ad7476341dc6529aaf4ecc50dc141a606edc53c19e3b105e4e2164f6fcafce02f6ef437ae86968ed9ff424b16bcd1a3cf62a46a
|
data/.gitignore
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
23
|
-
.idea
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.idea
|
data/.travis.yml
ADDED
data/1.PNG
ADDED
Binary file
|
data/2.PNG
ADDED
Binary file
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in blogdown.gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in blogdown.gemspec
|
4
4
|
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2014 gernest
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2014 gernest
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,54 +1,53 @@
|
|
1
|
-
# Blogdown
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
5. Create a new Pull Request
|
1
|
+
# Blogdown
|
2
|
+
[![Build Status](https://travis-ci.org/gernest/blogdown.svg?branch=master)](https://travis-ci.org/gernest/blogdown)
|
3
|
+
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/gernest/blogdown/badge.png)](https://coveralls.io/r/gernest/blogdown)
|
5
|
+
|
6
|
+
|
7
|
+
## What this is all about
|
8
|
+
Blogdown helps to view your favorite github wiki offline. I created this
|
9
|
+
project to help me, have a good source of documentation on my pc,
|
10
|
+
since I dont have the privilege of internet access. I go online once in a
|
11
|
+
while, and its frusttating when I ineed to go online to view documentation.
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Run:
|
19
|
+
|
20
|
+
$ gem install blogdown
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Clone your favorite wiki
|
25
|
+
|
26
|
+
$ git clone [The Wiki URL goes HERE]
|
27
|
+
|
28
|
+
Cd into your wiki directory
|
29
|
+
|
30
|
+
$cd mywiki.wiki
|
31
|
+
|
32
|
+
|
33
|
+
And, blog it down
|
34
|
+
|
35
|
+
$ blogdown server
|
36
|
+
|
37
|
+
Behing the scene, the command will build the project first, and run a webserver which will be available at `http://localhost:4567`
|
38
|
+
copy `http://localhost:4567` and paste into your browser to see the files and view them with much more options.
|
39
|
+
|
40
|
+
## Snapshots
|
41
|
+
![blogdown](/1.PNG?raw=true "Blogdown")
|
42
|
+
|
43
|
+
![blogdown](/2.PNG?raw=true "Blogdown")
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it ( https://github.com/gernest/blogdown/fork )
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create a new Pull Request
|
data/Rakefile
CHANGED
@@ -1,2 +1,13 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
desc "Run RSpec"
|
7
|
+
RSpec::Core::RakeTask.new('spec')
|
8
|
+
|
9
|
+
|
10
|
+
desc "Run tests, both RSpec and Cucumber"
|
11
|
+
task :test => :spec
|
12
|
+
|
13
|
+
task :default => :test
|
data/blogdown.gemspec
CHANGED
@@ -1,31 +1,33 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'blogdown/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "blogdown"
|
8
|
-
spec.version = Blogdown::VERSION
|
9
|
-
spec.authors = ["gernest"]
|
10
|
-
spec.email = ["geofreyernest@live.com"]
|
11
|
-
spec.summary = %q{
|
12
|
-
|
13
|
-
spec.
|
14
|
-
spec.
|
15
|
-
|
16
|
-
|
17
|
-
spec.
|
18
|
-
spec.
|
19
|
-
spec.
|
20
|
-
|
21
|
-
|
22
|
-
spec.add_development_dependency "
|
23
|
-
spec.add_development_dependency "
|
24
|
-
spec.add_development_dependency "
|
25
|
-
|
26
|
-
|
27
|
-
spec.add_dependency "
|
28
|
-
spec.add_dependency "
|
29
|
-
|
30
|
-
|
31
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'blogdown/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "blogdown"
|
8
|
+
spec.version = Blogdown::VERSION
|
9
|
+
spec.authors = ["gernest"]
|
10
|
+
spec.email = ["geofreyernest@live.com"]
|
11
|
+
spec.summary = %q{Turning your github wiki to a nice looking offline
|
12
|
+
webpage}
|
13
|
+
spec.description = %q{ An offline github wiki viewer}
|
14
|
+
spec.homepage = "https://github.com/gernest/blogdown"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
23
|
+
spec.add_development_dependency "rake","~> 10.3.2"
|
24
|
+
spec.add_development_dependency "rspec","~>3.0.0"
|
25
|
+
spec.add_development_dependency "coveralls"
|
26
|
+
|
27
|
+
spec.add_dependency "redcarpet"
|
28
|
+
spec.add_dependency "github-markdown"
|
29
|
+
|
30
|
+
spec.add_dependency "thor", "~> 0.19.1"
|
31
|
+
spec.add_dependency "sinatra", "~> 1.4.5"
|
32
|
+
|
33
|
+
end
|
data/lib/blogdown.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require 'sinatra'
|
3
|
-
require 'thor'
|
4
|
-
|
5
|
-
require "blogdown/version"
|
6
|
-
require 'blogdown/exceptions'
|
7
|
-
require 'blogdown/file_pipeline'
|
8
|
-
require 'blogdown/publisher'
|
9
|
-
require 'blogdown/app'
|
10
|
-
require 'blogdown/cli'
|
11
|
-
|
12
|
-
module Blogdown
|
13
|
-
end
|
1
|
+
require 'pathname'
|
2
|
+
require 'sinatra'
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
require "blogdown/version"
|
6
|
+
require 'blogdown/exceptions'
|
7
|
+
require 'blogdown/file_pipeline'
|
8
|
+
require 'blogdown/publisher'
|
9
|
+
require 'blogdown/app'
|
10
|
+
require 'blogdown/cli'
|
11
|
+
|
12
|
+
module Blogdown
|
13
|
+
end
|
data/lib/blogdown/app.rb
CHANGED
@@ -1,35 +1,15 @@
|
|
1
1
|
module Blogdown
|
2
2
|
class PreviewApp<Sinatra::Application
|
3
3
|
|
4
|
-
helpers do
|
5
|
-
def built_files
|
6
|
-
@output=ENV['BD']+'/output'
|
7
|
-
@files =[]
|
8
|
-
out =Pathname(@output)
|
9
|
-
out.each_child do |child|
|
10
|
-
if child.extname==".html"
|
11
|
-
@files<<child
|
12
|
-
end
|
13
|
-
end
|
14
|
-
@files
|
15
|
-
end
|
16
|
-
end
|
17
4
|
get '/' do
|
18
|
-
|
5
|
+
@wiki_files=self.wiki_files
|
6
|
+
erb :index, :layout => :layout
|
7
|
+
end
|
8
|
+
def wiki_files
|
9
|
+
@sources=ENV['BD']
|
10
|
+
pub=Blogdown::Publisher.new(@sources)
|
11
|
+
pub.compose
|
19
12
|
end
|
20
13
|
|
21
|
-
|
22
|
-
# Serves generated files found in the ouput folder
|
23
|
-
# It does so, by reading the files, and dumping the string to be rendered with `erb`
|
24
|
-
get '/post/:name' do |file_name|
|
25
|
-
@source_dir=ENV['BD']+'/output/'+file_name.gsub('-', '_')+'.md.html'
|
26
|
-
@path =Pathname(@source_dir)
|
27
|
-
if @path.file?
|
28
|
-
@title=@path.basename.to_s.gsub('.html', '')
|
29
|
-
erb @path.read, :layout => :post
|
30
|
-
else
|
31
|
-
halt 404
|
32
|
-
end
|
33
|
-
end
|
34
14
|
end
|
35
15
|
end
|
data/lib/blogdown/cli.rb
CHANGED
@@ -3,23 +3,10 @@ module Blogdown
|
|
3
3
|
# Commandline app for blogdown
|
4
4
|
class CommandLine<Thor
|
5
5
|
|
6
|
-
desc "build", "builds the html files"
|
7
|
-
def build
|
8
|
-
# Builds html files from markdown files, located in output
|
9
|
-
# and posts folders respectively
|
10
|
-
begin
|
11
|
-
publisher=Blogdown::Publisher.new(Dir.pwd)
|
12
|
-
publisher.compose
|
13
|
-
rescue Exception=>e
|
14
|
-
puts e.message
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
6
|
desc "server", "serves the project for preview"
|
19
7
|
def server
|
20
8
|
# Runs Sinatra built in server on the project root drectory
|
21
9
|
ENV['BD']=Dir.pwd
|
22
|
-
build
|
23
10
|
Blogdown::PreviewApp.run!
|
24
11
|
end
|
25
12
|
end
|
@@ -12,7 +12,8 @@ module Blogdown
|
|
12
12
|
|
13
13
|
# @return [Array] The files under posts folder
|
14
14
|
def load_files
|
15
|
-
|
15
|
+
puts "loading files from #{@root.to_s}"
|
16
|
+
base_input=@root
|
16
17
|
|
17
18
|
base=Pathname.new(base_input)
|
18
19
|
unless base.exist?
|
@@ -20,11 +21,12 @@ module Blogdown
|
|
20
21
|
end
|
21
22
|
if base.exist?
|
22
23
|
base.each_child do|child|
|
23
|
-
|
24
|
+
puts "loading #{child.to_s}"
|
24
25
|
self.stack<<child
|
25
|
-
|
26
|
+
puts "Done"
|
26
27
|
end
|
27
28
|
end
|
29
|
+
puts "Finished loading #{self.stack.length} files"
|
28
30
|
end
|
29
31
|
|
30
32
|
# Writes given contents into a file with a name given as a parameter
|
data/lib/blogdown/publisher.rb
CHANGED
@@ -1,47 +1,48 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'redcarpet'
|
2
|
+
require 'github/markdown'
|
3
3
|
|
4
4
|
module Blogdown
|
5
5
|
class Publisher
|
6
|
+
attr_accessor :renderer,:markdown
|
6
7
|
def initialize root
|
7
8
|
@pipeline=Blogdown::FilePipeline.new root
|
8
9
|
@base=root
|
10
|
+
@output_stack={}
|
11
|
+
@renderer=Redcarpet::Render::HTML.new(render_options)
|
12
|
+
@markdown=Redcarpet::Markdown.new(@renderer, markdown_options)
|
9
13
|
end
|
10
14
|
|
11
15
|
def compose
|
12
|
-
clean_output
|
13
16
|
if @pipeline.stack.empty?
|
14
17
|
raise IOError, "No file to compose"
|
15
18
|
else
|
16
19
|
@pipeline.stack.each do |file|
|
17
|
-
|
18
|
-
|
20
|
+
if file.file?
|
21
|
+
puts "processing #{file.to_s}"
|
22
|
+
htm=transform(file.read)
|
23
|
+
@output_stack[valid_id(file)]=htm
|
24
|
+
puts "done"
|
25
|
+
end
|
26
|
+
|
19
27
|
end
|
20
28
|
end
|
21
|
-
|
29
|
+
@output_stack
|
22
30
|
end
|
23
31
|
|
24
32
|
def transform(txt)
|
25
|
-
|
33
|
+
self.markdown.render(GitHub::Markdown.render_gfm(txt))
|
26
34
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
35
|
+
def valid_id(v)
|
36
|
+
value=v.basename.to_s.gsub(/^*.([a-z]|[A-Z]){2,}$/,"")
|
37
|
+
value=value.gsub(" ","-")
|
30
38
|
end
|
31
39
|
|
32
|
-
def
|
33
|
-
|
34
|
-
base_root=Pathname base_root
|
35
|
-
if base_root.exist?
|
36
|
-
base_root.rmtree
|
37
|
-
base_root.mkpath
|
38
|
-
else
|
39
|
-
base_root.mkpath
|
40
|
-
end
|
40
|
+
def render_options
|
41
|
+
{:with_toc_data=>false, :hard_warp=>true, :prettify=>true}
|
41
42
|
end
|
42
43
|
|
43
|
-
def
|
44
|
-
{
|
44
|
+
def markdown_options
|
45
|
+
{:auto_link=>true}
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|