DokuWiki

It's better when it's simple

ユーザ用ツール

サイト用ツール


ja:devel:parser

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
ja:devel:parser [2009-12-23 09:43] wakutekaja:devel:parser [2013-03-06 15:39] (現在) Klap-in
行 168: 行 168:
 <code php> <code php>
 // Use lookahead in entry pattern... // Use lookahead in entry pattern...
-$Lexer->addEntryPattern('<file>(?=.*\x3C/file\x3E)','base','file');+$Lexer->addEntryPattern('<file>(?=.*</file>)','base','file');
 $Lexer->addExitPattern('</file>','file'); $Lexer->addExitPattern('</file>','file');
 </code> </code>
行 174: 行 174:
 The entry pattern checks it can find a closing ''%%</file>%%'' tag before it enters the state. The entry pattern checks it can find a closing ''%%</file>%%'' tag before it enters the state.
  
-**Note** the use of hex characters in the lookahead is required because there's (probably) a bug in the Lexer hack to make lookaheads possible. Needs investigation. 
  
  
行 202: 行 201:
  
 <code php> <code php>
-$Lexer->addEntryPattern('<file>(?=.*\x3C/file\x3E)','base','file');+$Lexer->addEntryPattern('<file>(?=.*</file>)','base','file');
 $Lexer->addExitPattern('</file>','file'); $Lexer->addExitPattern('</file>','file');
 </code> </code>
行 871: 行 870:
 **Note:** The Parser's ''parse'' method pads the raw wiki text with a preceding and proceeding linefeed character, to make sure particular Lexer states exit correctly, so you may need to subtract 1 from the byte index to get the correct location in the original raw wiki text. The Parser also normalizes linefeeds to Unix style (i.e. all ''%%\r\n%%'' becomes ''%%\n%%'') so the document the Lexer sees may be smaller than the one you actually fed it. **Note:** The Parser's ''parse'' method pads the raw wiki text with a preceding and proceeding linefeed character, to make sure particular Lexer states exit correctly, so you may need to subtract 1 from the byte index to get the correct location in the original raw wiki text. The Parser also normalizes linefeeds to Unix style (i.e. all ''%%\r\n%%'' becomes ''%%\n%%'') so the document the Lexer sees may be smaller than the one you actually fed it.
  
-An example of the instruction array of the [[:syntax]] page can be found [[devel:parser:sample_instructions|here]]+An example of the instruction array of the [[ja:wiki:syntax]] page can be found [[devel:parser:sample_instructions|here]]
  
 ==== Renderer ==== ==== Renderer ====
行 1604: 行 1603:
          
         // The lookahead pattern makes sure there's a closing tag...         // The lookahead pattern makes sure there's a closing tag...
-        $pattern = '<'.$this->color.'>(?=.*\x3C/'.$this->color.'\x3E)';+        $pattern = '<'.$this->color.'>(?=.*</'.$this->color.'>)';
                  
         // arg0: pattern to match to enter this mode         // arg0: pattern to match to enter this mode
行 1776: 行 1775:
     function connectTo($mode) {     function connectTo($mode) {
          
-        $pattern = '<todo>(?=.*\x3C/todo\x3E)';+        $pattern = '<todo>(?=.*</todo>)';
         $this->Lexer->addEntryPattern($pattern,$mode,'todo');         $this->Lexer->addEntryPattern($pattern,$mode,'todo');
     }     }
ja/devel/parser.1261557787.txt.gz · 最終更新: 2009-12-23 09:43 by wakuteka

特に明示されていない限り、本Wikiの内容は次のライセンスに従います: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki