majek 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
@@ -0,0 +1,18 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ majek (0.1.1)
5
+ md_inc
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ md_inc (0.2.7)
11
+ rake (10.0.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ majek!
18
+ rake
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2013 Mathias Lafeldt
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 NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ Majek
2
+ =====
3
+
4
+ Tool to convert Markdown to Jekyll post format
5
+
6
+
7
+ Installation
8
+ ------------
9
+
10
+ TODO
11
+
12
+
13
+ Usage
14
+ -----
15
+
16
+ usage: majek <markdown file>
17
+
18
+
19
+ License
20
+ -------
21
+
22
+ Majek is licensed under the terms of the MIT License. See [LICENSE] file.
23
+
24
+
25
+ Contact
26
+ -------
27
+
28
+ * Web: <http://mlafeldt.github.com/majek>
29
+ * Mail: <mathias.lafeldt@gmail.com>
30
+ * Twitter: [@mlafeldt](https://twitter.com/mlafeldt)
31
+
32
+
33
+ [LICENSE]: https://github.com/mlafeldt/majek/blob/master/LICENSE
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/clean'
3
+
4
+ task :default => :build
5
+
6
+ CLEAN.include 'pkg'
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'majek'
6
+
7
+ Majek::Application.new(ARGV).run
@@ -0,0 +1,5 @@
1
+ require 'md_inc'
2
+
3
+ require 'md_inc/octopress_commands'
4
+ require 'majek/application'
5
+ require 'majek/version'
@@ -0,0 +1,26 @@
1
+ module Majek
2
+ class Application
3
+ MATCH_TITLE = %r{^# (.+)$}
4
+
5
+ def initialize(argv)
6
+ @filename = argv.first
7
+ @base_dir = File.dirname(File.expand_path(@filename))
8
+ end
9
+
10
+ def run
11
+ markdown = File.read(@filename)
12
+ title = markdown.match(MATCH_TITLE)[1]
13
+ jekyll_body = markdown.gsub(MATCH_TITLE, '')
14
+ jekyll_header = %Q(---
15
+ layout: post
16
+ title: "#{title}"
17
+ date: #{Time.now}
18
+ comments: true
19
+ categories:
20
+ ---)
21
+ MdInc::Commands::root(@base_dir)
22
+ tp = MdInc::TextProcessor.new
23
+ puts tp.process(jekyll_header + jekyll_body)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module Majek
2
+ VERSION = '0.1.1'
3
+ end
@@ -0,0 +1,52 @@
1
+ # Add Octopress commands to MdInc.
2
+ module MdInc
3
+ module Commands
4
+ class << self
5
+ def octo_tag(name, attrs=[], lines=[])
6
+ output = []
7
+ output << "{% #{([name] + attrs).join(" ")} %}"
8
+ unless lines.empty?
9
+ output += lines
10
+ output << "{% end#{name} %}"
11
+ end
12
+ output
13
+ end
14
+
15
+ # Public: Octopress command to include other files.
16
+ #
17
+ # path - Path to the file to be included.
18
+ # attrs - Array of attributes passed to the Octopress tag.
19
+ #
20
+ # Examples
21
+ #
22
+ # .codeblock 'snippets/stub-spec.rb', 'ruby'
23
+ # # =>
24
+ # # {% codeblock ruby %}
25
+ # # contents of snippets/stub-spec.rb
26
+ # # {% endcodeblock %}
27
+ #
28
+ # Returns the Octopress tag as a String Array.
29
+ %w(blockquote codeblock pullquote).each do |meth|
30
+ define_method(meth) { |path, *attrs| octo_tag(meth, attrs, inc(path)) }
31
+ end
32
+
33
+ # Public: Octopress command that doesn't include anything; only added for
34
+ # consistency and convenience.
35
+ #
36
+ # attrs - Array of attributes passed to the Octopress tag.
37
+ #
38
+ # Examples
39
+ #
40
+ # .gist 1234
41
+ # # => {% gist 1234 %}
42
+ #
43
+ # .img 'left', 'http://placekitten.com/320/250', 'Place Kitten #2'
44
+ # # => {% img left http://placekitten.com/320/250 Place Kitten #2 %}
45
+ #
46
+ # Returns the Octopress tag as a String Array.
47
+ %w(gist img include_code jsfiddle render_partial video).each do |meth|
48
+ define_method(meth) { |*attrs| octo_tag(meth, attrs) }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/majek/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.authors = ['Mathias Lafeldt']
6
+ s.email = ['mathias.lafeldt@gmail.com']
7
+ s.description = %q{Tool to convert Markdown to Jekyll post format}
8
+ s.summary = s.description
9
+ s.homepage = 'http://mlafeldt.github.com/majek'
10
+ s.license = 'MIT'
11
+
12
+ s.files = `git ls-files`.split($\)
13
+ s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
15
+ s.name = 'majek'
16
+ s.require_paths = ['lib']
17
+ s.version = Majek::VERSION
18
+
19
+ s.add_dependency 'md_inc'
20
+ s.add_development_dependency 'rake'
21
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: majek
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mathias Lafeldt
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: md_inc
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Tool to convert Markdown to Jekyll post format
47
+ email:
48
+ - mathias.lafeldt@gmail.com
49
+ executables:
50
+ - majek
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - Gemfile.lock
57
+ - LICENSE
58
+ - README.md
59
+ - Rakefile
60
+ - bin/majek
61
+ - lib/majek.rb
62
+ - lib/majek/application.rb
63
+ - lib/majek/version.rb
64
+ - lib/md_inc/octopress_commands.rb
65
+ - majek.gemspec
66
+ homepage: http://mlafeldt.github.com/majek
67
+ licenses:
68
+ - MIT
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ segments:
80
+ - 0
81
+ hash: -2670310394678098680
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ segments:
89
+ - 0
90
+ hash: -2670310394678098680
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 1.8.23
94
+ signing_key:
95
+ specification_version: 3
96
+ summary: Tool to convert Markdown to Jekyll post format
97
+ test_files: []