jekyll-liquid-debug 0.2.2 → 0.2.3
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.
- checksums.yaml +4 -4
- data/README.md +163 -0
- data/jekyll-liquid-debug.gemspec +1 -1
- data/lib/jekyll-liquid-debug/version.rb +2 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e17e174844777be1c2b1ceb65a7a26fbb6ba8c78d1b4efcde01b32f81385937
|
4
|
+
data.tar.gz: 4ee1f8f6ff148b8a7dc6b33d5ca96654e5bb0fc49bdbe4723ff890c799c68c08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a016d74533b67ab881c63cf6f160028003d44f51f48539fd20a4fbd4271604fefc74d39734306ddfbeff6529dfc6b79068e6943b06588d36e73612725296dc9
|
7
|
+
data.tar.gz: 86809db7617ff55ed4e69eb2e046761612b986fb26b7f11deb91adb9ed9158697192df1ec8c529b73412fb85a68968799d2f09c7b6f67d76f9b6f4d400703906
|
data/README.md
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
# Jekyll Liquid Debug
|
2
|
+
|
3
|
+
This program is created to **debug** [`shopify-liquid-template`](https://shopify.github.io/liquid/), which is a type of programing language mainly used to generate static website, especially for [`Jekyll`](https://jekyllrb.com/).
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
To install, execute,
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem install 'jekyll-liquid-debug'
|
12
|
+
```
|
13
|
+
|
14
|
+
|
15
|
+
## Reason of Creation
|
16
|
+
|
17
|
+
Jekyll is an awesome static website generator, it uses `liquid` for coding. However, `liquid` works like a **black-box**, it is not command-line-aware, all those magic things are happening in the backend.
|
18
|
+
|
19
|
+
Many time, we just want to see through what is happening of a single line or a very small piece of snippets, like for many interpreting languages, `print debug-info`. However, `liquid` does not allow us to do this.
|
20
|
+
|
21
|
+
Thus, every time we have to **build & debug** the whole site again and again. It is way too time consuming, and also needing great patiences and efforts. This, definitely, is not what we expected.
|
22
|
+
|
23
|
+
So, it comes to this package.
|
24
|
+
|
25
|
+
With it, you can simply run your `liquid` file in your terminal, to help check either semantic or functioning errors.
|
26
|
+
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
After you successfully installed, show help message,
|
31
|
+
|
32
|
+
```
|
33
|
+
jekyll-liquid-debug -h
|
34
|
+
```
|
35
|
+
|
36
|
+
The options in **Input files** will look like,
|
37
|
+
|
38
|
+
```
|
39
|
+
-f, --file [FILE] input liquid template
|
40
|
+
-t, --html [FILE] input html template
|
41
|
+
-k, --md [FILE] input raw markdown file, precedent for option `-t'
|
42
|
+
--out-html output html file, overwrite may happen
|
43
|
+
--out-md output markdown file, overwrite may happen
|
44
|
+
```
|
45
|
+
|
46
|
+
They are self-explanation.
|
47
|
+
|
48
|
+
|
49
|
+
## Examples
|
50
|
+
|
51
|
+
### Write out default markdown file
|
52
|
+
|
53
|
+
To help developments, a **default** markdown file is created. This file includes all the `Markdown syntax`s used to convert **HTML** file, and to boost debugging, each of those **Text Formatting** is repeated in three times.
|
54
|
+
|
55
|
+
To have a look of this file, run
|
56
|
+
|
57
|
+
```
|
58
|
+
jekyll-liquid-debug --out-md
|
59
|
+
```
|
60
|
+
|
61
|
+
|
62
|
+
### Debug Liquid Template
|
63
|
+
|
64
|
+
If you have a `liquid` coded file, `myfile.liquid`
|
65
|
+
|
66
|
+
```
|
67
|
+
{%- assign my_variable = false -%}
|
68
|
+
{%- assign my_number = 10 -%}
|
69
|
+
{%- if my_variable == true -%}
|
70
|
+
{{ my_number | plus: 1 }}
|
71
|
+
{%- else -%}
|
72
|
+
{{ my_number | minus: 1 }}
|
73
|
+
{%- endif -%}
|
74
|
+
|
75
|
+
{{}}
|
76
|
+
Debug my_number: {{ my_number }}
|
77
|
+
```
|
78
|
+
|
79
|
+
You want to printout `my_number`, you can run,
|
80
|
+
|
81
|
+
```
|
82
|
+
jekyll-liquid-debug -f myfile.liquid
|
83
|
+
```
|
84
|
+
|
85
|
+
Then you will see,
|
86
|
+
|
87
|
+
```
|
88
|
+
Note: using default markdown file < jekyll-markdown.md >
|
89
|
+
9
|
90
|
+
Debug my_number: 10
|
91
|
+
```
|
92
|
+
|
93
|
+
**Note:** empty command `{{}}` in `liquid` works like starting a new line. For more, please refer to [`shopify-liquid-template`](https://shopify.github.io/liquid/). It's mainly used to _separate_ the debug info and other leading messages from white-space-controlling. Otherwise, your debug info may be printed out at the same line.
|
94
|
+
|
95
|
+
I also have a post about the [`liquid-white-space-control`](https://zhongxiang117.github.io/Jekyll/Things-Need-To-Know/liquid-whitespace.html)
|
96
|
+
|
97
|
+
|
98
|
+
### Debug Liquid Template With Raw Markdown As Input
|
99
|
+
|
100
|
+
So what will happen if you want to code a `liquid` with the `Markdown` file?
|
101
|
+
|
102
|
+
The answer is you can use it as the input.
|
103
|
+
|
104
|
+
Please be aware of that, the `Markdown` file you input will be converted to `html` file at background in first, then the new variable `content` will be generated, which you can invoke inside the `liquid`.
|
105
|
+
|
106
|
+
|
107
|
+
For example you have a `Markdown` file, which is under a name `myMarkdown.md`,
|
108
|
+
|
109
|
+
```
|
110
|
+
Good good **study**, day day **up**.
|
111
|
+
|
112
|
+
Add oil!
|
113
|
+
|
114
|
+
Today is a good day, people mountain people sea.
|
115
|
+
|
116
|
+
Know is **know**, noknow is noknow.
|
117
|
+
```
|
118
|
+
|
119
|
+
If you want to remove the `<strong></strong>` tag for words `study` & `up` & `know` after they are converted to `THML`, you can do this, inside your `myfile.liquid`, using **filter** simply `replace` those tags to be empty.
|
120
|
+
|
121
|
+
```
|
122
|
+
{{ content | replace: "<strong>", "" | replace: "</strong>", "" }}
|
123
|
+
```
|
124
|
+
|
125
|
+
Run,
|
126
|
+
|
127
|
+
```
|
128
|
+
jekyll-liquid-debug -f myfile.liquid -m myMarkdown.md
|
129
|
+
```
|
130
|
+
|
131
|
+
**Note:** you can also only convert your raw `Markdown` to `HTML`, by using `jekyll-liquid-debug -m myMarkdown.md --out-html`.
|
132
|
+
|
133
|
+
|
134
|
+
### Debug Liquid Template With HTML As Input
|
135
|
+
|
136
|
+
It works similar like using `Markdown` as the input, with the changing of option,
|
137
|
+
|
138
|
+
```
|
139
|
+
jekyll-liquid-debug -f myfile.liquid -t myHTML.html
|
140
|
+
```
|
141
|
+
|
142
|
+
**Warning:** When both `-t` & `-m` are specified, only your Markdown file for `-m` will be parsed into `liquid` as the variable `content`.
|
143
|
+
|
144
|
+
|
145
|
+
### Show Development Feature
|
146
|
+
|
147
|
+
```
|
148
|
+
jekyll-liquid-debug --feature
|
149
|
+
```
|
150
|
+
|
151
|
+
|
152
|
+
## Dependency
|
153
|
+
|
154
|
+
```
|
155
|
+
gem install liquid
|
156
|
+
gem install kramdown
|
157
|
+
```
|
158
|
+
|
159
|
+
|
160
|
+
## Contributing
|
161
|
+
|
162
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/zhongxiang117/jekyll-liquid-debug.
|
163
|
+
|
data/jekyll-liquid-debug.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.summary = "Light Weight Jekyll Liquid Template Debug Package"
|
10
10
|
s.license = "MIT"
|
11
11
|
s.homepage = "https://github.com/zhongxiang117/jekyll-liquid-debug"
|
12
|
-
s.files = Dir["bin/*","data/*","lib/**/*", "jekyll-liquid-debug.gemspec", "LICENSE"]
|
12
|
+
s.files = Dir["bin/*","data/*","lib/**/*", "jekyll-liquid-debug.gemspec", "LICENSE","README.md"]
|
13
13
|
s.require_paths = ["lib"]
|
14
14
|
|
15
15
|
s.add_dependency("liquid", "~> 4.0.0")
|
@@ -1,8 +1,9 @@
|
|
1
|
-
VERSION = '0.2.
|
1
|
+
VERSION = '0.2.3'
|
2
2
|
|
3
3
|
FEATURE = [
|
4
4
|
'* Version 0.1.0: Ruby-liquid Debug',
|
5
5
|
'* Version 0.2.0: Add Kramdown conversion',
|
6
6
|
'* Version 0.2.1: Change args type from Struct to Hash',
|
7
7
|
'* Version 0.2.2: Optimize the combination of options',
|
8
|
+
'* Version 0.2.3: Add README.md',
|
8
9
|
]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-liquid-debug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xiang Zhong
|
@@ -46,6 +46,7 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- LICENSE
|
49
|
+
- README.md
|
49
50
|
- bin/console
|
50
51
|
- bin/jekyll-liquid-debug
|
51
52
|
- bin/setup
|