方針 EditToHeaderToFooter

  • 従来の行末にある「~」で行われる改行は、行頭書式に統一すべし。
    • Wikiの行末書式は「~」しかない ⇔ 行頭書式が殆ど
    • 統一した場合、Wikiコードから書式を読むとき、行頭の縦読みだけで済む。
  • 行頭が「;」で始まる「SC改行改段書式/SemiColon改行改段書式」を導入
    • 多くのプログラミングで用いられる文終了記号「;」を次の文の開始記号と再解釈し、行頭に持ってきた。

仕様 EditToHeaderToFooter

  • 行頭が「;」 の行は改行を挿入して、前の行に続ける。
  • 行頭が「;;」の行は改段を挿入する。

改造 EditToHeaderToFooter

  1. lib/convert_html.php で、

    class Body

    function parse

    while (!empty($lines)) 中の下の方に以下のコードを変更・挿入。

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
    
      // Body
      class Body extends Element
      {
          ...
     
          function parse(& $lines)
          {
              ...
     
              while (!empty($lines))
              {
                  ...
                  
                  // The first character
    -             $head = $line{0};
    +             $head  = substr($line,0,1);
    +             $head2 = substr($line,0,2);
    +
    +             // ; Format
    +             if ($head2 == ';;') {// SCNP: SemiColon-NewParagraph
    +                 $this->last = & $this->last->add(new EmptyLine($this->last));           // Same as Empty Line to add Inter-line Space
    +                 $this->last = & $this->last->add(new Paragraph(' '.substr($line, 2)));  // Same as ~-Format to Add Paragraph
    +                 continue;
    +             }
    +             if ($head == ';') {// SCNL: SemiCcolon-NewLine
    +                 $this->last = & $this->last->add(new Inline("\r".substr($line, 1)));  // Same as Default to Add Text
    +                 continue;
    +             }
    
    • -」で始まる行は class Body からの削除。
    • +」で始まる行は class Body への追加。
    初基 一覧 検索 最新 バックアップ リンク元   ヘルプ   最終更新のRSS