行頭がタブでも整形済テキストになる+タブが除去されない

メッセージ

FormattingRulesでは

行頭が半角空白で始まる行は整形済みテキストとなります。

と記載がありますが、実際には行頭がタブでも整形済テキストになります。

行頭はタブでも良いと思うので、FormattingRules#g72f3a72 を訂正した方が良いんじゃないでしょうか。

おまけの問題

半角空白でスタートする整形済テキストはその半角空白が除去されますが、タブスタートの整形済テキストは行頭のタブが除去されません。

例1:半角空白スタート
	例2:タブスタート

(半角スペースとタブを混ぜてもひと続きの整形済テキストになるの気持ち悪いですね…笑)

該当部分

convert_html.php L780

// ' 'Space-beginning sentence
// ' 'Space-beginning sentence
// ' 'Space-beginning sentence
class Pre extends Element
{
	function Pre(& $root, $text)
	{
		$this->__construct($root, $text);
	}
	function __construct(& $root, $text)
	{
		global $preformat_ltrim;
		parent::__construct();
		$this->elements[] = htmlsc(
			(! $preformat_ltrim || $text == '' || $text[0] != ' ') ? $text : substr($text, 1));
	}
	// :
	// 略
	// :
}

タブ文字が $text[0] != ' ' に引っかかって $text がそのまま出力されています。

convert_html.php L955あたり

// The first character
$head = $line[0];

// :
// 略
// :

// Pre
if ($head == ' ' || $head == "\t") {
	$this->last = & $this->last->add(new Pre($this, $line));
	continue;
}

明確にタブ文字スタート行が整形済テキストだと扱われています。




トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-01-09 (月) 10:32:27
Site admin: PukiWiki Development Team

PukiWiki 1.5.4+ © 2001-2022 PukiWiki Development Team. Powered by PHP 8.2.12. HTML convert time: 0.208 sec.

SourceForge