zarchitect 1.0.1 → 1.0.4

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: f9315ed3ab45cedda13e7521ce45c56a39d214187f8cd5813c913ef5bd948942
4
- data.tar.gz: e7328e7421f7443638e618be2968c9f1b7fb097cedf20c595540cc25866e3e01
3
+ metadata.gz: 469554302adb7c026b4d3fce6688def41c093072aae0f1d92c728ab65644d7c1
4
+ data.tar.gz: afebeacb1f9fa7ed5721d9a915260d4146608e3ab9b4f67f95687544a97ef71a
5
5
  SHA512:
6
- metadata.gz: dc10f2c7c575ea575e6c5ac0c91f621f17c14e797d34ff48d9732dc407bdd1b5640da5c7242cb3a60da86f9fbecbcb31a08da0009100365f4c9d78029e2bfbf4
7
- data.tar.gz: e6831aa4fd6cc2f60d1e51ee17bf3fead138b46358c3f4cb97696f648449c8b1318cd79dfdfb3cbb8e6b72329b4ae3375b9cdaacd8fae445f61266d647130753
6
+ metadata.gz: aefca6ec59f4bb36de7580e9e1eae6f62f1540c4b298dbdaff6198a69f6314f3ee30ab81c6babf2506da6fc15b016d9733e9c24760c86f5f1136a7851c7cf281
7
+ data.tar.gz: 607cc4bbdf68f8731de85ed3f194b787168cb3afd6ac7e9d8ec421de4521b3d893115f56f72c51e03e3d212fdc506e37a1fe8a92fe058652cab70e235766db16
@@ -106,10 +106,14 @@ 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
+ str = Katex.render(str)
113
+ end
110
114
  markdown = Redcarpet::Markdown.new(RougeHTML,
111
115
  autolink: true)
112
- chtml = markdown.render(ar.join("\n"))
116
+ chtml = markdown.render(str)
113
117
 
114
118
  parse(chtml)
115
119
 
@@ -146,11 +146,16 @@ class Post < Zarchitect
146
146
 
147
147
  def set_description
148
148
  if @conf.has_option?('description')
149
- @description = @conf.description
149
+ @description = @conf.description << "..."
150
+ elsif @conf.has_option?('preview')
151
+ @description = Sanitize.fragment(@conf.preview) << "..."
150
152
  else
151
153
  nodes = @content.nodes.select { |n| n.type == "p" }
152
154
  if nodes.count > 0
153
- @description = Sanitize.fragment(nodes[0])
155
+ @description = Sanitize.fragment(nodes[0].html)
156
+ if @description.length > 120
157
+ @description = @description[0..120] << "..."
158
+ end
154
159
  else
155
160
  @description = ""
156
161
  end
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zarchitect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-22 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Yet another static website generator
14
14
  email: ryu@tohya.net