• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A Markdown shard for the Crystal programming language


コミットメタ情報

リビジョン7e2c36ae62754b847c5baa3ebae529d0c25ab287 (tree)
日時2023-12-28 10:54:19
作者supercell <stigma@disr...>
コミッターsupercell

ログメッセージ

Merge branch 'solvin-master'

変更サマリ

差分

--- a/src/luce/ast.cr
+++ b/src/luce/ast.cr
@@ -20,13 +20,13 @@ module Luce
2020 class Element < Node
2121 getter tag : String
2222 getter children : Array(Node)?
23- getter attributes : Hash(String, String)
23+ getter attributes : Hash(String, String?)
2424 property generated_id : String?
2525 property footnote_label : String?
2626
2727 # Initializes a *tag* Element with *children*.
2828 def initialize(@tag : String, @children : Array(Node)?)
29- @attributes = Hash(String, String).new
29+ @attributes = Hash(String, String?).new
3030 end
3131
3232 # Initializes an empty, self-closing *tag* element.
--- a/src/luce/document.cr
+++ b/src/luce/document.cr
@@ -158,8 +158,8 @@ module Luce
158158 ordinal["fn-#{footnote_labels[i]}"] = i
159159 end
160160 footnotes.sort! do |l, r|
161- idl = l.attributes["id"]? ? l.attributes["id"].downcase : ""
162- idr = r.attributes["id"]? ? r.attributes["id"].downcase : ""
161+ idl = l.attributes["id"]? ? l.attributes["id"].to_s.downcase : ""
162+ idr = r.attributes["id"]? ? r.attributes["id"].to_s.downcase : ""
163163 (ordinal[idl]? || 0) - (ordinal[idr]? || 0)
164164 end
165165 list = Element.new("ol", footnotes + [] of Node)
--- a/src/luce/html_renderer.cr
+++ b/src/luce/html_renderer.cr
@@ -100,7 +100,11 @@ module Luce
100100 buffer << "<#{element.tag}"
101101
102102 element.attributes.each do |key, value|
103- buffer << " #{key}=\"#{value}\""
103+ if v = value
104+ buffer << " #{key}=\"#{v}\""
105+ else
106+ buffer << " #{key}"
107+ end
104108 end
105109
106110 generated_id = element.generated_id