wst-parser 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wst/content.rb +14 -0
- data/lib/wst/page.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a690d57dac83d9f5dd6b85bb0b5868186a40dde
|
4
|
+
data.tar.gz: 0f0f129d630759820b614f29e9640fb60e8335c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f26738511cedf11ee3faee05e39599307b3830c4ae1b876ad4d7f8f83cfc87627cb70fa3928008a474cc1115a1ad4ce5528458fd64cf9b06cc5c725c7cdcd76
|
7
|
+
data.tar.gz: bf5a972f916b962111355bedb10cf091ccfb874d2f485acee31c7ec70bb0f6075dbf3cfc6ffe64a32e73509ce5a013a669a83b5cf04e8f3c101c2f0f4531cabb
|
data/lib/wst/content.rb
CHANGED
@@ -7,6 +7,20 @@ module Wst
|
|
7
7
|
class Content
|
8
8
|
include Configuration
|
9
9
|
|
10
|
+
class << self
|
11
|
+
# param [String] file_path Relative path of the file to save
|
12
|
+
# param [Hash] datas Header datas
|
13
|
+
# param [String] content Content to write
|
14
|
+
def save! file_path, datas, content
|
15
|
+
File.open(file_path, "w") do |file|
|
16
|
+
file.write datas.to_yaml
|
17
|
+
file.write "---\n"
|
18
|
+
file.write "\n"
|
19
|
+
file.write content
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
10
24
|
def initialize file_path, child = nil
|
11
25
|
@file_path = file_path
|
12
26
|
@plain_content = ""
|
data/lib/wst/page.rb
CHANGED
@@ -84,6 +84,22 @@ module Wst
|
|
84
84
|
(xml_pages + haml_pages + md_pages).sort
|
85
85
|
end
|
86
86
|
|
87
|
+
# param [String] file_path Relative path of the file to save
|
88
|
+
# param [Hash] datas Header datas
|
89
|
+
# param [String] content Content to write
|
90
|
+
def save! file_path, datas, content
|
91
|
+
Content.save! file_path, datas, content
|
92
|
+
page = nil
|
93
|
+
if file_path =~ XmlPage.matcher
|
94
|
+
page = XmlPage.new file_path
|
95
|
+
elsif file_path =~ HamlPage.matcher
|
96
|
+
page = HamlPage.new file_path
|
97
|
+
elsif file_path =~ MdPage.matcher
|
98
|
+
page = MdPage.new file_path
|
99
|
+
end
|
100
|
+
page
|
101
|
+
end
|
102
|
+
|
87
103
|
private
|
88
104
|
|
89
105
|
def xml_pages
|