jekyll-spaceship 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299c1d8d0ae616ad6883c9466fbb2d92d9ef0b23da9720bcc1ab36af029b0186
|
4
|
+
data.tar.gz: c148c5a5527bed37cf92677b1dc8814abe802100fafd0165e9178f3f122d1fca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 467f9559626e7f2f996d8ec90b38c7d31e6fa72dd8e32243b601fdd84a611b6d4f190e120fa12b568d27be66f932334e2ca2bd924483e28d1728e5a4e469ee12
|
7
|
+
data.tar.gz: b5ab6d2249282b1d411f29be94c4382b8f02c51721da8d477ec3134724fce8455f13e827ec32a399ef93643791045aa30cc8dd52e2111da89cad54085f46b75c
|
data/README.md
ADDED
@@ -0,0 +1,365 @@
|
|
1
|
+
# jekyll-spaceship
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/jeffreytse/jekyll-spaceship.svg?branch=master)](https://travis-ci.org/jeffreytse/jekyll-spaceship)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/jekyll-spaceship.svg)](http://badge.fury.io/rb/jekyll-spaceship)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/jeffreytse/jekyll-spaceship/badges/gpa.svg)](https://codeclimate.com/github/jeffreytse/jekyll-spaceship)
|
6
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/cd56b207f327603662a1/test_coverage)](https://codeclimate.com/github/jeffreytse/jekyll-spaceship/test_coverage)
|
7
|
+
|
8
|
+
A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, etc.
|
9
|
+
|
10
|
+
## Table of Contents
|
11
|
+
|
12
|
+
- [Installation](#installation)
|
13
|
+
- [Usage](#usage)
|
14
|
+
- [1. Table Usage](#1-table-usage)
|
15
|
+
- [1.1 Rowspan and Colspan](#rowspan-and-colspan)
|
16
|
+
- [1.2 Multiline](#multiline)
|
17
|
+
- [1.3 Headerless](#headerless)
|
18
|
+
- [1.4 Cell Alignment](#cell-alignment)
|
19
|
+
- [2. MathJax Usage](#2-mathjax-usage)
|
20
|
+
- [3. PlantUML Usage](#3-plantuml-usage)
|
21
|
+
- [License](#license)
|
22
|
+
|
23
|
+
|
24
|
+
## Installation
|
25
|
+
|
26
|
+
Add jekyll-spaceship plugin in your site's `Gemfile`, and run `bundle install`.
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
gem 'jekyll-spaceship'
|
30
|
+
```
|
31
|
+
|
32
|
+
Add jekyll-spaceship to the `gems:` section in your site's `_config.yml`.
|
33
|
+
|
34
|
+
```yml
|
35
|
+
plugins:
|
36
|
+
- jekyll-spaceship
|
37
|
+
```
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
### 1. Table Usage
|
42
|
+
|
43
|
+
**For now, these extended features are provided:**
|
44
|
+
|
45
|
+
* Cells spanning multiple columns
|
46
|
+
* Cells spanning multiple rows
|
47
|
+
* Cells text align separately
|
48
|
+
* Table header not required
|
49
|
+
* Grouped table header rows or data rows
|
50
|
+
|
51
|
+
Noted that GitHub filters out style property, so the example displays with the obsolete align property. But in actual this plugin outputs style property with text-align CSS attribute.
|
52
|
+
|
53
|
+
#### Rowspan and Colspan
|
54
|
+
^^ in a cell indicates it should be merged with the cell above.
|
55
|
+
This feature is contributed by [pmccloghrylaing](https://github.com/pmccloghrylaing).
|
56
|
+
|
57
|
+
```markdown
|
58
|
+
| Stage | Direct Products | ATP Yields |
|
59
|
+
| ----: | --------------: | ---------: |
|
60
|
+
|Glycolysis | 2 ATP ||
|
61
|
+
|^^ | 2 NADH | 3--5 ATP |
|
62
|
+
|Pyruvaye oxidation | 2 NADH | 5 ATP |
|
63
|
+
|Citric acid cycle | 2 ATP | |
|
64
|
+
|^^ | 6 NADH | 15 ATP |
|
65
|
+
|^^ | 2 FADH | 3 ATP |
|
66
|
+
| 30--32 ATP |||
|
67
|
+
```
|
68
|
+
|
69
|
+
Code above would be parsed as:
|
70
|
+
|
71
|
+
<table>
|
72
|
+
<thead>
|
73
|
+
<tr>
|
74
|
+
<th align="right">Stage</th>
|
75
|
+
<th align="right">Direct Products</th>
|
76
|
+
<th align="right">ATP Yields</th>
|
77
|
+
</tr>
|
78
|
+
</thead>
|
79
|
+
<tbody>
|
80
|
+
<tr>
|
81
|
+
<td align="right" rowspan="2">Glycolysis</td>
|
82
|
+
<td align="right" colspan="2">2 ATP</td>
|
83
|
+
</tr>
|
84
|
+
<tr>
|
85
|
+
<td align="right">2 NADH</td>
|
86
|
+
<td align="right">3–5 ATP</td>
|
87
|
+
</tr>
|
88
|
+
<tr>
|
89
|
+
<td align="right">Pyruvaye oxidation</td>
|
90
|
+
<td align="right">2 NADH</td>
|
91
|
+
<td align="right">5 ATP</td>
|
92
|
+
</tr>
|
93
|
+
<tr>
|
94
|
+
<td align="right" rowspan="3">Citric acid cycle</td>
|
95
|
+
<td align="right" colspan="2">2 ATP</td>
|
96
|
+
</tr>
|
97
|
+
<tr>
|
98
|
+
<td align="right">6 NADH</td>
|
99
|
+
<td align="right">15 ATP</td>
|
100
|
+
</tr>
|
101
|
+
<tr>
|
102
|
+
<td align="right">2 FADH2</td>
|
103
|
+
<td align="right">3 ATP</td>
|
104
|
+
</tr>
|
105
|
+
<tr>
|
106
|
+
<td align="right" colspan="3">30–32 ATP</td>
|
107
|
+
</tr>
|
108
|
+
</tbody>
|
109
|
+
</table>
|
110
|
+
|
111
|
+
#### Multiline
|
112
|
+
A backslash at end to join cell contents with the following lines.
|
113
|
+
This feature is contributed by [Lucas-C](https://github.com/Lucas-C).
|
114
|
+
|
115
|
+
```markdown
|
116
|
+
|: Easy Multiline :|||
|
117
|
+
|:------ |:------ |:-------- |
|
118
|
+
| Apple | Banana | Orange \
|
119
|
+
| Apple | Banana | Orange \
|
120
|
+
| Apple | Banana | Orange
|
121
|
+
| Apple | Banana | Orange \
|
122
|
+
| Apple | Banana | Orange |
|
123
|
+
| Apple | Banana | Orange |
|
124
|
+
```
|
125
|
+
|
126
|
+
Code above would be parsed as:
|
127
|
+
|
128
|
+
<table>
|
129
|
+
<thead>
|
130
|
+
<tr>
|
131
|
+
<th align="center" colspan="3">Easy Multiline</th>
|
132
|
+
</tr>
|
133
|
+
</thead>
|
134
|
+
<tbody>
|
135
|
+
<tr>
|
136
|
+
<td align="left">Apple<br>Apple<br>Apple</td>
|
137
|
+
<td align="left">Banana<br>Banana<br>Banana</td>
|
138
|
+
<td align="left">Orange<br>Orange<br>Orange</td>
|
139
|
+
</tr>
|
140
|
+
<tr>
|
141
|
+
<td align="left">Apple<br>Apple</td>
|
142
|
+
<td align="left">Banana<br>Banana</td>
|
143
|
+
<td align="left">Orange<br>Orange</td>
|
144
|
+
</tr>
|
145
|
+
<tr>
|
146
|
+
<td align="left">Apple</td>
|
147
|
+
<td align="left">Banana</td>
|
148
|
+
<td align="left">Orange</td>
|
149
|
+
</tr>
|
150
|
+
</tbody>
|
151
|
+
</table>
|
152
|
+
|
153
|
+
#### Headerless
|
154
|
+
Table header can be eliminated.
|
155
|
+
|
156
|
+
```markdown
|
157
|
+
|--|--|--|--|--|--|--|--|
|
158
|
+
|♜| |♝|♛|♚|♝|♞|♜|
|
159
|
+
| |♟|♟|♟| |♟|♟|♟|
|
160
|
+
|♟| |♞| | | | | |
|
161
|
+
| |♗| | |♟| | | |
|
162
|
+
| | | | |♙| | | |
|
163
|
+
| | | | | |♘| | |
|
164
|
+
|♙|♙|♙|♙| |♙|♙|♙|
|
165
|
+
|♖|♘|♗|♕|♔| | |♖|
|
166
|
+
```
|
167
|
+
|
168
|
+
Code above would be parsed as:
|
169
|
+
|
170
|
+
<table>
|
171
|
+
<tbody>
|
172
|
+
<tr>
|
173
|
+
<td>♜</td>
|
174
|
+
<td></td>
|
175
|
+
<td>♝</td>
|
176
|
+
<td>♛</td>
|
177
|
+
<td>♚</td>
|
178
|
+
<td>♝</td>
|
179
|
+
<td>♞</td>
|
180
|
+
<td>♜</td>
|
181
|
+
</tr>
|
182
|
+
<tr>
|
183
|
+
<td></td>
|
184
|
+
<td>♟</td>
|
185
|
+
<td>♟</td>
|
186
|
+
<td>♟</td>
|
187
|
+
<td></td>
|
188
|
+
<td>♟</td>
|
189
|
+
<td>♟</td>
|
190
|
+
<td>♟</td>
|
191
|
+
</tr>
|
192
|
+
<tr>
|
193
|
+
<td>♟</td>
|
194
|
+
<td></td>
|
195
|
+
<td>♞</td>
|
196
|
+
<td></td>
|
197
|
+
<td></td>
|
198
|
+
<td></td>
|
199
|
+
<td></td>
|
200
|
+
<td></td>
|
201
|
+
</tr>
|
202
|
+
<tr>
|
203
|
+
<td></td>
|
204
|
+
<td>♗</td>
|
205
|
+
<td></td>
|
206
|
+
<td></td>
|
207
|
+
<td>♟</td>
|
208
|
+
<td></td>
|
209
|
+
<td></td>
|
210
|
+
<td></td>
|
211
|
+
</tr>
|
212
|
+
<tr>
|
213
|
+
<td></td>
|
214
|
+
<td></td>
|
215
|
+
<td></td>
|
216
|
+
<td></td>
|
217
|
+
<td>♙</td>
|
218
|
+
<td></td>
|
219
|
+
<td></td>
|
220
|
+
<td></td>
|
221
|
+
</tr>
|
222
|
+
<tr>
|
223
|
+
<td></td>
|
224
|
+
<td></td>
|
225
|
+
<td></td>
|
226
|
+
<td></td>
|
227
|
+
<td></td>
|
228
|
+
<td>♘</td>
|
229
|
+
<td></td>
|
230
|
+
<td></td>
|
231
|
+
</tr>
|
232
|
+
<tr>
|
233
|
+
<td>♙</td>
|
234
|
+
<td>♙</td>
|
235
|
+
<td>♙</td>
|
236
|
+
<td>♙</td>
|
237
|
+
<td></td>
|
238
|
+
<td>♙</td>
|
239
|
+
<td>♙</td>
|
240
|
+
<td>♙</td>
|
241
|
+
</tr>
|
242
|
+
<tr>
|
243
|
+
<td>♖</td>
|
244
|
+
<td>♘</td>
|
245
|
+
<td>♗</td>
|
246
|
+
<td>♕</td>
|
247
|
+
<td>♔</td>
|
248
|
+
<td></td>
|
249
|
+
<td></td>
|
250
|
+
<td>♖</td>
|
251
|
+
</tr>
|
252
|
+
</tbody>
|
253
|
+
</table>
|
254
|
+
|
255
|
+
#### Cell Alignment
|
256
|
+
Markdown table syntax use colons ":" for forcing column alignment.
|
257
|
+
Therefore, here we also use it for foring cell alignment.
|
258
|
+
|
259
|
+
Table cell can be set alignment separately.
|
260
|
+
|
261
|
+
```
|
262
|
+
|: Fruits \|\| Food :|||
|
263
|
+
|:-------- |:-------- |:------------ |
|
264
|
+
| Apple |: Apple :| Apple \
|
265
|
+
| Banana | Banana | Banana \
|
266
|
+
| Orange | Orange | Orange |
|
267
|
+
|: Rowspan is 4 :|| How's it? |
|
268
|
+
|^^ A. Peach || 1. Fine :|
|
269
|
+
|^^ B. Orange ||^^ 2. Bad |
|
270
|
+
|^^ C. Banana || It's OK! |
|
271
|
+
```
|
272
|
+
|
273
|
+
Code above would be parsed as:
|
274
|
+
|
275
|
+
<table>
|
276
|
+
<thead>
|
277
|
+
<tr>
|
278
|
+
<th align="center" colspan="3">Fruits || Food
|
279
|
+
</tr>
|
280
|
+
</thead>
|
281
|
+
<tbody>
|
282
|
+
<tr>
|
283
|
+
<td align="left">Apple<br>Banana<br>Orange</td>
|
284
|
+
<td align="center">Apple<br>Banana<br>Orange</td>
|
285
|
+
<td align="left">Apple<br>Banana<br>Orange</td>
|
286
|
+
</tr>
|
287
|
+
<tr>
|
288
|
+
<td align="center" rowspan="4" colspan="2">
|
289
|
+
Rowspan is 4
|
290
|
+
<br>A. Peach
|
291
|
+
<br>B. Orange
|
292
|
+
<br>C. Banana
|
293
|
+
</td>
|
294
|
+
</tr>
|
295
|
+
<tr>
|
296
|
+
<td align="left">How's it?</td>
|
297
|
+
</tr>
|
298
|
+
<tr>
|
299
|
+
<td align="right">1. Fine<br>2. Bad</td>
|
300
|
+
</tr>
|
301
|
+
<tr>
|
302
|
+
<td align="left">It' OK!</td>
|
303
|
+
</tr>
|
304
|
+
</tbody>
|
305
|
+
</table>
|
306
|
+
|
307
|
+
|
308
|
+
### 2. MathJax Usage
|
309
|
+
[MathJax](http://www.mathjax.org/) is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers.
|
310
|
+
|
311
|
+
**Some of the main features of MathJax include:**
|
312
|
+
|
313
|
+
* High-quality display of LaTeX, MathML, and AsciiMath notation in HTML pages
|
314
|
+
* Supported in most browsers with no plug-ins, extra fonts, or special
|
315
|
+
setup for the reader
|
316
|
+
* Easy for authors, flexible for publishers, extensible for developers
|
317
|
+
* Supports math accessibility, cut-and-paste interoperability, and other
|
318
|
+
advanced functionality
|
319
|
+
* Powerful API for integration with other web applications
|
320
|
+
|
321
|
+
|
322
|
+
Put your math expression within \$...\$
|
323
|
+
|
324
|
+
```markdown
|
325
|
+
$ a * b = c ^ b $
|
326
|
+
```
|
327
|
+
|
328
|
+
```markdown
|
329
|
+
$ 2^{\frac{n-1}{3}} $
|
330
|
+
```
|
331
|
+
|
332
|
+
```markdown
|
333
|
+
$ \int\_a^b f(x)\,dx. $
|
334
|
+
```
|
335
|
+
|
336
|
+
### 3. PlantUML Usage
|
337
|
+
[PlantUML](http://plantuml.sourceforge.net/) is a component that allows to quickly write:
|
338
|
+
* sequence diagram,
|
339
|
+
* use case diagram,
|
340
|
+
* class diagram,
|
341
|
+
* activity diagram,
|
342
|
+
* component diagram,
|
343
|
+
* state diagram
|
344
|
+
* object diagram
|
345
|
+
|
346
|
+
|
347
|
+
There are two ways to create a diagram in your Jekyll blog page:
|
348
|
+
|
349
|
+
```markdown
|
350
|
+
@startuml
|
351
|
+
Bob -> Alice : hello
|
352
|
+
@enduml
|
353
|
+
```
|
354
|
+
|
355
|
+
or
|
356
|
+
|
357
|
+
````markdown
|
358
|
+
``` plantuml
|
359
|
+
Bob -> Alice : hello world
|
360
|
+
```
|
361
|
+
````
|
362
|
+
|
363
|
+
|
364
|
+
## License
|
365
|
+
This software is licensed under the [MIT license](https://opensource.org/licenses/mit-license.php) © JeffreyTse.
|
@@ -6,7 +6,7 @@ module Jekyll::Spaceship
|
|
6
6
|
class Logger
|
7
7
|
def self.display_info
|
8
8
|
self.log "Jekyll-Spaceship #{Jekyll::Spaceship::VERSION}"
|
9
|
-
self.log "A
|
9
|
+
self.log "A Jekyll plugin to provide powerful supports."
|
10
10
|
self.log "https://github.com/jeffreytse/jekyll-spaceship"
|
11
11
|
end
|
12
12
|
|
@@ -6,17 +6,31 @@ module Jekyll::Spaceship
|
|
6
6
|
|
7
7
|
def on_posts_pre_render(post)
|
8
8
|
# match default plantuml block and code block
|
9
|
-
pattern =
|
9
|
+
pattern = Regexp.union(
|
10
|
+
/(\\?@startuml((?:.|\n)*?)@enduml)/,
|
11
|
+
/(`{3}\s*plantuml((?:.|\n)*?)`{3})/
|
12
|
+
)
|
13
|
+
|
10
14
|
post.content.scan pattern do |match|
|
11
15
|
match = match.filter { |m| not m.nil? }
|
12
16
|
block = match[0]
|
13
17
|
code = match[1]
|
18
|
+
|
19
|
+
# skip escape default plantuml block
|
20
|
+
if block.match? /(^\\@startuml|\\@enduml$)/
|
21
|
+
next
|
22
|
+
end
|
23
|
+
|
14
24
|
Logger.log "handle plantuml block - #{post.path.gsub(/.*_posts\//, '')}"
|
25
|
+
|
15
26
|
post.content = post.content.gsub(
|
16
27
|
block,
|
17
28
|
handle_plantuml(code)
|
18
29
|
)
|
19
30
|
end
|
31
|
+
|
32
|
+
# handle escape default plantuml block
|
33
|
+
post.content = post.content.gsub(/\\(@startuml|@enduml)/, '\1')
|
20
34
|
end
|
21
35
|
|
22
36
|
def handle_plantuml(code)
|
@@ -9,7 +9,10 @@ module Jekyll::Spaceship
|
|
9
9
|
|
10
10
|
def on_posts_pre_render(post)
|
11
11
|
# pre-handle table in markdown
|
12
|
-
post.content = post.content
|
12
|
+
post.content = post.content
|
13
|
+
.gsub(/\|(?=\|)/, '\\|')
|
14
|
+
.gsub(/\\:(?=.*?(?<!\\)\|)/, '\\\\\\\\:')
|
15
|
+
.gsub(/((?<!\\)\|.*?)(\\:)/, '\1\\\\\\\\:')
|
13
16
|
end
|
14
17
|
|
15
18
|
def on_posts_post_render(post)
|
@@ -34,6 +37,7 @@ module Jekyll::Spaceship
|
|
34
37
|
data._[namespace]
|
35
38
|
}
|
36
39
|
|
40
|
+
# handle each table
|
37
41
|
doc.css('table').each do |table|
|
38
42
|
rows = table.css('tr')
|
39
43
|
data.table= table
|
@@ -161,13 +165,13 @@ module Jekyll::Spaceship
|
|
161
165
|
cell.content = cell.content.gsub(/^:/, "")
|
162
166
|
align += 1
|
163
167
|
end
|
164
|
-
if cell.content.match?(/(
|
168
|
+
if cell.content.match?(/(?<!\\):$/)
|
165
169
|
cell.content = cell.content.gsub(/:$/, "")
|
166
170
|
align += 2
|
167
171
|
end
|
168
172
|
|
169
173
|
# handle escape colon
|
170
|
-
cell.content = cell.content.gsub(
|
174
|
+
cell.content = cell.content.gsub(/\\:/, ":")
|
171
175
|
|
172
176
|
# handle text align
|
173
177
|
return if align == 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-spaceship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jeffreytse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- ".gitignore"
|
91
91
|
- Gemfile
|
92
92
|
- LICENSE.txt
|
93
|
+
- README.md
|
93
94
|
- jekyll-spaceship.gemspec
|
94
95
|
- lib/jekyll-spaceship.rb
|
95
96
|
- lib/jekyll-spaceship/cores/logger.rb
|