Tidy

目次
  • はじめに
  • インストール/設定
  • 定義済み定数
  • tidy — tidy クラス
    • tidy::body — Tidy パースツリーの <body> タグから始まる tidyNode オブジェクトを返す
    • tidy::cleanRepair — パースされたマークアップに設定に基く誤りの修正を行う
    • tidy::__construct — 新しい tidy オブジェクトを作成する
    • tidy::diagnose — パース、修正されたマークアップの診断を行う
    • tidy::$errorBuffer — 指定したドキュメントのパースで発生した警告とエラーを返す
    • tidy::getConfig — 現在の Tidy の設定を取得する
    • tidy::getHtmlVer — 指定したドキュメントで検出された HTML バージョンを取得する
    • tidy::getOpt — Tidy ドキュメントについて指定した設定オプションの値を返す
    • tidy::getOptDoc — 与えられたオプション名に対するドキュメントを返す
    • tidy::getRelease — Tidy ライブラリのリリース日 (バージョン) を取得する
    • tidy::getStatus — 指定したドキュメントのステータスを取得する
    • tidy::head — Tidy パースツリーの <head> タグから始まる tidyNode オブジェクトを返す
    • tidy::html — Tidy パースツリーの <html> タグから始まる tidyNode オブジェクトを返す
    • tidy::isXhtml — ドキュメントが XHTML ドキュメントかどうかを示す
    • tidy::isXml — ドキュメントが一般的な XML ドキュメント (非 HTML/XHTML) かどうかを示す
    • tidy::parseFile — ファイルまたは URI にあるマークアップをパースする
    • tidy::parseString — 文字列にストアされたドキュメントをパースする
    • tidy::repairFile — ファイルを修正し、それを文字列として返す
    • tidy::repairString — 別途提供される設定ファイルを使用して文字列を修正する
    • tidy::root — Tidy パースツリーのルートを表す tidyNode を返す
  • tidyNode — tidyNode クラス
  • Tidy 関数
    • ob_tidyhandler — バッファを修正するための ob_start コールバック関数
    • tidy_access_count — 指定したドキュメントについて発生したTidyアクセシビリティ警告の数を返す
    • tidy_config_count — 指定したドキュメントについて発生した Tidy 設定エラーの数を返す
    • tidy_error_count — 指定したドキュメントについて発生した Tidy エラーの数を返す
    • tidy_get_output — パースされた Tidy マークアップを表す文字列を返す
    • tidy_warning_count — 指定したドキュメントについて発生した Tidy 警告の数を返す

tidy クラス

はじめに

HTML ファイル中の HTML ノードで、tidy が検出したものです。

クラス概要

tidy
/* プロパティ */
public stringnull $errorBuffer = null;
public stringnull $value = null;
/* メソッド */
public __construct(
    stringnull $filename = null,
    arraystringnull $config = null,
    stringnull $encoding = null,
    bool $useIncludePath = false
)
public tidyNodenull body()
public bool cleanRepair()
public bool diagnose()
public array getConfig()
public int getHtmlVer()
public stringintbool getOpt(string $option)
public stringfalse getOptDoc(string $option)
public string getRelease()
public int getStatus()
public tidyNodenull head()
public tidyNodenull html()
public bool isXhtml()
public bool isXml()
public bool parseFile(
    string $filename,
    arraystringnull $config = null,
    stringnull $encoding = null,
    bool $useIncludePath = false
)
public bool parseString(string $string, arraystringnull $config = null, stringnull $encoding = null)
public static stringfalse repairFile(
    string $filename,
    arraystringnull $config = null,
    stringnull $encoding = null,
    bool $useIncludePath = false
)
public static stringfalse repairString(string $string, arraystringnull $config = null, stringnull $encoding = null)
public tidyNodenull root()

プロパティ

value

ノードをHTMLで表現したもの。ノードを囲むタグを含みます。

tidyNode クラス

はじめに

HTML ファイル中の HTML ノードで、tidy が検出したものです。

クラス概要

final tidyNode
/* プロパティ */
public readonly string $value;
public readonly string $name;
public readonly int $type;
public readonly int $line;
public readonly int $column;
public readonly bool $proprietary;
public readonly intnull $id;
public readonly arraynull $attribute;
public readonly arraynull $child;
/* メソッド */
private __construct()
public tidyNodenull getParent()
public bool hasChildren()
public bool hasSiblings()
public bool isAsp()
public bool isComment()
public bool isHtml()
public bool isJste()
public bool isPhp()
public bool isText()

プロパティ

value

まわりのタグも含む、ノードの HTML 表現

name

HTML ノードの名前

type

ノードの型 (tidy ノード型定数 のうちのひとつ。たとえば TIDY_NODETYPE_PHP)

line

ファイル内でそのタグが存在する行番号

column

ファイル内でそのタグが存在するカラム番号

proprietary

そのノードが独自タグであるかどうかを表す

id

ノードの ID (tag 定数のうちのひとつで、たとえば TIDY_TAG_FRAME)

attribute

現在のノードの属性名 (キー) を表す文字列の配列

child

現在のノードの子を表す tidyNode の配列