コミットメタ情報

リビジョン1ab8355c87012924f70267046959d9a8308ff9f3 (tree)
日時2017-08-16 22:07:49
作者umorigu <umorigu@gmai...>
コミッターumorigu

ログメッセージ

BugTrack/2188 Define List styles by CSS instead of ini files

* Define List styles by CSS instead of ini files
* Remove unused list margin logic
* Remove manual style logic in ls2 plugin

変更サマリ

差分

--- a/default.ini.php
+++ b/default.ini.php
@@ -1,8 +1,8 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone.
3-// $Id: default.ini.php,v 1.25 2005/12/20 14:04:40 henoheno Exp $
4-// Copyright (C)
5-// 2003-2005 PukiWiki Developers Team
3+// default.ini.php
4+// Copyright
5+// 2003-2017 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -30,14 +30,15 @@ $search_word_color = 1;
3030 $list_index = 1;
3131
3232 /////////////////////////////////////////////////
33-// リスト構造の左マージン
33+// Obsolete: リスト構造の左マージン (Leaves for compatibility of plugins)
34+// Use list-n, list1,list2 and list3 CSS class instead
3435 $_ul_left_margin = 0; // リストと画面左端との間隔(px)
3536 $_ul_margin = 16; // リストの階層間の間隔(px)
3637 $_ol_left_margin = 0; // リストと画面左端との間隔(px)
3738 $_ol_margin = 16; // リストの階層間の間隔(px)
3839 $_dl_left_margin = 0; // リストと画面左端との間隔(px)
3940 $_dl_margin = 16; // リストの階層間の間隔(px)
40-$_list_pad_str = ' class="list%d" style="padding-left:%dpx;margin-left:%dpx"';
41+$_list_pad_str = ' class="list-n list%d"';
4142
4243 /////////////////////////////////////////////////
4344 // テキストエリアのカラム数
@@ -178,5 +179,3 @@ $facemark_rules = array(
178179 '&amp;(phoneto);'=>'[phoneto]',
179180 '&amp;(faxto);' => '[faxto]',
180181 );
181-
182-?>
--- a/keitai.ini.php
+++ b/keitai.ini.php
@@ -1,8 +1,8 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone.
3-// $Id: keitai.ini.php,v 1.25 2005/12/10 07:57:30 henoheno Exp $
4-// Copyright (C)
5-// 2002-2005 PukiWiki Developers Team
3+// keitai.ini.php
4+// Copyright
5+// 2002-2017 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -30,7 +30,8 @@ $search_word_color = 0;
3030 $list_index = 0;
3131
3232 /////////////////////////////////////////////////
33-// リスト構造の左マージン
33+// Obsolete: リスト構造の左マージン (Leaves for compatibility of plugins)
34+// Use list-n, list1,list2 and list3 CSS class instead
3435 $_ul_left_margin = 0; // リストと画面左端との間隔(px)
3536 $_ul_margin = 16; // リストの階層間の間隔(px)
3637 $_ol_left_margin = 0; // リストと画面左端との間隔(px)
@@ -383,5 +384,3 @@ switch ($ua_name) {
383384 }
384385
385386 unset($matches, $ua_name, $ua_vers, $ua_agent, $special_rules);
386-
387-?>
--- a/lib/convert_html.php
+++ b/lib/convert_html.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // convert_html.php
44 // Copyright
5-// 2002-2016 PukiWiki Development Team
5+// 2002-2017 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -310,8 +310,6 @@ class ListContainer extends Element
310310 var $tag2;
311311 var $level;
312312 var $style;
313- var $margin;
314- var $left_margin;
315313
316314 function ListContainer($tag, $tag2, $head, $text)
317315 {
@@ -320,14 +318,6 @@ class ListContainer extends Element
320318 function __construct($tag, $tag2, $head, $text)
321319 {
322320 parent::__construct();
323-
324- $var_margin = '_' . $tag . '_margin';
325- $var_left_margin = '_' . $tag . '_left_margin';
326- global $$var_margin, $$var_left_margin;
327-
328- $this->margin = $$var_margin;
329- $this->left_margin = $$var_left_margin;
330-
331321 $this->tag = $tag;
332322 $this->tag2 = $tag2;
333323 $this->level = min(3, strspn($text, $head));
@@ -354,11 +344,7 @@ class ListContainer extends Element
354344 if (isset($parent->parent) && is_a($parent->parent, 'ListContainer'))
355345 $step -= $parent->parent->level;
356346
357- $margin = $this->margin * $step;
358- if ($step == $this->level)
359- $margin += $this->left_margin;
360-
361- $this->style = sprintf($_list_pad_str, $this->level, $margin, $margin);
347+ $this->style = sprintf($_list_pad_str, $this->level);
362348 }
363349
364350 function & insert(& $obj)
@@ -1071,12 +1057,9 @@ class Contents_UList extends ListContainer
10711057
10721058 parent::setParent($parent);
10731059 $step = $this->level;
1074- $margin = $this->left_margin;
10751060 if (isset($parent->parent) && is_a($parent->parent, 'ListContainer')) {
10761061 $step -= $parent->parent->level;
1077- $margin = 0;
10781062 }
1079- $margin += $this->margin * ($step == $this->level ? 1 : $step);
1080- $this->style = sprintf($_list_pad_str, $this->level, $margin, $margin);
1063+ $this->style = sprintf($_list_pad_str, $this->level);
10811064 }
10821065 }
--- a/lib/html.php
+++ b/lib/html.php
@@ -380,7 +380,7 @@ EOD;
380380 function make_related($page, $tag = '')
381381 {
382382 global $script, $vars, $rule_related_str, $related_str;
383- global $_ul_left_margin, $_ul_margin, $_list_pad_str;
383+ global $_list_pad_str;
384384
385385 prepare_links_related($page);
386386 $links = links_get_related($page);
@@ -407,8 +407,7 @@ function make_related($page, $tag = '')
407407 if (empty($_links)) return ''; // Nothing
408408
409409 if ($tag == 'p') { // From the line-head
410- $margin = $_ul_left_margin + $_ul_margin;
411- $style = sprintf($_list_pad_str, 1, $margin, $margin);
410+ $style = sprintf($_list_pad_str, 1);
412411 $retval = "\n" . '<ul' . $style . '>' . "\n" .
413412 '<li>' . join($rule_related_str, $_links) . '</li>' . "\n" .
414413 '</ul>' . "\n";
--- a/plugin/ls2.inc.php
+++ b/plugin/ls2.inc.php
@@ -1,8 +1,8 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone.
3-// $Id: ls2.inc.php,v 1.30 2011/01/25 15:01:01 henoheno Exp $
4-// Copyright (C)
5-// 2002-2004, 2006-2007 PukiWiki Developers Team
3+// ls2.inc.php
4+// Copyright
5+// 2002-2017 PukiWiki Development Team
66 // 2002 panda http://home.arino.jp/?ls2.inc.php
77 // 2002 Y.MASUI GPL2 http://masui.net/pukiwiki/ masui@masui.net (ls.inc.php)
88 // License: GPL version 2
@@ -167,7 +167,7 @@ function plugin_ls2_get_headings($page, & $params, $level, $include = FALSE)
167167 //リスト構造を構築する
168168 function plugin_ls2_list_push(& $params, $level)
169169 {
170- global $_ul_left_margin, $_ul_margin, $_list_pad_str;
170+ global $_list_pad_str;
171171
172172 $result = & $params['result'];
173173 $saved = & $params['saved'];
@@ -187,14 +187,10 @@ function plugin_ls2_list_push(& $params, $level)
187187 $cont = FALSE;
188188 array_unshift($saved, $close);
189189
190- $left = ($level == $margin) ? $_ul_left_margin : 0;
191190 if ($params['compact']) {
192- $left += $_ul_margin; // マージンを固定
193191 $level -= ($margin - 1); // レベルを修正
194- } else {
195- $left += $margin * $_ul_margin;
196192 }
197- $str = sprintf($_list_pad_str, $level, $left, $left);
193+ $str = sprintf($_list_pad_str, $level);
198194 array_push($result, sprintf($open, $str));
199195 }
200196
@@ -222,4 +218,3 @@ function plugin_ls2_check_arg($value, & $params)
222218
223219 $params['_args'][] = htmlsc($value); // Link title
224220 }
225-?>
--- a/skin/pukiwiki.css
+++ b/skin/pukiwiki.css
@@ -2,8 +2,8 @@
22
33 /*!
44 * PukiWiki - Yet another WikiWikiWeb clone.
5- * Copyright (C)
6- * 2002-2016 PukiWiki Development Team
5+ * Copyright
6+ * 2002-2017 PukiWiki Development Team
77 * 2001-2002 Originally written by yu-ji
88 * License: GPL v2 or (at your option) any later version
99 *
@@ -168,6 +168,49 @@ ol.list1 { list-style-type:decimal; }
168168 ol.list2 { list-style-type:lower-roman; }
169169 ol.list3 { list-style-type:lower-alpha; }
170170
171+/* Default list style */
172+.list-n {
173+ padding-left: 16px;
174+ margin-left: 16px
175+}
176+/* Specific list style for list1-list4 */
177+.list1 {
178+ padding-left: 16px;
179+ margin-left: 16px
180+}
181+.list2 {
182+ padding-left: 32px;
183+ margin-left: 32px
184+}
185+.list3 {
186+ padding-left: 48px;
187+ margin-left: 48px
188+}
189+.list1 .list2 {
190+ padding-left: 16px;
191+ margin-left: 16px
192+}
193+.list1 .list3 {
194+ padding-left: 32px;
195+ margin-left: 32px
196+}
197+.list2 .list3 {
198+ padding-left: 16px;
199+ margin-left: 16px
200+}
201+.list1 .list4 {
202+ padding-left: 48px;
203+ margin-left: 48px
204+}
205+.list2 .list4 {
206+ padding-left: 32px;
207+ margin-left: 32px
208+}
209+.list3 .list4 {
210+ padding-left: 16px;
211+ margin-left: 16px
212+}
213+
171214 div.ie5 { text-align:center; }
172215
173216 span.noexists {
--- a/skin/tdiary.css
+++ b/skin/tdiary.css
@@ -70,6 +70,49 @@ ol.list1 { list-style-type:decimal; }
7070 ol.list2 { list-style-type:lower-roman; }
7171 ol.list3 { list-style-type:lower-alpha; }
7272
73+/* Default list style */
74+.list-n {
75+ padding-left: 16px;
76+ margin-left: 16px
77+}
78+/* Specific list style for list1-list4 */
79+.list1 {
80+ padding-left: 16px;
81+ margin-left: 16px
82+}
83+.list2 {
84+ padding-left: 32px;
85+ margin-left: 32px
86+}
87+.list3 {
88+ padding-left: 48px;
89+ margin-left: 48px
90+}
91+.list1 .list2 {
92+ padding-left: 16px;
93+ margin-left: 16px
94+}
95+.list1 .list3 {
96+ padding-left: 32px;
97+ margin-left: 32px
98+}
99+.list2 .list3 {
100+ padding-left: 16px;
101+ margin-left: 16px
102+}
103+.list1 .list4 {
104+ padding-left: 48px;
105+ margin-left: 48px
106+}
107+.list2 .list4 {
108+ padding-left: 32px;
109+ margin-left: 32px
110+}
111+.list3 .list4 {
112+ padding-left: 16px;
113+ margin-left: 16px
114+}
115+
73116 div.ie5 { text-align:center; }
74117
75118 /* NoSuchPage? */
旧リポジトリブラウザで表示