Deprecated: Return type of MediaWiki\Session\PHPSessionHandler::open($save_path, $session_name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/PHPSessionHandler.php on line 205
Deprecated: Return type of MediaWiki\Session\PHPSessionHandler::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/PHPSessionHandler.php on line 220
Deprecated: Return type of MediaWiki\Session\PHPSessionHandler::read($id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/PHPSessionHandler.php on line 234
Deprecated: Return type of MediaWiki\Session\PHPSessionHandler::write($id, $dataStr) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/PHPSessionHandler.php on line 262
Deprecated: Return type of MediaWiki\Session\PHPSessionHandler::destroy($id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/PHPSessionHandler.php on line 368
Deprecated: Return type of MediaWiki\Session\PHPSessionHandler::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/PHPSessionHandler.php on line 389
Deprecated: Return type of Wikimedia\Rdbms\IResultWrapper::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/IResultWrapper.php on line 70
Deprecated: Return type of Wikimedia\Rdbms\IResultWrapper::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/IResultWrapper.php on line 80
Deprecated: Return type of Wikimedia\Rdbms\IResultWrapper::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/IResultWrapper.php on line 75
Deprecated: Return type of Wikimedia\Rdbms\ResultWrapper::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php on line 117
Deprecated: Return type of Wikimedia\Rdbms\ResultWrapper::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php on line 90
Deprecated: Return type of MediaWiki\Session\Session::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 625
Deprecated: Return type of MediaWiki\Session\Session::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 631
Deprecated: Return type of MediaWiki\Session\Session::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 643
Deprecated: Return type of MediaWiki\Session\Session::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 637
Deprecated: Return type of MediaWiki\Session\Session::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 655
Deprecated: Return type of MediaWiki\Session\Session::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 649
Deprecated: Return type of MediaWiki\Session\Session::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 665
Deprecated: Return type of & MediaWiki\Session\Session::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 678
Deprecated: Return type of MediaWiki\Session\Session::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 688
Deprecated: Return type of MediaWiki\Session\Session::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lfg/itchan.official.jp/public_html/wiki/includes/session/Session.php on line 693
Deprecated: Message implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /home/lfg/itchan.official.jp/public_html/wiki/includes/Message.php on line 159
Deprecated: RawMessage implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /home/lfg/itchan.official.jp/public_html/wiki/includes/RawMessage.php on line 34
Deprecated: Creation of dynamic property RequestContext::$recursion is deprecated in /home/lfg/itchan.official.jp/public_html/wiki/includes/context/RequestContext.php on line 326
Deprecated: Creation of dynamic property Parser::$mPreprocessorClass is deprecated in /home/lfg/itchan.official.jp/public_html/wiki/includes/parser/Parser.php on line 279
Deprecated: Creation of dynamic property Parser::$extCite is deprecated in /home/lfg/itchan.official.jp/public_html/wiki/extensions/Cite/includes/Cite.php on line 1296
Deprecated: Creation of dynamic property Parser::$scribunto_engine is deprecated in /home/lfg/itchan.official.jp/public_html/wiki/extensions/Scribunto/includes/common/Hooks.php on line 81
Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /home/lfg/itchan.official.jp/public_html/wiki/includes/parser/Preprocessor_DOM.php on line 845
Warning: Cannot modify header information - headers already sent by (output started at /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php:24) in /home/lfg/itchan.official.jp/public_html/wiki/includes/Feed.php on line 294
Warning: Cannot modify header information - headers already sent by (output started at /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php:24) in /home/lfg/itchan.official.jp/public_html/wiki/includes/Feed.php on line 300
Warning: Cannot modify header information - headers already sent by (output started at /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php:24) in /home/lfg/itchan.official.jp/public_html/wiki/includes/WebResponse.php on line 46
Warning: Cannot modify header information - headers already sent by (output started at /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php:24) in /home/lfg/itchan.official.jp/public_html/wiki/includes/WebResponse.php on line 46
Warning: Cannot modify header information - headers already sent by (output started at /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php:24) in /home/lfg/itchan.official.jp/public_html/wiki/includes/WebResponse.php on line 46
Warning: Cannot modify header information - headers already sent by (output started at /home/lfg/itchan.official.jp/public_html/wiki/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php:24) in /home/lfg/itchan.official.jp/public_html/wiki/includes/WebResponse.php on line 46 http://itchan.official.jp/wiki/index.php?action=history&feed=atom&title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3AHtmlBuilderモジュール:HtmlBuilder - 版の履歴2026-03-25T14:16:31Zこのウィキのこのページに関する変更履歴MediaWiki 1.31.1 Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /home/lfg/itchan.official.jp/public_html/wiki/includes/parser/Preprocessor_DOM.php on line 845
Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /home/lfg/itchan.official.jp/public_html/wiki/includes/parser/Preprocessor_DOM.php on line 845 http://itchan.official.jp/wiki/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:HtmlBuilder&diff=682&oldid=prevいんふぉ™: 1版: テンプレート補充2014-03-16T23:28:31Z<p>1版: テンプレート補充</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<tr class="diff-title" lang="ja">
<td colspan="1" style="background-color: #fff; color: #222; text-align: center;">← 古い版</td>
<td colspan="1" style="background-color: #fff; color: #222; text-align: center;">2014年3月16日 (日) 23:28時点における版</td>
</tr><tr><td colspan="2" class="diff-notice" lang="ja"><div class="mw-diff-empty">(相違点なし)</div>
</td></tr></table>いんふぉ™http://itchan.official.jp/wiki/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:HtmlBuilder&diff=681&oldid=prevFryed-peach: :en:Module:HtmlBuilder 2013年6月8日 (土) 11:21 より2013-06-27T07:02:09Z<p><a href="/wiki/index.php?title=En:Module:HtmlBuilder&action=edit&redlink=1" class="new" title="En:Module:HtmlBuilder (存在しないページ)">en:Module:HtmlBuilder</a> 2013年6月8日 (土) 11:21 より</p>
<p><b>新規ページ</b></p><div>-- Experimental module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface<br />
<br />
local HtmlBuilder = {}<br />
<br />
local metatable = {}<br />
<br />
metatable.__index = function(t, key)<br />
local ret = rawget(t, key)<br />
if ret then<br />
return ret<br />
end<br />
<br />
ret = metatable[key]<br />
if type(ret) == 'function' then<br />
return function(...) <br />
return ret(t, ...) <br />
end <br />
else<br />
return ret<br />
end<br />
end<br />
<br />
metatable.__tostring = function(t)<br />
local ret = {}<br />
t._build(ret)<br />
return table.concat(ret, '')<br />
end<br />
<br />
metatable._build = function(t, ret)<br />
if t.tagName then <br />
table.insert(ret, '<' .. t.tagName)<br />
for i, attr in ipairs(t.attributes) do<br />
table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') <br />
end<br />
if #t.styles > 0 then<br />
table.insert(ret, ' style="')<br />
for i, prop in ipairs(t.styles) do<br />
if type(prop) == 'string' then -- added with cssText()<br />
table.insert(ret, prop .. ';')<br />
else -- added with css()<br />
table.insert(ret, prop.name .. ':' .. prop.val .. ';')<br />
end<br />
end<br />
table.insert(ret, '"')<br />
end<br />
if t.selfClosing then<br />
table.insert(ret, ' /')<br />
end<br />
table.insert(ret, '>') <br />
end<br />
for i, node in ipairs(t.nodes) do<br />
if node then<br />
if type(node) == 'table' then<br />
node._build(ret)<br />
else<br />
table.insert(ret, tostring(node))<br />
end<br />
end<br />
end<br />
if t.tagName and not t.unclosed and not t.selfClosing then<br />
table.insert(ret, '</' .. t.tagName .. '>')<br />
end<br />
end<br />
<br />
metatable.node = function(t, builder)<br />
if builder then<br />
table.insert(t.nodes, builder)<br />
end<br />
return t<br />
end<br />
<br />
metatable.wikitext = function(t, ...) <br />
local vals = {...}<br />
for i = 1, #vals do<br />
if vals[i] then<br />
table.insert(t.nodes, vals[i])<br />
end<br />
end<br />
return t<br />
end<br />
<br />
metatable.newline = function(t)<br />
table.insert(t.nodes, '\n')<br />
return t<br />
end<br />
<br />
metatable.tag = function(t, tagName, args)<br />
args = args or {}<br />
args.parent = t<br />
local builder = HtmlBuilder.create(tagName, args)<br />
table.insert(t.nodes, builder)<br />
return builder<br />
end<br />
<br />
function getAttr(t, name)<br />
for i, attr in ipairs(t.attributes) do<br />
if attr.name == name then<br />
return attr<br />
end<br />
end<br />
end<br />
<br />
metatable.attr = function(t, name, val)<br />
-- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()<br />
if name == 'style' then<br />
t.styles = {val}<br />
return t<br />
end<br />
<br />
local attr = getAttr(t, name)<br />
if attr then<br />
attr.val = val<br />
else<br />
table.insert(t.attributes, {name = name, val = val})<br />
end<br />
<br />
return t<br />
end<br />
<br />
metatable.addClass = function(t, class)<br />
if class then<br />
local attr = getAttr(t, 'class')<br />
if attr then<br />
attr.val = attr.val .. ' ' .. class<br />
else<br />
t.attr('class', class)<br />
end<br />
end<br />
<br />
return t<br />
end<br />
<br />
metatable.css = function(t, name, val)<br />
if type(val) == 'string' or type(val) == 'number' then<br />
for i, prop in ipairs(t.styles) do<br />
if prop.name == name then<br />
prop.val = val<br />
return t<br />
end<br />
end<br />
<br />
table.insert(t.styles, {name = name, val = val})<br />
end<br />
<br />
return t<br />
end<br />
<br />
metatable.cssText = function(t, css)<br />
if css then<br />
table.insert(t.styles, css)<br />
end<br />
return t<br />
end<br />
<br />
metatable.done = function(t)<br />
return t.parent or t<br />
end<br />
<br />
metatable.allDone = function(t)<br />
while t.parent do<br />
t = t.parent<br />
end<br />
return t<br />
end<br />
<br />
function HtmlBuilder.create(tagName, args)<br />
args = args or {}<br />
local builder = {}<br />
setmetatable(builder, metatable)<br />
builder.nodes = {}<br />
builder.attributes = {}<br />
builder.styles = {}<br />
builder.tagName = tagName<br />
builder.parent = args.parent<br />
builder.unclosed = args.unclosed or false<br />
builder.selfClosing = args.selfClosing or false<br />
return builder<br />
end<br />
<br />
return HtmlBuilder</div>Fryed-peach