コミットメタ情報

リビジョンa80b657a6ea96c8ae2b5aef15a388898211f9725 (tree)
日時2017-08-17 02:54:28
作者umorigu <umorigu@gmai...>
コミッターumorigu

ログメッセージ

BugTrack/2188 Replace list-margin px with indent-level calc

* Remove px calclation of List margin and padding

  • Margin and padding are now defined by CSS

* Calc indent-level of nected list. That is used as list-indentN class

変更サマリ

差分

--- a/lib/convert_html.php
+++ b/lib/convert_html.php
@@ -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 {
@@ -321,13 +319,6 @@ class ListContainer extends Element
321319 {
322320 parent::__construct();
323321
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-
331322 $this->tag = $tag;
332323 $this->tag2 = $tag2;
333324 $this->level = min(3, strspn($text, $head));
@@ -346,19 +337,13 @@ class ListContainer extends Element
346337
347338 function setParent(& $parent)
348339 {
349- global $_list_pad_str;
350-
351340 parent::setParent($parent);
352341
353342 $step = $this->level;
354343 if (isset($parent->parent) && is_a($parent->parent, 'ListContainer'))
355344 $step -= $parent->parent->level;
356345
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);
346+ $this->style = sprintf(pkwk_list_attrs_template(), $this->level, $step);
362347 }
363348
364349 function & insert(& $obj)
@@ -1067,16 +1052,12 @@ class Contents_UList extends ListContainer
10671052
10681053 function setParent(& $parent)
10691054 {
1070- global $_list_pad_str;
1071-
10721055 parent::setParent($parent);
10731056 $step = $this->level;
1074- $margin = $this->left_margin;
10751057 if (isset($parent->parent) && is_a($parent->parent, 'ListContainer')) {
10761058 $step -= $parent->parent->level;
1077- $margin = 0;
10781059 }
1079- $margin += $this->margin * ($step == $this->level ? 1 : $step);
1080- $this->style = sprintf($_list_pad_str, $this->level, $margin, $margin);
1060+ $indent_level = ($step == $this->level ? 1 : $step);
1061+ $this->style = sprintf(pkwk_list_attrs_template(), $this->level, $indent_level);
10811062 }
10821063 }
--- a/lib/html.php
+++ b/lib/html.php
@@ -380,7 +380,6 @@ 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;
384383
385384 prepare_links_related($page);
386385 $links = links_get_related($page);
@@ -407,8 +406,7 @@ function make_related($page, $tag = '')
407406 if (empty($_links)) return ''; // Nothing
408407
409408 if ($tag == 'p') { // From the line-head
410- $margin = $_ul_left_margin + $_ul_margin;
411- $style = sprintf($_list_pad_str, 1, $margin, $margin);
409+ $style = sprintf(pkwk_list_attrs_template(), 1, 1);
412410 $retval = "\n" . '<ul' . $style . '>' . "\n" .
413411 '<li>' . join($rule_related_str, $_links) . '</li>' . "\n" .
414412 '</ul>' . "\n";
@@ -645,3 +643,10 @@ function pkwk_output_dtd($pkwk_dtd = PKWK_DTD_XHTML_1_1, $charset = CONTENT_CHAR
645643 return '<meta http-equiv="content-type" content="text/html; charset=' . $charset . '" />' . "\n";
646644 }
647645 }
646+
647+/**
648+ * Get template of List (ul, ol, dl) attributes
649+ */
650+function pkwk_list_attrs_template() {
651+ return ' class="list%d list-indent%d"';
652+}
--- 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,8 +167,6 @@ 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;
171-
172170 $result = & $params['result'];
173171 $saved = & $params['saved'];
174172 $cont = TRUE;
@@ -187,14 +185,14 @@ function plugin_ls2_list_push(& $params, $level)
187185 $cont = FALSE;
188186 array_unshift($saved, $close);
189187
190- $left = ($level == $margin) ? $_ul_left_margin : 0;
188+ $left = 0;
191189 if ($params['compact']) {
192- $left += $_ul_margin; // マージンを固定
190+ $left = 1; // マージンを固定
193191 $level -= ($margin - 1); // レベルを修正
194192 } else {
195- $left += $margin * $_ul_margin;
193+ $left = $margin;
196194 }
197- $str = sprintf($_list_pad_str, $level, $left, $left);
195+ $str = sprintf(pkwk_list_attrs_template(), $level, $left);
198196 array_push($result, sprintf($open, $str));
199197 }
200198
@@ -222,4 +220,3 @@ function plugin_ls2_check_arg($value, & $params)
222220
223221 $params['_args'][] = htmlsc($value); // Link title
224222 }
225-?>
旧リポジトリブラウザで表示