OSDN Git Service

BugTrack/2426 topicpath plugin - Use CSS layout for slashes redmine_2426_topicpath_slashes
authorumorigu <umorigu@gmail.com>
Wed, 23 Aug 2017 18:58:50 +0000 (03:58 +0900)
committerumorigu <umorigu@gmail.com>
Sat, 26 Aug 2017 21:44:36 +0000 (06:44 +0900)
plugin/topicpath.inc.php
skin/pukiwiki.css

index 6b408cf..96691e5 100644 (file)
@@ -1,14 +1,14 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone
-// $Id: topicpath.inc.php,v 1.9 2011/01/25 15:01:01 henoheno Exp $
-// Copyright (C)
-//   2004-2005 PukiWiki Developers Team
+// topicpath.inc.php
+// Copyright
+//   2004-2017 PukiWiki Development Team
 //   2003      reimy       (Some bug fix)
 //   2003      t.m         (Migrate to 1.3)
 //   2003      Nibun-no-ni (Originally written for PukiWiki 1.4.x)
-// License: GPL (any version)
+// License: GPL v2 or (at your option) any later version
 //
-// 'topicpath' plugin for PukiWiki, available under GPL
+// 'topicpath' plugin for PukiWiki
 
 // Show a link to $defaultpage or not
 define('PLUGIN_TOPICPATH_TOP_DISPLAY', 1);
@@ -17,7 +17,7 @@ define('PLUGIN_TOPICPATH_TOP_DISPLAY', 1);
 define('PLUGIN_TOPICPATH_TOP_LABEL', 'Top');
 
 // Separetor / of / topic / path
-define('PLUGIN_TOPICPATH_TOP_SEPARATOR', ' / ');
+define('PLUGIN_TOPICPATH_TOP_SEPARATOR', '<span class="topicpath-slash">/</span>');
 
 // Show the page itself or not
 define('PLUGIN_TOPICPATH_THIS_PAGE_DISPLAY', 1);
@@ -32,8 +32,9 @@ function plugin_topicpath_convert()
 
 function plugin_topicpath_inline()
 {
-       global $script, $vars, $defaultpage;
+       global $vars, $defaultpage;
 
+       $script = get_script_uri();
        $page = isset($vars['page']) ? $vars['page'] : '';
        if ($page == '' || $page == $defaultpage) return '';
 
@@ -64,10 +65,11 @@ function plugin_topicpath_inline()
                                $element . '</a>';
                }
        }
-
-       if (PLUGIN_TOPICPATH_TOP_DISPLAY)
-               $topic_path[] = make_pagelink($defaultpage, PLUGIN_TOPICPATH_TOP_LABEL);
-
-       return join(PLUGIN_TOPICPATH_TOP_SEPARATOR, array_reverse($topic_path));
+       $s = join(PLUGIN_TOPICPATH_TOP_SEPARATOR, array_reverse($topic_path));
+       if (PLUGIN_TOPICPATH_TOP_DISPLAY) {
+               $s = '<span class="topicpath-top">' .
+                       make_pagelink($defaultpage, PLUGIN_TOPICPATH_TOP_LABEL) .
+                       PLUGIN_TOPICPATH_TOP_SEPARATOR . '</span>' . $s;
+       }
+       return $s;
 }
-
index 411e383..aecbee5 100644 (file)
@@ -610,6 +610,14 @@ td.vote_td2 {
        background-color:#EEF5FF;
 }
 
+/* topicpath.inc.php */
+span.topicpath-slash {
+       margin: 0 0.4em;
+}
+span.topicpath-top {
+       user-select: none;
+}
+
 @media print {
   a:link,
   a:visited {