X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;ds=sidebyside;f=wiki%2Fwikiformat.cc;h=18b5f883bb16ec4e0966e994b2c69c40cf3810a1;hb=HEAD;hp=2d6870feb42c3c0b28943b0f183507c88c05c3d8;hpb=9207d04ccf956906249962ab97182c31977819e8;p=hmh%2Fhhml.git diff --git a/wiki/wikiformat.cc b/wiki/wikiformat.cc index 2d6870f..18b5f88 100644 --- a/wiki/wikiformat.cc +++ b/wiki/wikiformat.cc @@ -19,7 +19,7 @@ /* WIKIMOTORPRE: セットすると,フォーマット済みテキストブロックの中でインライン要素の解釈を行う。 UTF8JP: セットすると,条件によりパラグラフ内の改行を空白に置き換えない。 - TABLECOMPATFLAG: セットすると,旧形式の表の継続記号もゆるす。 + WIKITABLECOMPATFLAG: セットすると,旧形式の表の継続記号もゆるす。 */ #define kComment "//" @@ -36,9 +36,13 @@ #define kWikiQUOTE '>' #define kWikiQUOTE_e '<' #define kWikiDIV '{' +#define uWikiDIV "{div:" +#define uWikiFORM "{form:" +#define uWikiELEMENT "{element:" #define kWikiDIV_e '}' #define kWikiHR '-' #define kWikiCmd '$' +#define uWikiCmd "$" #define uP "

" #define uPe "

\n" @@ -61,6 +65,7 @@ ustring uWiki (CharConst ("wiki_")); ustring uAWiki (CharConst ("@wiki_")); /*DOC: +$premode:1 ==テキストの整形ルール== */ @@ -127,6 +132,19 @@ void WikiBlockComplex::outputBlock (MotorOutput* out) { ^行頭が他のマークアップ文字になるときは,行頭に^を書く。 空行は,段落を分ける。 + + + 段落と段落の間に空行を2行以上入れると、「
」を出力する。 + +{div:greenbox +マークアップ文字以外の文字で書き出すと,段落になる。 +^行頭が他のマークアップ文字になるときは,行頭に^を書く。 + +空行は,段落を分ける。 + + +段落と段落の間に空行を2行以上入れると、「
」を出力する。 +} */ bool WikiBlockParagraph::nextLine (uiterator b, uiterator e) { @@ -210,11 +228,16 @@ void WikiBlockParagraph::output (MotorOutput* out) { /* ============================================================ */ /*DOC: ===タイトル=== +行頭に=を書くと,タイトルになる。行末の=は,省略可。 + =タイトル1= ==タイトル2== ===タイトル3===#anchor1 - -行頭に=を書くと,タイトルになる。行末の=は,省略可。 +{div:greenbox +=タイトル1= +==タイトル2== +===タイトル3===#anchor1 +} */ @@ -271,8 +294,10 @@ WikiBlock::closeType WikiBlockH::closeLine (uiterator b, uiterator e) { wiki->cur->close (); wiki->cur = NULL; return CloseTrue; + default:; } } + default:; } } // no opening point. @@ -315,9 +340,6 @@ void WikiBlockH::output (MotorOutput* out) { if (checkEmpty ()) return; -// for (i = level0 + 1; i <= level; i ++) { -// outputBeginDiv (i, out); -// } outputBeginDiv (level, out); switch (level) { case 1: out->out_raw (CharConst (uH1)); break; @@ -341,9 +363,6 @@ void WikiBlockH::output (MotorOutput* out) { case 6: out->out_raw (CharConst (uH6e)); break; } outputBlock (out); -// for (i = level; i > level0; i --) { -// outputEndDiv (i, out); -// } outputEndDiv (level, out); } @@ -375,6 +394,9 @@ bool WikiBlockH::checkEmpty () { ===フォーマット済みテキストブロック=== 行頭に空白文字を書くと,
〜
タグで囲まれます。 インライン要素の解釈は行われない。 +{div:greenbox + 行頭に空白文字を書くと,
〜
タグで囲まれます。 +} */ bool WikiBlockPreformatRaw::nextLine (uiterator b, uiterator e) { @@ -388,29 +410,21 @@ bool WikiBlockPreformatRaw::nextLine (uiterator b, uiterator e) { void WikiBlockPreformatRaw::addLine (uiterator b, uiterator e) { markup = *b; -#ifdef WIKIMOTORPRE - if (markup == ' ') { - text.append (wiki->wikiMotor (b + 1, e)); - } else { + + if (markup == ' ') + b ++; + if (wiki->motorPre) { text.append (wiki->wikiMotor (b, e)); - } - text.append (uLF); -#else - if (markup == ' ') { - text.append (b + 1, e); } else { - text.append (b, e); + MotorOutputString o; + o.out_toHTML (ustring (b, e)); + text.append (o.ans); } text.append (uLF); -#endif } void WikiBlockPreformatRaw::output (MotorOutput* out) { -#ifdef WIKIMOTORPRE out->out_raw (CharConst ("
"))->out_toText (text)->out_raw (CharConst ("
\n")); -#else - out->out_raw (CharConst ("
"))->out_toHTML (text)->out_raw (CharConst ("
\n")); -#endif } /* ============================================================ */ @@ -459,33 +473,54 @@ void WikiBlockItemText::output (MotorOutput* out) { if (indentHack) { outputBlock (out); } else { - out->out_raw (CharConst ("out_raw (CharConst (">")); - out->out_toText (html); - outputBlock (out); - out->out_raw (CharConst ("\n")); + if (html.length () > 0) { + out->out_raw (CharConst ("out_raw (CharConst (">")); + out->out_toText (html); + outputBlock (out); + out->out_raw (CharConst ("\n")); + } else { + outputBlock (out); + } } } /* ============================================================ */ /*DOC: ===箇条書き=== -{div:pre -+&*;項目1 -+&*;*項目1-1 -+&#;ナンバリング1 -+&#;#ナンバリング1-2 -+&+;インデント1 -+&+;+インデント1-1 -+&*;''[OPTION1:OPTION2:...:]''TEXT -} + *項目1 + **項目1-1 + #ナンバリング1 + ##ナンバリング1-2 + +インデント1 + ++インデント1-1 + *''[OPTION1:OPTION2:...:]''TEXT + *id=item1:class=style1:onclick=[[ignore:]]:TEXT + 行頭に「*」を書くと,