zarchitect 1.0.2 → 1.0.5
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/lib/zarchitect/content.rb +29 -1
- data/lib/zarchitect/post.rb +2 -3
- data/lib/zarchitect.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec1a57213025231ece03b982ebf9e7145cf521b5d1889f491dd6c1425defda0d
|
|
4
|
+
data.tar.gz: 19decff40b55aff8b31cad0276eac7ac94713d74f68360c01795e2e0db06345f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb657af48d43221378fcf2923c3f0e23840c602412178e0516e17c704abc55c6622a29ae1b0bd4fde4632c55a2bcc38c918082100c8102922b6280d7776d4d40
|
|
7
|
+
data.tar.gz: 91a4123c607e751c52d1012beecbe04f77f43279335cee3ad4fbaf43a649deaeead16b41eec5540ceb836fe756904f21db6ef516f2df821885181060259416bf
|
data/lib/zarchitect/content.rb
CHANGED
|
@@ -106,10 +106,38 @@ class Content < Zarchitect
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
ar.delete_if { |x| x.nil? }
|
|
109
|
+
str = ar.join("\n")
|
|
109
110
|
|
|
111
|
+
if @post.conf.has_option?("katex")
|
|
112
|
+
str2 = ""
|
|
113
|
+
tmp = ""
|
|
114
|
+
i = 0
|
|
115
|
+
l = str.length
|
|
116
|
+
while (i < l)
|
|
117
|
+
if str[i] == "<" && str[i+1] == "?" && str[i+2] == "k" &&
|
|
118
|
+
str[i+3] == "t" && str[i+4] == "x"
|
|
119
|
+
i += 5
|
|
120
|
+
tmp = ""
|
|
121
|
+
loop do
|
|
122
|
+
if str[i] == "?" && str[i+1] == ">"
|
|
123
|
+
str2 << Katex.render(tmp.strip)
|
|
124
|
+
i += 1
|
|
125
|
+
break
|
|
126
|
+
else
|
|
127
|
+
tmp << str[i]
|
|
128
|
+
i += 1
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
else
|
|
132
|
+
str2 << str[i]
|
|
133
|
+
end
|
|
134
|
+
i += 1
|
|
135
|
+
end
|
|
136
|
+
str = str2
|
|
137
|
+
end
|
|
110
138
|
markdown = Redcarpet::Markdown.new(RougeHTML,
|
|
111
139
|
autolink: true)
|
|
112
|
-
chtml = markdown.render(
|
|
140
|
+
chtml = markdown.render(str)
|
|
113
141
|
|
|
114
142
|
parse(chtml)
|
|
115
143
|
|
data/lib/zarchitect/post.rb
CHANGED
|
@@ -148,19 +148,18 @@ class Post < Zarchitect
|
|
|
148
148
|
if @conf.has_option?('description')
|
|
149
149
|
@description = @conf.description << "..."
|
|
150
150
|
elsif @conf.has_option?('preview')
|
|
151
|
-
@description = @conf.preview << "..."
|
|
151
|
+
@description = Sanitize.fragment(@conf.preview) << "..."
|
|
152
152
|
else
|
|
153
153
|
nodes = @content.nodes.select { |n| n.type == "p" }
|
|
154
154
|
if nodes.count > 0
|
|
155
155
|
@description = Sanitize.fragment(nodes[0].html)
|
|
156
156
|
if @description.length > 120
|
|
157
|
-
@description = @description[0..120]
|
|
157
|
+
@description = @description[0..120] << "..."
|
|
158
158
|
end
|
|
159
159
|
else
|
|
160
160
|
@description = ""
|
|
161
161
|
end
|
|
162
162
|
end
|
|
163
|
-
@description << "..."
|
|
164
163
|
end
|
|
165
164
|
|
|
166
165
|
def setup_html
|
data/lib/zarchitect.rb
CHANGED