chmのユーザーコメントを含むPHPマニュアル

これに触発された: Pokhapeマニュアルの更新

個人的には、PHPマニュアルのCHMバージョンを使用する方が便利だと感じています。クイック検索が便利で、インターネットが常に利用できるとは限りません。 しかし、公式ヘルプには組み込みのユーザーコメントがありません。これは非常に便利です。 以前は、マニュアルの拡張バージョンにありましたが、現在はサポートされていません。

Googleに登って、コメント付きのガイドの更新版が見つかりませんでした。 私は自分で作らなければならず、このプロセスは誰でも繰り返すことができます。

必須(すべてはWindowsで行われます):

  1. all.bz2をTMPフォルダーなどのどこかに解凍します
  2. ここでもchmを逆コンパイルします。

    hh -decompile TMP php_manual_en.chm


    すべてのファイル、php_manual_en.hhc、php_manual_en.hhk、およびすべてのhtmlヘルプファイルを含むRESフォルダーを取得します。
  3. 簡単なPHPスクリプトを使用して、HTMLにコメントを埋め込みましょう。

    $notes=fopen( 'tmp/all' , 'r' );
    while ($note=fgets($notes))
    {
    list($id, $sect, $rate, $time, $user, $text)=explode( '|' , $note);

    // PHP
    $text=highlight_string(base64_decode($text), true );
    //
    $text=preg_replace( '/(?<=\w)[&]nbsp;(?=\w)/' , ' ' , $text);


    $file=file_get_contents( 'tmp/res/' .$sect. '.html' );

    $note_body= '
    <div id="usernotes">
    <div class="note">
    <span>'
    .strftime( '%d.%m.%y %H:%M' , $time). '</span> <strong>' .$user. '</strong><br />
    <div class="text">
    <div class="phpcode">
    <code>
    '
    .$text. '
    </code>
    </div>
    </div>
    </div>
    </div>
    '
    ;

    // -
    $file=preg_replace( '%(?=<hr /><div class="manualnavbar")%' , $note_body, $file);

    file_put_contents( 'tmp/res/' .$sect. '.html' , $file);
    }

    *このソースコードは、 ソースコードハイライターで強調表示されました。

TMPフォルダーにphp_manual_en_notes.hhpファイルを作成します。

[OPTIONS]
Binary TOC=Yes
Compatibility=1.1 or later
Compiled file=php_manual_notes_en.chm
Contents file=php_manual_en.hhc
Default Window=manual
Display compile progress=No
Full-text search=Yes
Index file=php_manual_en.hhk
Language=0x409 ()
Title=PHP Manual

[WINDOWS]
manual="PHP Manual","php_manual_en.hhc","php_manual_en.hhk","res/index.html","res/index.html",,,,,0x2520,,0x386e,,0x30000,,,,,,0

[INFOTYPES]


HTML Help Workshopで作成したファイルを開きます。 完成したCHMファイルをコンパイルして取得します。
しかし、ちなみに...いいえ、まだ準備ができていません:)コンパイル中に2つのエラーが発生しました。

HHC5013: Error: URL reference in the TOC cannot be resolved: "res\pharfileinfo.chmod.html".
HHC5013: Error: URL reference in the TOC cannot be resolved: "res\function.chmod.html".


.hhcファイルと.hhkファイルを見ると、大文字と小文字は書かれていないが、実際にはそうではないスラッシュであると想定できます。 実験により、文字列 ".chm"がファイル名に含まれている場合、HTML Help Workshopがそのようなエラーを生成することが示されています。 したがって、ファイルの名前をpharfileinfo_chmod.htmlおよびfunction_chmod.htmlに変更し、.hhcおよび.hhkファイル内のそれらへのリンクを置き換えます。

現在、エラーなしでコンパイルされます。

完成したファイル(2009年8月18日に更新)をここからダウンロードします。
UPD:ファイルの更新、コードの強調表示の追加、長い行の修正
ファイルは23 mbである必要があります-申し訳ありませんが、10 mbファイルは正しくアセンブルされませんでした。

Source: https://habr.com/ru/post/J67366/


All Articles