PukiWiki改造/P表組書式
をテンプレートにして作成
[
凌宮
|
初基
|
一覧
|
検索
|
最新
] [
ソース
]
開始行:
TITLE:P表組書式の導入
#indent
#contents
//-- convert_html L498 L507 L530 L636 L668
/////////////////////////////////////////////////////////...
* 方針 [#c85e18a7]
- 便宜上、行頭が「##|##」の表を「P表組/Pipe表組」、行頭...
- P表組では、縦方向の関連性が強いので、空白による整列は...
-- セル内容の前後の空白は無視すべき。
- P表組では、行方向のセル連結は右方向(##&>;##)でも良い...
-- コードは左から右、上から下に向かって読むもの。列方向と...
- 「##&~;##」は列方向のセル連結と、ヘッダ(##th##)の2つ...
-- 「##&>;##」からの連想で、左向き連結に「##&<;##」を、上...
-- 「*」などからの連想で、ヘッダに「##&^;##」を導入。
/////////////////////////////////////////////////////////...
* 仕様 [#o85fbc27]
- セル内の先頭と末尾の空白を無視。
- 「##&>;##」のみのセルは右のセルに連結。
- 「##&^;##」のみのセルは上のセルに連結。
- 「##&<;##」のみのセルは左のセルに連結。(互換仕様)
- 「##&~;##」のみのセルは上のセルに連結。(互換仕様)
- 「##&*;##」で始まるセルはヘッダ(##th##)。
- 「##&~;##」で始まる非空白セルはヘッダ(##th##)。(互換...
/////////////////////////////////////////////////////////...
* 課題 [#ld209315]
- レイアウト上、## |>|xxxx|<| ## のように、連結セルの内容...
- 左からのスキャンと右からのスキャンを纏められると精神的...
/////////////////////////////////////////////////////////...
* 改造 [#l46a1161]
- ##convert_html.php## の ##class TableCell## にて、
#code(diff){{{{
class TableCell extends Element
{
var $tag = 'td'; // {td|th}
+ var $colleft = 0; // ==0: colspan to right by '>...
var $colspan = 1;
var $rowspan = 1;
var $style; // is array('width'=>, 'align'=>...);
}}}}
-- ##$colleft##は行結合方向を表す変数。
--- ##$colleft = 0## ⇔ 左に連結。
--- ##$colleft = 1## ⇔ 右に連結。
- 同クラスの##function TableCell## にて、
#code(diff){{{{
function TableCell($text, $is_template = FALSE)
{
parent::Element();
$this->style = $matches = array();
+ $text = trim($text);
}}}}
-- ##trim## でセル先頭と末尾の空白を除去。
- 同関数 セル結合の分岐にて、
#code(diff){{{{
if ($text == '>') {
+ $this->colleft = 0;
$this->colspan = 0;
+ } else if ($text == '<') {
+ $this->colleft = 1;
+ $this->colspan = 0;
- } else if ($text == '~') {
+ } else if ($text == '^' || $text == '~') {
$this->rowspan = 0;
- } else if (substr($text, 0, 1) == '~') {
+ } else if (substr($text, 0, 1) == '*' || substr(...
$this->tag = 'th';
$text = substr($text, 1);
}
}}}}
-- ##$this->colleft## の追加は連結向きの指定。
-- ##if ($text == '<')## は左向き連結。
-- ##$text == '^' || ## は上向き連結。
-- ##substr($text, 0, 1) == '*' ||## はヘッダ。
- 同関数 セル結合ループにて、右向き連結のオリジナルに対し...
#code(diff){{{{
! // Set colspan and style, from right to left.
+ $stylerow = NULL;
+ foreach (array_keys($this->elements) as $nrow) {
+ $row = & $this->elements[$nrow];
+ if ($this->types[$nrow] == 'c')
+ $stylerow = & $row;
+ $colspan = 1;
! foreach (array_reverse(array_keys($row)) as ...
! if ($row[$ncol]->colspan == 0 && $row[$n...
+ ++$colspan;
+ continue;
+ }
+ if ($row[$ncol]->colspan > 0 && $row[$nc...
+ $row[$ncol]->colspan = $colspan;
+ }
+ if ($stylerow !== NULL) {
+ $row[$ncol]->setStyle($stylerow[$nco...
+ // Inherits column style
+ while (--$colspan)
! $row[$ncol + $colspan]->setStyle...
+ }
+ $colspan = 1;
+ }
+ }
- // Set colspan and style
+ // Set colspan and style, from left to right.
$stylerow = NULL;
foreach (array_keys($this->elements) as $nrow) {
$row = & $this->elements[$nrow];
if ($this->types[$nrow] == 'c')
$stylerow = & $row;
$colspan = 1;
foreach (array_keys($row) as $ncol) {
- if ($row[$ncol]->colspan == 0) {
+ if ($row[$ncol]->colspan == 0 && $row[$n...
++$colspan;
continue;
}
+ if ($row[$ncol]->colspan > 0 && $row[$nc...
$row[$ncol]->colspan = $colspan;
+ }
if ($stylerow !== NULL) {
$row[$ncol]->setStyle($stylerow[$nco...
// Inherits column style
while (--$colspan)
$row[$ncol - $colspan]->setStyle...
}
$colspan = 1;
}
}
}}}}
-- 「##!##」で始まる行は、コピーからの差分。
-- 内側ループ ##foreach (array_reverse(array_keys($row)) ...
-- ##$row[$ncol + $colspan]->setStyle($stylerow[$ncol]->s...
/////////////////////////////////////////////////////////...
終了行:
TITLE:P表組書式の導入
#indent
#contents
//-- convert_html L498 L507 L530 L636 L668
/////////////////////////////////////////////////////////...
* 方針 [#c85e18a7]
- 便宜上、行頭が「##|##」の表を「P表組/Pipe表組」、行頭...
- P表組では、縦方向の関連性が強いので、空白による整列は...
-- セル内容の前後の空白は無視すべき。
- P表組では、行方向のセル連結は右方向(##&>;##)でも良い...
-- コードは左から右、上から下に向かって読むもの。列方向と...
- 「##&~;##」は列方向のセル連結と、ヘッダ(##th##)の2つ...
-- 「##&>;##」からの連想で、左向き連結に「##&<;##」を、上...
-- 「*」などからの連想で、ヘッダに「##&^;##」を導入。
/////////////////////////////////////////////////////////...
* 仕様 [#o85fbc27]
- セル内の先頭と末尾の空白を無視。
- 「##&>;##」のみのセルは右のセルに連結。
- 「##&^;##」のみのセルは上のセルに連結。
- 「##&<;##」のみのセルは左のセルに連結。(互換仕様)
- 「##&~;##」のみのセルは上のセルに連結。(互換仕様)
- 「##&*;##」で始まるセルはヘッダ(##th##)。
- 「##&~;##」で始まる非空白セルはヘッダ(##th##)。(互換...
/////////////////////////////////////////////////////////...
* 課題 [#ld209315]
- レイアウト上、## |>|xxxx|<| ## のように、連結セルの内容...
- 左からのスキャンと右からのスキャンを纏められると精神的...
/////////////////////////////////////////////////////////...
* 改造 [#l46a1161]
- ##convert_html.php## の ##class TableCell## にて、
#code(diff){{{{
class TableCell extends Element
{
var $tag = 'td'; // {td|th}
+ var $colleft = 0; // ==0: colspan to right by '>...
var $colspan = 1;
var $rowspan = 1;
var $style; // is array('width'=>, 'align'=>...);
}}}}
-- ##$colleft##は行結合方向を表す変数。
--- ##$colleft = 0## ⇔ 左に連結。
--- ##$colleft = 1## ⇔ 右に連結。
- 同クラスの##function TableCell## にて、
#code(diff){{{{
function TableCell($text, $is_template = FALSE)
{
parent::Element();
$this->style = $matches = array();
+ $text = trim($text);
}}}}
-- ##trim## でセル先頭と末尾の空白を除去。
- 同関数 セル結合の分岐にて、
#code(diff){{{{
if ($text == '>') {
+ $this->colleft = 0;
$this->colspan = 0;
+ } else if ($text == '<') {
+ $this->colleft = 1;
+ $this->colspan = 0;
- } else if ($text == '~') {
+ } else if ($text == '^' || $text == '~') {
$this->rowspan = 0;
- } else if (substr($text, 0, 1) == '~') {
+ } else if (substr($text, 0, 1) == '*' || substr(...
$this->tag = 'th';
$text = substr($text, 1);
}
}}}}
-- ##$this->colleft## の追加は連結向きの指定。
-- ##if ($text == '<')## は左向き連結。
-- ##$text == '^' || ## は上向き連結。
-- ##substr($text, 0, 1) == '*' ||## はヘッダ。
- 同関数 セル結合ループにて、右向き連結のオリジナルに対し...
#code(diff){{{{
! // Set colspan and style, from right to left.
+ $stylerow = NULL;
+ foreach (array_keys($this->elements) as $nrow) {
+ $row = & $this->elements[$nrow];
+ if ($this->types[$nrow] == 'c')
+ $stylerow = & $row;
+ $colspan = 1;
! foreach (array_reverse(array_keys($row)) as ...
! if ($row[$ncol]->colspan == 0 && $row[$n...
+ ++$colspan;
+ continue;
+ }
+ if ($row[$ncol]->colspan > 0 && $row[$nc...
+ $row[$ncol]->colspan = $colspan;
+ }
+ if ($stylerow !== NULL) {
+ $row[$ncol]->setStyle($stylerow[$nco...
+ // Inherits column style
+ while (--$colspan)
! $row[$ncol + $colspan]->setStyle...
+ }
+ $colspan = 1;
+ }
+ }
- // Set colspan and style
+ // Set colspan and style, from left to right.
$stylerow = NULL;
foreach (array_keys($this->elements) as $nrow) {
$row = & $this->elements[$nrow];
if ($this->types[$nrow] == 'c')
$stylerow = & $row;
$colspan = 1;
foreach (array_keys($row) as $ncol) {
- if ($row[$ncol]->colspan == 0) {
+ if ($row[$ncol]->colspan == 0 && $row[$n...
++$colspan;
continue;
}
+ if ($row[$ncol]->colspan > 0 && $row[$nc...
$row[$ncol]->colspan = $colspan;
+ }
if ($stylerow !== NULL) {
$row[$ncol]->setStyle($stylerow[$nco...
// Inherits column style
while (--$colspan)
$row[$ncol - $colspan]->setStyle...
}
$colspan = 1;
}
}
}}}}
-- 「##!##」で始まる行は、コピーからの差分。
-- 内側ループ ##foreach (array_reverse(array_keys($row)) ...
-- ##$row[$ncol + $colspan]->setStyle($stylerow[$ncol]->s...
/////////////////////////////////////////////////////////...
ページ名:
Anatomy_of_the_Human_Ear_ja.svg
365件
[
詳細
]
line.pukiwiki.php
460件
[
詳細
]
line.diff.php
449件
[
詳細
]
inline.tex
438件
[
詳細
]
convert_html.php
471件
[
詳細
]
eq.inc.php
506件
[
詳細
]
convert.tex
423件
[
詳細
]
codehighlight.php
438件
[
詳細
]
code.inc.php
475件
[
詳細
]
ToHeader.png
234件
[
詳細
]
ToFooter_0.png
202件
[
詳細
]
ToFooter.png
239件
[
詳細
]
ParaEdit.png
245件
[
詳細
]
TexEqMiddleAlign.png
485件
[
詳細
]
[
凌宮
|
初基
|
一覧
|
検索
|
最新
] [
ソース
]