リビジョン | 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
@@ -1,8 +1,8 @@ | ||
1 | 1 | <?php |
2 | 2 | // 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 | |
6 | 6 | // 2001-2002 Originally written by yu-ji |
7 | 7 | // License: GPL v2 or (at your option) any later version |
8 | 8 | // |
@@ -30,14 +30,15 @@ $search_word_color = 1; | ||
30 | 30 | $list_index = 1; |
31 | 31 | |
32 | 32 | ///////////////////////////////////////////////// |
33 | -// リスト構造の左マージン | |
33 | +// Obsolete: リスト構造の左マージン (Leaves for compatibility of plugins) | |
34 | +// Use list-n, list1,list2 and list3 CSS class instead | |
34 | 35 | $_ul_left_margin = 0; // リストと画面左端との間隔(px) |
35 | 36 | $_ul_margin = 16; // リストの階層間の間隔(px) |
36 | 37 | $_ol_left_margin = 0; // リストと画面左端との間隔(px) |
37 | 38 | $_ol_margin = 16; // リストの階層間の間隔(px) |
38 | 39 | $_dl_left_margin = 0; // リストと画面左端との間隔(px) |
39 | 40 | $_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"'; | |
41 | 42 | |
42 | 43 | ///////////////////////////////////////////////// |
43 | 44 | // テキストエリアのカラム数 |
@@ -178,5 +179,3 @@ $facemark_rules = array( | ||
178 | 179 | '&(phoneto);'=>'[phoneto]', |
179 | 180 | '&(faxto);' => '[faxto]', |
180 | 181 | ); |
181 | - | |
182 | -?> |
@@ -1,8 +1,8 @@ | ||
1 | 1 | <?php |
2 | 2 | // 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 | |
6 | 6 | // 2001-2002 Originally written by yu-ji |
7 | 7 | // License: GPL v2 or (at your option) any later version |
8 | 8 | // |
@@ -30,7 +30,8 @@ $search_word_color = 0; | ||
30 | 30 | $list_index = 0; |
31 | 31 | |
32 | 32 | ///////////////////////////////////////////////// |
33 | -// リスト構造の左マージン | |
33 | +// Obsolete: リスト構造の左マージン (Leaves for compatibility of plugins) | |
34 | +// Use list-n, list1,list2 and list3 CSS class instead | |
34 | 35 | $_ul_left_margin = 0; // リストと画面左端との間隔(px) |
35 | 36 | $_ul_margin = 16; // リストの階層間の間隔(px) |
36 | 37 | $_ol_left_margin = 0; // リストと画面左端との間隔(px) |
@@ -383,5 +384,3 @@ switch ($ua_name) { | ||
383 | 384 | } |
384 | 385 | |
385 | 386 | unset($matches, $ua_name, $ua_vers, $ua_agent, $special_rules); |
386 | - | |
387 | -?> |
@@ -2,7 +2,7 @@ | ||
2 | 2 | // PukiWiki - Yet another WikiWikiWeb clone |
3 | 3 | // convert_html.php |
4 | 4 | // Copyright |
5 | -// 2002-2016 PukiWiki Development Team | |
5 | +// 2002-2017 PukiWiki Development Team | |
6 | 6 | // 2001-2002 Originally written by yu-ji |
7 | 7 | // License: GPL v2 or (at your option) any later version |
8 | 8 | // |
@@ -310,8 +310,6 @@ class ListContainer extends Element | ||
310 | 310 | var $tag2; |
311 | 311 | var $level; |
312 | 312 | var $style; |
313 | - var $margin; | |
314 | - var $left_margin; | |
315 | 313 | |
316 | 314 | function ListContainer($tag, $tag2, $head, $text) |
317 | 315 | { |
@@ -320,14 +318,6 @@ class ListContainer extends Element | ||
320 | 318 | function __construct($tag, $tag2, $head, $text) |
321 | 319 | { |
322 | 320 | 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 | - | |
331 | 321 | $this->tag = $tag; |
332 | 322 | $this->tag2 = $tag2; |
333 | 323 | $this->level = min(3, strspn($text, $head)); |
@@ -354,11 +344,7 @@ class ListContainer extends Element | ||
354 | 344 | if (isset($parent->parent) && is_a($parent->parent, 'ListContainer')) |
355 | 345 | $step -= $parent->parent->level; |
356 | 346 | |
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); | |
362 | 348 | } |
363 | 349 | |
364 | 350 | function & insert(& $obj) |
@@ -1071,12 +1057,9 @@ class Contents_UList extends ListContainer | ||
1071 | 1057 | |
1072 | 1058 | parent::setParent($parent); |
1073 | 1059 | $step = $this->level; |
1074 | - $margin = $this->left_margin; | |
1075 | 1060 | if (isset($parent->parent) && is_a($parent->parent, 'ListContainer')) { |
1076 | 1061 | $step -= $parent->parent->level; |
1077 | - $margin = 0; | |
1078 | 1062 | } |
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); | |
1081 | 1064 | } |
1082 | 1065 | } |
@@ -380,7 +380,7 @@ EOD; | ||
380 | 380 | function make_related($page, $tag = '') |
381 | 381 | { |
382 | 382 | global $script, $vars, $rule_related_str, $related_str; |
383 | - global $_ul_left_margin, $_ul_margin, $_list_pad_str; | |
383 | + global $_list_pad_str; | |
384 | 384 | |
385 | 385 | prepare_links_related($page); |
386 | 386 | $links = links_get_related($page); |
@@ -407,8 +407,7 @@ function make_related($page, $tag = '') | ||
407 | 407 | if (empty($_links)) return ''; // Nothing |
408 | 408 | |
409 | 409 | 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); | |
412 | 411 | $retval = "\n" . '<ul' . $style . '>' . "\n" . |
413 | 412 | '<li>' . join($rule_related_str, $_links) . '</li>' . "\n" . |
414 | 413 | '</ul>' . "\n"; |
@@ -1,8 +1,8 @@ | ||
1 | 1 | <?php |
2 | 2 | // 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 | |
6 | 6 | // 2002 panda http://home.arino.jp/?ls2.inc.php |
7 | 7 | // 2002 Y.MASUI GPL2 http://masui.net/pukiwiki/ masui@masui.net (ls.inc.php) |
8 | 8 | // License: GPL version 2 |
@@ -167,7 +167,7 @@ function plugin_ls2_get_headings($page, & $params, $level, $include = FALSE) | ||
167 | 167 | //リスト構造を構築する |
168 | 168 | function plugin_ls2_list_push(& $params, $level) |
169 | 169 | { |
170 | - global $_ul_left_margin, $_ul_margin, $_list_pad_str; | |
170 | + global $_list_pad_str; | |
171 | 171 | |
172 | 172 | $result = & $params['result']; |
173 | 173 | $saved = & $params['saved']; |
@@ -187,14 +187,10 @@ function plugin_ls2_list_push(& $params, $level) | ||
187 | 187 | $cont = FALSE; |
188 | 188 | array_unshift($saved, $close); |
189 | 189 | |
190 | - $left = ($level == $margin) ? $_ul_left_margin : 0; | |
191 | 190 | if ($params['compact']) { |
192 | - $left += $_ul_margin; // マージンを固定 | |
193 | 191 | $level -= ($margin - 1); // レベルを修正 |
194 | - } else { | |
195 | - $left += $margin * $_ul_margin; | |
196 | 192 | } |
197 | - $str = sprintf($_list_pad_str, $level, $left, $left); | |
193 | + $str = sprintf($_list_pad_str, $level); | |
198 | 194 | array_push($result, sprintf($open, $str)); |
199 | 195 | } |
200 | 196 |
@@ -222,4 +218,3 @@ function plugin_ls2_check_arg($value, & $params) | ||
222 | 218 | |
223 | 219 | $params['_args'][] = htmlsc($value); // Link title |
224 | 220 | } |
225 | -?> |
@@ -2,8 +2,8 @@ | ||
2 | 2 | |
3 | 3 | /*! |
4 | 4 | * PukiWiki - Yet another WikiWikiWeb clone. |
5 | - * Copyright (C) | |
6 | - * 2002-2016 PukiWiki Development Team | |
5 | + * Copyright | |
6 | + * 2002-2017 PukiWiki Development Team | |
7 | 7 | * 2001-2002 Originally written by yu-ji |
8 | 8 | * License: GPL v2 or (at your option) any later version |
9 | 9 | * |
@@ -168,6 +168,49 @@ ol.list1 { list-style-type:decimal; } | ||
168 | 168 | ol.list2 { list-style-type:lower-roman; } |
169 | 169 | ol.list3 { list-style-type:lower-alpha; } |
170 | 170 | |
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 | + | |
171 | 214 | div.ie5 { text-align:center; } |
172 | 215 | |
173 | 216 | span.noexists { |
@@ -70,6 +70,49 @@ ol.list1 { list-style-type:decimal; } | ||
70 | 70 | ol.list2 { list-style-type:lower-roman; } |
71 | 71 | ol.list3 { list-style-type:lower-alpha; } |
72 | 72 | |
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 | + | |
73 | 116 | div.ie5 { text-align:center; } |
74 | 117 | |
75 | 118 | /* NoSuchPage? */ |