kisko-suits 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 +4 -4
- data/README.md +2 -1
- data/data/preso_with_variables.md.suits +8 -0
- data/data/preso_with_variables.md_proper +6 -0
- data/data/short_test.md +1 -0
- data/lib/kisko-suits/compiler.rb +12 -1
- data/lib/kisko-suits/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d2cb5fe50c92941b976d082594872a5a557d725
|
4
|
+
data.tar.gz: 873914fa82a5c3e2e69814c52d0657ba7de2ef77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1be5d150c0b89022084aa94adba17456f34af8b40d4d7ed34b18cf04b83a9becb8f5dd6fce3fd9eae633eceb7b723ddd044a14512329beeb1f5c9c80e92b638f
|
7
|
+
data.tar.gz: 7ecb6eff92fa4b61d21b66931be8f6889ee42bebd09777a2c3a7b373c77faa17610f7e8608a1010002e813286693aece25d06c06ad10223085bb270b62ae0e96
|
data/README.md
CHANGED
@@ -25,12 +25,13 @@ my-presentation.md.suits contains normal Markdown content and included portions
|
|
25
25
|
```
|
26
26
|
# Presentation #1
|
27
27
|
|
28
|
+
$$custom_variables = amazing custom variables
|
28
29
|
include: introduction.md
|
29
30
|
include: company/basic_information.md
|
30
31
|
|
31
32
|
## Custom extra information
|
32
33
|
|
33
|
-
All Markdown formatting **works
|
34
|
+
All Markdown formatting **works** and you can use $$custom_variables to save time.
|
34
35
|
|
35
36
|
include: project-details.md
|
36
37
|
include: CVs/antti.md
|
data/data/short_test.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Short test file $$another_variable.
|
data/lib/kisko-suits/compiler.rb
CHANGED
@@ -9,15 +9,17 @@ module KiskoSuits
|
|
9
9
|
@output_filename = nil
|
10
10
|
|
11
11
|
@included_filenames = Set.new
|
12
|
+
@variables = {}
|
12
13
|
end
|
13
14
|
|
14
15
|
def render
|
15
16
|
@included_filenames.clear
|
17
|
+
@variables.clear
|
16
18
|
|
17
19
|
abort "Suits file '#{path}' not found" unless File.exists?(path)
|
18
20
|
|
19
21
|
open_output_file do |output|
|
20
|
-
File.foreach(path) do |line|
|
22
|
+
File.foreach(path).each do |line|
|
21
23
|
output.write(process_line(File.dirname(path), line))
|
22
24
|
end
|
23
25
|
end
|
@@ -28,6 +30,11 @@ module KiskoSuits
|
|
28
30
|
def process_line(root_dir, line)
|
29
31
|
if line.start_with?('[//]:')
|
30
32
|
# It's a comment
|
33
|
+
""
|
34
|
+
elsif line.match(/\s*\$\$\w+\s?=/)
|
35
|
+
variable_name, variable_value = line.split("=").map(&:strip)
|
36
|
+
@variables[variable_name] = variable_value
|
37
|
+
""
|
31
38
|
elsif match = line.match(/\s*include:\s*([\w\.\/]+)/)
|
32
39
|
included_path = "#{root_dir}/#{match[1]}"
|
33
40
|
if File.exists?(included_path)
|
@@ -41,6 +48,10 @@ module KiskoSuits
|
|
41
48
|
""
|
42
49
|
end
|
43
50
|
else
|
51
|
+
@variables.each do |variable_name, variable_value|
|
52
|
+
line.gsub!(Regexp.new(Regexp.escape(variable_name)), variable_value)
|
53
|
+
end
|
54
|
+
|
44
55
|
line
|
45
56
|
end
|
46
57
|
end
|
data/lib/kisko-suits/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kisko-suits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antti Akonniemi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: filewatcher
|
@@ -54,6 +54,9 @@ files:
|
|
54
54
|
- data/folder/what.md
|
55
55
|
- data/preso.md.suits
|
56
56
|
- data/preso.md_proper
|
57
|
+
- data/preso_with_variables.md.suits
|
58
|
+
- data/preso_with_variables.md_proper
|
59
|
+
- data/short_test.md
|
57
60
|
- data/test.md
|
58
61
|
- lib/kisko-suits.rb
|
59
62
|
- lib/kisko-suits/application.rb
|