PukiWiki/1.4/ちょっと便利に/見出しとリストの拡張
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[PukiWiki/1.4/ちょっと便利に]]
* 見出しを5段まで、リスト階層を無制限に [#v1eb8ee5]
水平線は「-を4つ以上並べ、行末まで空白以外の文字が現れな...
--- 3段目
---- 4段目
----- 5段目
#ref(list_unlimit.diff);
※↑ver 1.4.7でパッチがうまく当たらなかったので、1.4.7用の...
#contents
**コメント [#iae22bc8]
-上記の差分だけではなく、ls2プラグインなど見出しをpreg_ma...
--たとえば、ls2プラグインの187行目あたり
if ($params['title'] and preg_match('/^(\*{1,3})/',$line...
~このほかにもいくつかのプラグインで、preg_match('/^(\*{1,...
-それと、第4階層以下は「リストからの脱出技」が使えないの...
-これは取り込んで欲しいですね。現状の見出し3つだと足らな...
-- 既存のルール体系で書いたコンテンツに簡単に非互換が生じ...
-- 深いネストには欠点もあるので、お好みでお使いください。...
- このDiffの後半に、pcommentプラグインの編集が含まれてい...
-- それと、Diffでの変更点を見ながら、3→5→7に変えてみたの...
--- それから、UPされているdiffのconvert_htmlの書き換え後...
- 見出しのレベル+1 をタグの基準に使っているので、見出しレ...
$this->level++; // h2,h3,h4
- 1.4.7用のパッチはありませんでしょうか? -- [[TOBY]] &ne...
-- 手動でパッチを当てたらうまくいきました。パッチを上げた...
-- 添付できなかったので貼り付けてみました。Pukiwiki 1.4.7...
#comment
----
**Pukiwiki 1.4.7用パッチ [#w5ad6bc7]
- 添付できなかったので貼り付けてみました。Pukiwiki 1.4.7...
diff -u -r pukiwiki-1.4.7_notb/lib/convert_html.php list...
--- pukiwiki-1.4.7_notb/lib/convert_html.php 2006-05-13 ...
+++ list_unlimit_pukiwiki-1.4.7_notb/lib/convert_html.ph...
@@ -238,7 +238,7 @@
{
parent::Element();
- $this->level = min(3, strspn($text, '*'));
+ $this->level = min(5, strspn($text, '*'));
list($text, $this->msg_top, $this->id) = $root->getAn...
$this->insert(Factory_Inline($text));
$this->level++; // h2,h3,h4
@@ -306,7 +306,7 @@
$this->tag = $tag;
$this->tag2 = $tag2;
- $this->level = min(3, strspn($text, $head));
+ $this->level = strspn($text, $head);
$text = ltrim(substr($text, $this->level));
parent::insert(new ListElement($this->level, $tag2));
@@ -426,7 +426,7 @@
parent::Element();
$head = substr($text, 0, 1);
- $this->level = min(3, strspn($text, $head));
+ $this->level = strspn($text, $head);
$text = ltrim(substr($text, $this->level));
if ($head == '<') { // Blockquote close
@@ -846,7 +846,7 @@
}
// Horizontal Rule
- if (substr($line, 0, 4) == '----') {
+ if (preg_match('/^-{4,}\s*$/', $line)) {
$this->insert(new HRule($this, $line));
continue;
}
diff -u -r pukiwiki-1.4.7_notb/lib/html.php list_unlimit...
--- pukiwiki-1.4.7_notb/lib/html.php 2006-04-16 02:33:35...
+++ list_unlimit_pukiwiki-1.4.7_notb/lib/html.php 2008-0...
@@ -382,11 +382,11 @@
// Cut fixed-heading anchors
$id = '';
$matches = array();
- if (preg_match('/^(\*{0,3})(.*?)\[#([A-Za-z][\w-]+)\](...
+ if (preg_match('/^(\*{0,5})(.*?)\[#([A-Za-z][\w-]+)\](...
$str = $matches[2] . $matches[4];
$id = & $matches[3];
} else {
- $str = preg_replace('/^\*{0,3}/', '', $str);
+ $str = preg_replace('/^\*{0,5}/', '', $str);
}
// Cut footnotes and tags
diff -u -r pukiwiki-1.4.7_notb/plugin/pcomment.inc.php ...
--- pukiwiki-1.4.7_notb/plugin/pcomment.inc.php 2005-10-...
+++ list_unlimit_pukiwiki-1.4.7_notb/plugin/pcomment.inc...
@@ -234,14 +234,14 @@
if ($reply_hash != '') {
while ($end_position < $count) {
$matches = array();
- if (preg_match('/^(\-{1,2})(?!\-)(.*)$/', $postdata...
+ if (preg_match('/^(\-+)(.*)$/', $postdata[$end_posi...
&& md5($matches[2]) == $reply_hash)
{
$b_reply = TRUE;
$level = strlen($matches[1]) + 1;
while ($end_position < $count) {
- if (preg_match('/^(\-{1,3})(?!\-)/', $postdata[$e...
+ if (preg_match('/^(\-+)/', $postdata[$end_positio...
&& strlen($matches[1]) < $level) break;
++$end_position;
}
@@ -341,7 +341,7 @@
foreach ($data as $line) {
if ($count > 0 && $dir && $cnt == $count) break;
- if (preg_match('/^(\-{1,2})(?!\-)(.+)$/', $line, $mat...
+ if (preg_match('/^(\-+)(.+)$/', $line, $matches)) {
if ($count > 0 && strlen($matches[1]) == 1 && ++$cnt...
// Ready for radio-buttons
終了行:
[[PukiWiki/1.4/ちょっと便利に]]
* 見出しを5段まで、リスト階層を無制限に [#v1eb8ee5]
水平線は「-を4つ以上並べ、行末まで空白以外の文字が現れな...
--- 3段目
---- 4段目
----- 5段目
#ref(list_unlimit.diff);
※↑ver 1.4.7でパッチがうまく当たらなかったので、1.4.7用の...
#contents
**コメント [#iae22bc8]
-上記の差分だけではなく、ls2プラグインなど見出しをpreg_ma...
--たとえば、ls2プラグインの187行目あたり
if ($params['title'] and preg_match('/^(\*{1,3})/',$line...
~このほかにもいくつかのプラグインで、preg_match('/^(\*{1,...
-それと、第4階層以下は「リストからの脱出技」が使えないの...
-これは取り込んで欲しいですね。現状の見出し3つだと足らな...
-- 既存のルール体系で書いたコンテンツに簡単に非互換が生じ...
-- 深いネストには欠点もあるので、お好みでお使いください。...
- このDiffの後半に、pcommentプラグインの編集が含まれてい...
-- それと、Diffでの変更点を見ながら、3→5→7に変えてみたの...
--- それから、UPされているdiffのconvert_htmlの書き換え後...
- 見出しのレベル+1 をタグの基準に使っているので、見出しレ...
$this->level++; // h2,h3,h4
- 1.4.7用のパッチはありませんでしょうか? -- [[TOBY]] &ne...
-- 手動でパッチを当てたらうまくいきました。パッチを上げた...
-- 添付できなかったので貼り付けてみました。Pukiwiki 1.4.7...
#comment
----
**Pukiwiki 1.4.7用パッチ [#w5ad6bc7]
- 添付できなかったので貼り付けてみました。Pukiwiki 1.4.7...
diff -u -r pukiwiki-1.4.7_notb/lib/convert_html.php list...
--- pukiwiki-1.4.7_notb/lib/convert_html.php 2006-05-13 ...
+++ list_unlimit_pukiwiki-1.4.7_notb/lib/convert_html.ph...
@@ -238,7 +238,7 @@
{
parent::Element();
- $this->level = min(3, strspn($text, '*'));
+ $this->level = min(5, strspn($text, '*'));
list($text, $this->msg_top, $this->id) = $root->getAn...
$this->insert(Factory_Inline($text));
$this->level++; // h2,h3,h4
@@ -306,7 +306,7 @@
$this->tag = $tag;
$this->tag2 = $tag2;
- $this->level = min(3, strspn($text, $head));
+ $this->level = strspn($text, $head);
$text = ltrim(substr($text, $this->level));
parent::insert(new ListElement($this->level, $tag2));
@@ -426,7 +426,7 @@
parent::Element();
$head = substr($text, 0, 1);
- $this->level = min(3, strspn($text, $head));
+ $this->level = strspn($text, $head);
$text = ltrim(substr($text, $this->level));
if ($head == '<') { // Blockquote close
@@ -846,7 +846,7 @@
}
// Horizontal Rule
- if (substr($line, 0, 4) == '----') {
+ if (preg_match('/^-{4,}\s*$/', $line)) {
$this->insert(new HRule($this, $line));
continue;
}
diff -u -r pukiwiki-1.4.7_notb/lib/html.php list_unlimit...
--- pukiwiki-1.4.7_notb/lib/html.php 2006-04-16 02:33:35...
+++ list_unlimit_pukiwiki-1.4.7_notb/lib/html.php 2008-0...
@@ -382,11 +382,11 @@
// Cut fixed-heading anchors
$id = '';
$matches = array();
- if (preg_match('/^(\*{0,3})(.*?)\[#([A-Za-z][\w-]+)\](...
+ if (preg_match('/^(\*{0,5})(.*?)\[#([A-Za-z][\w-]+)\](...
$str = $matches[2] . $matches[4];
$id = & $matches[3];
} else {
- $str = preg_replace('/^\*{0,3}/', '', $str);
+ $str = preg_replace('/^\*{0,5}/', '', $str);
}
// Cut footnotes and tags
diff -u -r pukiwiki-1.4.7_notb/plugin/pcomment.inc.php ...
--- pukiwiki-1.4.7_notb/plugin/pcomment.inc.php 2005-10-...
+++ list_unlimit_pukiwiki-1.4.7_notb/plugin/pcomment.inc...
@@ -234,14 +234,14 @@
if ($reply_hash != '') {
while ($end_position < $count) {
$matches = array();
- if (preg_match('/^(\-{1,2})(?!\-)(.*)$/', $postdata...
+ if (preg_match('/^(\-+)(.*)$/', $postdata[$end_posi...
&& md5($matches[2]) == $reply_hash)
{
$b_reply = TRUE;
$level = strlen($matches[1]) + 1;
while ($end_position < $count) {
- if (preg_match('/^(\-{1,3})(?!\-)/', $postdata[$e...
+ if (preg_match('/^(\-+)/', $postdata[$end_positio...
&& strlen($matches[1]) < $level) break;
++$end_position;
}
@@ -341,7 +341,7 @@
foreach ($data as $line) {
if ($count > 0 && $dir && $cnt == $count) break;
- if (preg_match('/^(\-{1,2})(?!\-)(.+)$/', $line, $mat...
+ if (preg_match('/^(\-+)(.+)$/', $line, $matches)) {
if ($count > 0 && strlen($matches[1]) == 1 && ++$cnt...
// Ready for radio-buttons
ページ名: