majek 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +109 -2
- data/lib/majek/version.rb +1 -1
- data/majek.gemspec +1 -1
- metadata +9 -7
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,30 @@
|
|
1
1
|
Majek
|
2
2
|
=====
|
3
3
|
|
4
|
-
|
4
|
+
Majek is a preprocessor for Jekyll/Octopress blog posts that helps you to
|
5
|
+
concentrate on writing. It allows you to include other files from your Markdown
|
6
|
+
(thanks to [md_inc]) and produce posts in Jekyll format.
|
7
|
+
|
8
|
+
Majek is especially helpful when you're writing Markdown with a tool like
|
9
|
+
[iA Writer] that is more about prose and less about code. Instead of including
|
10
|
+
bulky code snippets directly in your Markdown file, you simply insert short
|
11
|
+
commands like `.inc 'foo.txt'` or `.codeblock 'bar.rb'`, which will then be
|
12
|
+
expanded by Majek.
|
5
13
|
|
6
14
|
|
7
15
|
Installation
|
8
16
|
------------
|
9
17
|
|
10
|
-
|
18
|
+
You can install Majek via RubyGems:
|
19
|
+
|
20
|
+
$ gem install majek
|
21
|
+
|
22
|
+
Alternatively, you can install the gem from source:
|
23
|
+
|
24
|
+
$ git clone git://github.com/mlafeldt/majek.git
|
25
|
+
$ cd majek/
|
26
|
+
$ bundle install
|
27
|
+
$ bundle exec rake install
|
11
28
|
|
12
29
|
|
13
30
|
Usage
|
@@ -15,6 +32,94 @@ Usage
|
|
15
32
|
|
16
33
|
usage: majek <markdown file>
|
17
34
|
|
35
|
+
Simply pass Majek a Markdown file and it will do the following:
|
36
|
+
|
37
|
+
- read the contents of the Markdown file
|
38
|
+
- process the text with md_inc which provides commands to include other text
|
39
|
+
files (`.inc`) and code (`.code_inc`) and more
|
40
|
+
- process the text using custom md_inc commands for Octopress, see below
|
41
|
+
- add a Jekyll header with title, date, categories, etc. (will be configurable
|
42
|
+
in the future)
|
43
|
+
- output the final text to screen
|
44
|
+
|
45
|
+
In addition to the default commands of md_inc, Majek provides the following
|
46
|
+
Octopress-specific commands:
|
47
|
+
|
48
|
+
- `.blockquote path [,attributes...]`
|
49
|
+
- `.codeblock path [,attributes...]`
|
50
|
+
- `.pullquote path [,attributes...]`
|
51
|
+
- `.gist [attributes...]`
|
52
|
+
- `.img [attributes...]`
|
53
|
+
- `.include_code [attributes...]`
|
54
|
+
- `.jsfiddle [attributes...]`
|
55
|
+
- `.render_partial [attributes...]`
|
56
|
+
- `.video [attributes...]`
|
57
|
+
|
58
|
+
Make sure to also read the documentation of [md_inc] to learn more.
|
59
|
+
|
60
|
+
|
61
|
+
Examples
|
62
|
+
--------
|
63
|
+
|
64
|
+
Given a standard Markdown file like this:
|
65
|
+
|
66
|
+
```
|
67
|
+
$ cat month_of_coderwall_protips.md
|
68
|
+
# One Month of Coderwall Protips
|
69
|
+
|
70
|
+
On 1 January 2013, I signed up on [Coderwall](https://coderwall.com/) -- a place
|
71
|
+
for developers to share tips and connect with one another. I've been ...
|
72
|
+
```
|
73
|
+
|
74
|
+
Majek will produce text that is ready to be fed into Jekyll:
|
75
|
+
|
76
|
+
```
|
77
|
+
$ majek one_month_of_coderwall_protips.md
|
78
|
+
---
|
79
|
+
layout: post
|
80
|
+
title: "One Month of Coderwall Protips"
|
81
|
+
date: 2013-02-14 11:01:09 +0100
|
82
|
+
comments: true
|
83
|
+
categories:
|
84
|
+
---
|
85
|
+
|
86
|
+
On 1 January 2013, I signed up on [Coderwall](https://coderwall.com/) -- a place
|
87
|
+
for developers to share tips and connect with one another. I've been ...
|
88
|
+
```
|
89
|
+
|
90
|
+
The second example shows one of the Octopress commands in action:
|
91
|
+
|
92
|
+
```
|
93
|
+
By stubbing out Chef's `include_recipe` method before the converge, Chef will
|
94
|
+
not include any recipes during the test run:
|
95
|
+
|
96
|
+
.codeblock 'snippets/stub-spec.rb', 'lang:ruby'
|
97
|
+
|
98
|
+
This requires a bit of symlink trickery to work though.
|
99
|
+
```
|
100
|
+
|
101
|
+
The result will include the Ruby code from the specified file (Jekyll stuff
|
102
|
+
stripped for brevity):
|
103
|
+
|
104
|
+
```
|
105
|
+
By stubbing out Chef's `include_recipe` method before the converge, Chef will
|
106
|
+
not include any recipes during the test run:
|
107
|
+
|
108
|
+
{% codeblock lang:ruby %}
|
109
|
+
require 'chefspec'
|
110
|
+
|
111
|
+
describe 'The recipe foo::default' do
|
112
|
+
let (:chef_run) do
|
113
|
+
Chef::Recipe.any_instance.stub(:include_recipe)
|
114
|
+
ChefSpec::ChefRunner.new.converge 'foo::default'
|
115
|
+
end
|
116
|
+
# ...
|
117
|
+
end
|
118
|
+
{% endcodeblock %}
|
119
|
+
|
120
|
+
This requires a bit of symlink trickery to work though.
|
121
|
+
```
|
122
|
+
|
18
123
|
|
19
124
|
License
|
20
125
|
-------
|
@@ -31,3 +136,5 @@ Contact
|
|
31
136
|
|
32
137
|
|
33
138
|
[LICENSE]: https://github.com/mlafeldt/majek/blob/master/LICENSE
|
139
|
+
[iA Writer]: http://www.iawriter.com/
|
140
|
+
[md_inc]: https://github.com/russolsen/md_inc
|
data/lib/majek/version.rb
CHANGED
data/majek.gemspec
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path('../lib/majek/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.authors = ['Mathias Lafeldt']
|
6
6
|
s.email = ['mathias.lafeldt@gmail.com']
|
7
|
-
s.description = %q{
|
7
|
+
s.description = %q{A preprocessor for Jekyll/Octopress blog posts that helps you to concentrate on writing}
|
8
8
|
s.summary = s.description
|
9
9
|
s.homepage = 'http://mlafeldt.github.com/majek'
|
10
10
|
s.license = 'MIT'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: majek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: md_inc
|
@@ -43,7 +43,8 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
-
description:
|
46
|
+
description: A preprocessor for Jekyll/Octopress blog posts that helps you to concentrate
|
47
|
+
on writing
|
47
48
|
email:
|
48
49
|
- mathias.lafeldt@gmail.com
|
49
50
|
executables:
|
@@ -78,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
79
|
version: '0'
|
79
80
|
segments:
|
80
81
|
- 0
|
81
|
-
hash:
|
82
|
+
hash: 204157305799219663
|
82
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
84
|
none: false
|
84
85
|
requirements:
|
@@ -87,11 +88,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
88
|
version: '0'
|
88
89
|
segments:
|
89
90
|
- 0
|
90
|
-
hash:
|
91
|
+
hash: 204157305799219663
|
91
92
|
requirements: []
|
92
93
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.8.
|
94
|
+
rubygems_version: 1.8.25
|
94
95
|
signing_key:
|
95
96
|
specification_version: 3
|
96
|
-
summary:
|
97
|
+
summary: A preprocessor for Jekyll/Octopress blog posts that helps you to concentrate
|
98
|
+
on writing
|
97
99
|
test_files: []
|