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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30e062bb13035f3e8d254ca6b5870da49c05632db2216808053ad279fe502799
4
- data.tar.gz: b1048c3eff90b5137c85a2fb369d5303613733b81a61dfae7dbe534a77613353
3
+ metadata.gz: ec1a57213025231ece03b982ebf9e7145cf521b5d1889f491dd6c1425defda0d
4
+ data.tar.gz: 19decff40b55aff8b31cad0276eac7ac94713d74f68360c01795e2e0db06345f
5
5
  SHA512:
6
- metadata.gz: b88bdc7df4e7a605d57fa07c7074889706a47c76f541a38eade30e271417933a73e48998bc93524b11d4bc167c35b755d46a063325a0133a00acf0d7e1e1df34
7
- data.tar.gz: 41342f6caf0325d422e6c698d2f576571b933c9bcd5e6d5711add11fe4c5422fb560f84b13e1c2e02a3b03c9d84e6f05e6218f6fdb612974d9756761143dcfaa
6
+ metadata.gz: bb657af48d43221378fcf2923c3f0e23840c602412178e0516e17c704abc55c6622a29ae1b0bd4fde4632c55a2bcc38c918082100c8102922b6280d7776d4d40
7
+ data.tar.gz: 91a4123c607e751c52d1012beecbe04f77f43279335cee3ad4fbaf43a649deaeead16b41eec5540ceb836fe756904f21db6ef516f2df821885181060259416bf
@@ -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(ar.join("\n"))
140
+ chtml = markdown.render(str)
113
141
 
114
142
  parse(chtml)
115
143
 
@@ -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
@@ -4,6 +4,7 @@ require 'erb'
4
4
  require 'sanitize'
5
5
  require 'rss'
6
6
  require 'nokogiri'
7
+ require 'katex'
7
8
 
8
9
  class Zarchitect
9
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zarchitect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryu