\n"));
+ out->out_raw (CharConst ("out_raw (CharConst (">\n"));
outputBlock (out);
out->out_raw (CharConst ("
\n"));
break;
@@ -590,6 +633,10 @@ void WikiBlockItem::outputBlock (MotorOutput* out) {
===å®ç¾©ãªã¹ã===
;è¦åºã:説ææ
+{div:greenbox
+;è¦åºã:説ææ
+}
+
*/
bool WikiBlockItemDL::nextLine (uiterator b, uiterator e) {
if (*b == kWikiDL) {
@@ -636,25 +683,28 @@ void WikiBlockItemDL::output (MotorOutput* out) {
表å®ç¾©ã®æåã®è¡ã®æåã®ã«ã©ã ã«ãtable:ããæ¸ãã¨ï¼ãã®è¡ã¯ãã¼ãã«ãªãã·ã§ã³æå®è¡ã«ãªããå±æ§æå®ã®å¾ã«ããã¹ããæ¸ãã¨ï¼è¡¨ã®ãã£ãã·ã§ã³ã«ãªãã
ï¼çªç®ä»¥éã®ã«ã©ã ã¯ï¼ããã©ã«ãã®ã«ã©ã ãªãã·ã§ã³æå®ã«ãªãã
-|table:||c:||
-|h:åå|h:çç¥å½¢|h:æå³|
-|noborder|nb|border="0"ãåºåããã|
-|cellspacing=''integer''|spc=|cellspacingå±æ§ãåºåããã|
-|cellpadding=''integer''||cellpaddingå±æ§ãåºåããã|
-|padding|pad|ãã¼ãã«ã®æ大ã®ã«ã©ã æ°ããã«ã©ã ãå°ãªãè¡ã«ï¼ç©ºã®ã«ã©ã ã追å ããã|
-|expanding|expand|ãã¼ãã«ã®æ大ã®ã«ã©ã æ°ããã«ã©ã ãå°ãªãè¡ã®æå¾ã®ã«ã©ã ãå¼ã延ã°ãã|
-|center|c|ãã¼ãã«ãã»ã³ã¿ãªã³ã°ããã|
-|left|l|ãã¼ãã«ãå·¦å¯ãããã|
-|right|r|ãã¼ãã«ãå³å¯ãããã|
-|id=''name''||idå±æ§ãåºåããã|
-|class=''name,name,...''||classå±æ§ãåºåããã|
-|width=''number'', width=''number''%|w=|widthå±æ§ãåºåããã|
-|bgcolor=#''color''|bg=|bgcolorå±æ§ãåºåããã|
-|onclick=''fn(arg1,arg2,...)''||onClickå±æ§ãåºåããã''name''ã¯defun-wiki-linkã§å®ç¾©ãããã®ã|
-|nowhite|nw||
-|turn||ã»ã«ã®ä¸¦ã³ã®æ¨ªæ¹åã¨ç¸¦æ¹åã交æããã|
-|toptitle|tt|class=toptitleã¨åãã|
-|bottomtitle|bt|class=bottomtitleã¨åãã|
+|table:w=100%:ãã¼ãã«ãªãã·ã§ã³|t:w=20%|c:w=10%|t:|
+|h:ãªãã·ã§ã³|h:çç¥å½¢|h:説æ|
+|'''id='''''ID''||idå±æ§ã|
+|'''class='''''ClassList''||classå±æ§ãè¤æ°ã®ã¯ã©ã¹ãæå®ããå ´åã¯ã³ã³ãåºåãã§é£ããã|
+//|'''data-'''''name'''''='''''ID''||Bootstrapç¨å±æ§ã|
+|'''onclick='''''Link''||onclickå±æ§ãJavascriptãªã³ã¯ã|
+|'''onfocus='''''Link''||onfocuså±æ§ãJavascriptãªã³ã¯ã|
+|'''onblur='''''Link''||onblurå±æ§ãJavascriptãªã³ã¯ã|
+|'''onchange='''''Link''||onchangeå±æ§ãJavascriptãªã³ã¯ã|
+|'''width='''''Size''|'''w='''|widthå±æ§ãåä½ã¯px, pt, in, mm, cm, em, exãã¾ãã¯%ã|
+//|'''height='''''Size''|'''h='''|heightå±æ§ãåä½ã¯px, pt, in, mm, cm, em, exãã¾ãã¯%ã|
+|'''bgcolor='''''Color''|'''bg='''|bgcolorå±æ§ã|
+|'''cellspacing='''''Integer''|'''spc='''|cellspacingå±æ§ãï¼ã³ã³ãã¤ã«æè¨å®ã«ããã|
+|'''cellpadding='''''Integer''||cellpaddingå±æ§ãï¼ã³ã³ãã¤ã«æè¨å®ã«ããã|
+|'''left'''|'''l'''|align="left"å±æ§ã|
+|'''right'''|'''r'''|align="right"å±æ§ã|
+|'''center'''|'''c'''|align="center"å±æ§ã|
+|'''noborder'''|''nb''|border="0"å±æ§ã|
+|'''padding'''|'''pad'''|è¡ã®ã«ã©ã å®ç¾©ãæ大ã«ã©ã æ°ã«æºããªãæï¼ç©ºã®ã«ã©ã ã追å ããã|
+|'''expanding'''|'''expand'''|è¡ã®ã«ã©ã å®ç¾©ãæ大ã«ã©ã æ°ã«æºããªãæï¼æçµã«ã©ã ã伸ã°ãã|
+|'''nowhite'''|'''nw'''|空ã»ã«ã«nbspãåºåããã|
+|'''turn'''||表ã®è¡ã¨åãå
¥ãæ¿ããã|
+ã»è¡ãªãã·ã§ã³
|row:bgcolor=#ff0|&[;&[;Name]]|&[;&[;Value]]|
@@ -662,25 +712,30 @@ void WikiBlockItemDL::output (MotorOutput* out) {
è¡ãªãã·ã§ã³ã§æå®ã§ããå±æ§ã¯ã»ã«ãªãã·ã§ã³ã¨åããã®ã§ããã
+ã»ã»ã«ãªãã·ã§ã³
- |header:åå|class=big:æ±æ¦|
- |header:
-|table:||c:||
-|h:åå|h:çç¥å½¢|h:æå³|
-|header|h|ãããã¿ã°ï¼ï¼ãåºåããã|
-|left|l|ã»ã«å
ã§å·¦å¯ãããã|
-|right|r|å³å¯ãããã|
-|center|c|横æ¹åã§ä¸å¤®ãããããã|
-|top|t|ã»ã«å
ã§ä¸å¯ãããã|
-|middle|m|縦æ¹åã§ä¸å¤®ãããããã|
-|bottom|b|ä¸å¯ãããã|
-|nowrap|nw|ã»ã«å
ã§ã®æãè¿ããç¦æ¢ããã|
-|*||ããã©ã«ãã®ã»ã«ãªãã·ã§ã³ãå«ãï¼å
¨ã¦ã®ã»ã«ãªãã·ã§ã³ãç ´æ£ããã|
-|id=''name''||ã»ã«ã¿ã°ã«idå±æ§ãä»å ããã|
-|class=''name,name,...''||ã»ã«ã¿ã°ã«classå±æ§ãä»å ããã|
-|width=''number''&|;''number''%||ã»ã«ã¿ã°ã«widthå±æ§ãä»å ããã|
-|height=''number''&|;''number''%||ã»ã«ã¿ã°ã«heightå±æ§ãä»å ããã|
-|bgcolor=#''hex''|bg=|ã»ã«ã¿ã°ã«bgå±æ§ãä»å ããã|
-|onclick=''fn(arg1,arg2,...)''||onClickå±æ§ãåºåããã''name''ã¯defun-wiki-linkã§å®ç¾©ãããã®ã|
+// |header:åå|class=big:æ±æ¦|
+// |header:
+
+|table:w=100%:è¡ãªãã·ã§ã³ï¼ã»ã«ãªãã·ã§ã³|t:w=20%|c:w=10%|t:|
+|h:ãªãã·ã§ã³|h:çç¥å½¢|h:説æ|
+|'''id='''''ID''||idå±æ§ã|
+|'''class='''''ClassList''||classå±æ§ãè¤æ°ã®ã¯ã©ã¹ãæå®ããå ´åã¯ã³ã³ãåºåãã§é£ããã|
+//|'''data-'''''name'''''='''''ID''||Bootstrapç¨å±æ§ã|
+|'''onclick='''''Link''||onclickå±æ§ãJavascriptãªã³ã¯ã|
+|'''onfocus='''''Link''||onfocuså±æ§ãJavascriptãªã³ã¯ã|
+|'''onblur='''''Link''||onblurå±æ§ãJavascriptãªã³ã¯ã|
+|'''onchange='''''Link''||onchangeå±æ§ãJavascriptãªã³ã¯ã|
+|'''width='''''Size''|'''w='''|widthå±æ§ãåä½ã¯px, pt, in, mm, cm, em, exãã¾ãã¯%ã|
+|'''height='''''Size''|'''h='''|heightå±æ§ãåä½ã¯px, pt, in, mm, cm, em, exãã¾ãã¯%ã|
+|'''bgcolor='''''Color''|'''bg='''|bgcolorå±æ§ã|
+|'''header'''|'''h'''|thã¿ã°ãåºåããã|
+|'''left'''|'''l'''|align="left"å±æ§ã|
+|'''right'''|'''r'''|align="right"å±æ§ã|
+|'''center'''|'''c'''|align="center"å±æ§ã|
+|'''top'''|'''t'''|valign="top"å±æ§ã|
+|'''middle'''|'''m'''|valign="middle"å±æ§ã|
+|'''bottom'''|'''b'''|valign="bottom"å±æ§ã|
+|'''nowrap'''|'''nw'''|nowrapå±æ§ã|
+|'''*'''||ãªãã·ã§ã³ã®ã¯ãªã¢ã|
|h:çµåè¨å·|h:æå³|
|&<;|å·¦ã®ã»ã«ã¨çµåããã|
@@ -759,7 +814,8 @@ void WikiBlockTable::TableCell::outputTD (WikiFormat* wiki, MotorOutput* out, b
out->out_raw (CharConst (" | out_raw (CharConst (" | 1)
wiki->outputName (out, CharConst ("rowspan"), colspan, false);
@@ -803,7 +859,7 @@ void WikiBlockTable::addLine (uiterator b, uiterator e) {
}
WikiBlock::closeType WikiBlockTable::closeLine (uiterator b, uiterator e) {
-#ifdef TABLECOMPATFLAG
+#ifdef WIKITABLECOMPATFLAG
static uregex re ("^\\}\\}(($)|(\\|)|((!([1-9][0-9]*))?(\\\\|&)$))");
#else
static uregex re ("^\\}\\}(($)|(\\|)|((!([1-9][0-9]*))?(&)$))");
@@ -877,7 +933,7 @@ void WikiBlockTable::addLine_body (uiterator b, uiterator e) {
CellList_t* cols;
bool fmorecell = false;
umatch m;
-#ifdef TABLECOMPATFLAG
+#ifdef WIKITABLECOMPATFLAG
static uregex re ("(!([1-9][0-9]*))?(\\\\|&)$");
#else
static uregex re ("(!([1-9][0-9]*))?(&)$");
@@ -1036,10 +1092,12 @@ void WikiBlockTable::normalize () {
void WikiBlockTable::outputTableTag (MotorOutput* out) {
int i;
+#ifdef WIKITABLEATTRIB
if (attrib.cellspacing < 0)
attrib.cellspacing = 0;
if (attrib.cellpadding < 0)
attrib.cellpadding = 0;
+#endif
out->out_raw (CharConst ("out_raw (CharConst (">\n"));
@@ -1115,6 +1173,19 @@ void WikiBlockTable::outputTBodyCell (WikiFormat* wiki, MotorOutput* out, Table
|VALUE|
|LABEL|VALUE|selected|
+ãªãã·ã§ã³ãã©ã¡ã¼ã¿
+|table:w=100%|t:w=20%|c:w=10%|t:|
+|h:ãªãã·ã§ã³|h:çç¥å½¢|h:説æ|
+|'''id='''''ID''||idå±æ§ã|
+|'''class='''''ClassList''||classå±æ§ãè¤æ°ã®ã¯ã©ã¹ãæå®ããå ´åã¯ã³ã³ãåºåãã§é£ããã|
+//|'''data-'''''name'''''='''''ID''||Bootstrapç¨å±æ§ã|
+|'''onclick='''''Link''||onclickå±æ§ãJavascriptãªã³ã¯ã|
+|'''onfocus='''''Link''||onfocuså±æ§ãJavascriptãªã³ã¯ã|
+|'''onblur='''''Link''||onblurå±æ§ãJavascriptãªã³ã¯ã|
+|'''onchange='''''Link''||onchangeå±æ§ãJavascriptãªã³ã¯ã|
+|'''size='''''Integer''||sizeå±æ§ã|
+|'''multiple'''||multipleå±æ§ã|
+
*/
bool WikiBlockSelect::nextLine (uiterator b, uiterator e) {
if (*b == kWikiTABLE) {
@@ -1214,7 +1285,7 @@ void WikiBlockSelect::output (MotorOutput* out) {
out->out_raw (CharConst (">\n"));
if (attrib.fdefault)
- u = wiki->getVar (name);
+ u = wiki->getVar_string (name);
#ifdef DEBUG2
std::cerr << "u:" << u << uLF;
#endif /* DEBUG */
@@ -1271,26 +1342,50 @@ void WikiBlockQuote::output (MotorOutput* out) {
/* ============================================================ */
/*DOC:
===DIVã¿ã°===
- {div:SideMenu
+ {div:''ClassName''
...
}
- {div:id=Name:SideMenu:onclick=fn()
+ {div:id=''ID'':''ClassName'':onclick=''LinkFunction''
...
}
+ãªãã·ã§ã³ãã©ã¡ã¼ã¿
+|table:w=100%|t:w=20%|c:w=10%|t:|
+|h:ãªãã·ã§ã³|h:çç¥å½¢|h:説æ|
+|'''id='''''ID''||idå±æ§ã|
+|'''class='''''ClassList''||classå±æ§ãè¤æ°ã®ã¯ã©ã¹ãæå®ããå ´åã¯ã³ã³ãåºåãã§é£ããã|
+//|'''data-'''''name'''''='''''ID''||Bootstrapç¨å±æ§ã|
+|'''onclick='''''Link''||onclickå±æ§ãJavascriptãªã³ã¯ã|
+|'''onfocus='''''Link''||onfocuså±æ§ãJavascriptãªã³ã¯ã|
+|'''onblur='''''Link''||onblurå±æ§ãJavascriptãªã³ã¯ã|
+|'''onchange='''''Link''||onchangeå±æ§ãJavascriptãªã³ã¯ã|
+|''ClassList''||class=ã¯çç¥ã§ããã|
+|'''#nop'''||divã¿ã°ãåºåããªããpã¿ã°ãæå¶ããã|
+
*/
bool WikiBlockDiv::nextLine (uiterator b, uiterator e) {
return false;
}
void WikiBlockDiv::addLine (uiterator b, uiterator e) {
- bool rc = matchSkip (b, e, CharConst ("{div:"));
+ bool rc = matchSkip (b, e, CharConst (uWikiDIV)); // {div:
assert (rc);
WikiMotor motor (b, e, wiki);
WikiMotorObjVecPtr vec (new WikiMotorObjVec);
motor.compile (*vec);
attrib.shiftAttrib (vec);
+ {
+ std::vector::const_iterator b = attrib.directlist.begin ();
+ std::vector::const_iterator e = attrib.directlist.end ();
+ for (; b < e; ++ b) {
+ if (match (*b, CharConst ("#nop"))) {
+ nopflag = true;
+ } else {
+ wiki->errorMsg.append (*b).append (CharConst (": bad attribute.\n"));
+ }
+ }
+ }
}
WikiBlock::closeType WikiBlockDiv::closeLine (uiterator b, uiterator e) {
@@ -1306,44 +1401,72 @@ WikiBlock::closeType WikiBlockDiv::closeLine (uiterator b, uiterator e) {
void WikiBlockDiv::output (MotorOutput* out) {
bool nonl = false;
- if (block.size () == 1 && block[0].type == BlockParagraph) {
- WikiBlockParagraph* b = WikiBlockParagraph_type (&block[0]);
- if (! b->pflag) {
- b->singleTag = true;
- nonl = true;
+ if (nopflag) {
+ boost::ptr_vector::iterator b = block.begin ();
+ boost::ptr_vector::iterator e = block.end ();
+ for (; b < e; ++ b) {
+ if (b->type == BlockParagraph) {
+ WikiBlockParagraph* p = WikiBlockParagraph_type (&(*b));
+ if (! p->pflag) {
+ p->singleTag = true;
+ nonl = true;
+ }
+ }
}
+ } else {
+ if (block.size () == 1 && block[0].type == BlockParagraph) {
+ WikiBlockParagraph* b = WikiBlockParagraph_type (&block[0]);
+ if (! b->pflag) {
+ b->singleTag = true;
+ nonl = true;
+ }
+ }
+ out->out_raw (CharConst ("out_raw (CharConst (">"));
+ else
+ out->out_raw (CharConst (">\n"));
}
- out->out_raw (CharConst (" out_raw (CharConst (">"));
- else
- out->out_raw (CharConst (">\n"));
outputBlock (out);
- out->out_raw (CharConst (" \n"));
+ if (! nopflag) {
+ out->out_raw (CharConst (" \n"));
+ } else {
+ out->out_raw (uLF);
+ }
}
/* ============================================================ */
/*DOC:
===FORMã¿ã°===
- {form:POST:post.hml
+ {form:POST:''URL''
...
}
-// {form:POST:id=form1:class=formclass:post.hml
-// {form:POST:post.hml:id=form1:class=formclass
- {form:POST:post.hml:target=target_window:id=form1:class=formclass
+ {form:POST:''URL'':target=''TargetWindow'':id=''ID'':class=''ClassName''
...
}
+ãªãã·ã§ã³ãã©ã¡ã¼ã¿
+|table:w=100%|t:w=20%|c:w=10%|t:|
+|h:ãªãã·ã§ã³|h:çç¥å½¢|h:説æ|
+|'''id='''''ID''||idå±æ§ã|
+|'''class='''''ClassList''||classå±æ§ãè¤æ°ã®ã¯ã©ã¹ãæå®ããå ´åã¯ã³ã³ãåºåãã§é£ããã|
+//|'''data-'''''name'''''='''''ID''||Bootstrapç¨å±æ§ã|
+|'''onclick='''''Link''||onclickå±æ§ãJavascriptãªã³ã¯ã|
+|'''onfocus='''''Link''||onfocuså±æ§ãJavascriptãªã³ã¯ã|
+|'''onblur='''''Link''||onblurå±æ§ãJavascriptãªã³ã¯ã|
+|'''onchange='''''Link''||onchangeå±æ§ãJavascriptãªã³ã¯ã|
+|'''target='''''Window''||targetå±æ§ã|
+
*/
bool WikiBlockForm::nextLine (uiterator b, uiterator e) {
return false;
}
void WikiBlockForm::addLine (uiterator b, uiterator e) {
- bool rc = matchSkip (b, e, CharConst ("{form:"));
+// bool rc = matchSkip (b, e, CharConst ("{form:"));
+ bool rc = matchSkip (b, e, CharConst (uWikiFORM));
assert (rc);
-
WikiMotor motor (b, e, wiki);
WikiMotorObjVecPtr vec (new WikiMotorObjVec);
ustring key;
@@ -1404,6 +1527,54 @@ void WikiBlockForm::output (MotorOutput* out) {
/* ============================================================ */
/*DOC:
+===Elementãããã¯===
+ {element:''Name''
+ ...
+ }
+
+Wikiããã¹ãã®ååä»ããããã¯ã
+
+*/
+bool WikiBlockElement::nextLine (uiterator b, uiterator e) {
+ return false;
+}
+
+void WikiBlockElement::addLine (uiterator b, uiterator e) {
+ bool rc = matchSkip (b, e, CharConst (uWikiELEMENT));
+ assert (rc);
+ WikiMotor motor (b, e, wiki);
+ WikiMotorObjVecPtr vec (new WikiMotorObjVec);
+ WikiMotorObjVecPtr v2 (new WikiMotorObjVec);
+
+ motor.compile (*vec);
+ vec->splitChar_keyword (':', name, *v2);
+ if (name.size () == 0) {
+ wiki->errorMsg.append (CharConst ("missing name in the element block."));
+ }
+ if (v2->size () > 0) {
+ wiki->errorMsg.append (v2->dump ()).append (CharConst (": bad attribute.\n"));
+ }
+ if (name.size () > 0) {
+ wiki->elementMap.put (name, this);
+ }
+}
+
+WikiBlock::closeType WikiBlockElement::closeLine (uiterator b, uiterator e) {
+ if (e - b == 1 && *b == kWikiDIV_e) {
+ wiki->pop_block ();
+ wiki->cur = NULL;
+ return CloseTrue;
+ } else {
+ return CloseFalse;
+ }
+}
+
+void WikiBlockElement::output (MotorOutput* out) {
+//*** outputBlock (out);
+}
+
+/* ============================================================ */
+/*DOC:
===æ°´å¹³ç·===
----
@@ -1434,30 +1605,93 @@ void WikiBlockRaw::output (MotorOutput* out) {
}
/* ============================================================ */
+bool WikiBlockBlank::nextLine (uiterator b, uiterator e) {
+ if (b == e) {
+ count ++;
+ return true;
+ } else {
+ switch (*b) { // paragraph以å¤ã®å
¨ã¦
+ case kWikiH:
+ case kWikiPRE:
+ case kWikiPRE2:
+ case kWikiUL:
+ case kWikiOL:
+ case kWikiNL:
+ case kWikiDL:
+ case kWikiTABLE:
+ count = 0;
+ break;
+ default:
+ if ((*b == kWikiQUOTE && e - b == 1) ||
+ matchHead (b, e, CharConst (uWikiDIV)) ||
+ (wiki->curform == NULL && matchHead (b, e, CharConst (uWikiFORM))) ||
+ (wiki->curform == NULL && matchHead (b, e, CharConst (uWikiELEMENT))) ||
+ matchHead (b, e, CharConst ("----"))) {
+ count = 0;
+ } else {
+ if (count >= 2)
+ enable = true;
+ }
+ }
+ return false;
+ }
+}
+
+void WikiBlockBlank::addLine (uiterator b, uiterator e) {
+ count ++;
+}
+
+void WikiBlockBlank::output (MotorOutput* out) {
+ if (enable) {
+ out->out_raw (CharConst ("\n"));
+ }
+}
+
+/* ============================================================ */
void WikiFormat::pass1 (const ustring& text, WikiLine::linevec* block, bool fsuper) {
- Splitter sp (text, re_nl);
+ SplitterNL sp (text);
pass1_1 (sp, NULL, NULL, block, NULL, NULL, NULL, fsuper);
}
+static bool findCmdSep (uiterator& b, uiterator e, uiterator& u) {
+ int c;
+ uiterator p = b;
+ for (; p < e; ++ p) {
+ c = *p;
+ if (c == ':') {
+ b = p;
+ u = b + 1;
+ return true;
+ } else if (c == ' ' || c == '\t') {
+ b = p;
+ u = b;
+ do {
+ ++ u;
+ } while (u < e && ((c = *u) == ' ' || c == '\t'));
+ return true;
+ }
+ }
+ b = p;
+ u = e;
+ return true;
+}
+
int WikiFormat::pass1_1 (Splitter& sp, ustring* elseword, ustring* endword, WikiLine::linevec* block, uiterator* elsebegin0, uiterator* elsebegin, uiterator* elseend, bool fsuper) {
uiterator b, e, t, u, v;
- umatch m;
while (sp.next ()) {
b = sp.begin ();
e = sp.end ();
- while (b < e && b[0] == '\t')
+ while (b < e && b[0] == '\t') // TABãç¡è¦
b ++;
if (matchSkip (b, e, CharConst (kComment))) {
// comment
} else if (b != e && b[0] == kWikiCmd) {
- if (usearch (b, e, m, re_wikicmdsep)) {
- t = b;
- u = m[0].first;
- v = m[0].second;
+ t = b;
+ u = b;
+ if (findCmdSep (u, e, v)) {
} else {
- t = b;
u = e;
v = e;
}
@@ -1552,6 +1786,30 @@ bool WikiFormat::pass1_2 (Splitter& sp, uiterator& b, uiterator& e, uiterator&
// nonblock
}
return true;
+ } else if (t < u && *t == kWikiCmd) {
+ bool fx = true;
+ MNode* wf;
+ ustring name (t + 1, u); // '$'ãåãé¤ã
+ if (protectMode && ! fsuper && ! env->wikienv->wikiGuestFunc.get (name))
+ fx = false;
+ if (fx && (wf = env->wikienv->wikiCmd2.getVar (name))) { // Wiki Command
+ ustring endword;
+ endword.assign (CharConst (uWikiCmd "end")).append (name); // $end...
+ block->push_back (wl = new WikiLine (b, e, fsuper));
+ wl->fn = wc_call_defun;
+ wl->block = new WikiLine::linevec;
+ rc = pass1_1 (sp, NULL, &endword, wl->block, NULL, NULL, NULL, fsuper);
+ if (rc == 0) {
+ // no end line error
+ if (endword.length () > 0) {
+ errorMsg.append (CharConst ("no matcing \"")).append (endword).append (CharConst ("\".\n"));
+ }
+ } else if (rc == 2) {
+ assert (wl->block2 == NULL);
+ wl->block2 = new WikiLine (sp.begin (), sp.end (), false);
+ }
+ return true;
+ }
}
return false;
@@ -1615,6 +1873,15 @@ void WikiFormat::compile (const ustring& text, bool fsuper) {
}
}
+void WikiFormat::outputElement (const ustring& elementName) {
+ WikiBlockElement* b;
+
+ b = elementMap.get (elementName);
+ if (b) {
+ output (b->block);
+ }
+}
+
void WikiFormat::output (boost::ptr_vector& ary) {
int i;
@@ -1645,6 +1912,7 @@ bool WikiFormat::checkClose (uiterator b, uiterator e) {
return true;
case WikiBlock::CloseFalse:
return false;
+ default:;
}
}
return false;
@@ -1654,17 +1922,28 @@ void WikiFormat::compileLine (WikiLineScanner& scanner) {
WikiLine* wl = scanner.cur ();
if (! wl)
return;
-
- uiterator b = wl->begin;
- uiterator e = wl->end;
-
if (wl->fn) {
wl->fn (wl, this);
} else {
+ uiterator b = wl->begin;
+ uiterator e = wl->end;
+
if (b == e) { // empty line
if (cur) {
- cur->close ();
- cur = NULL;
+ switch (cur->type) {
+ case WikiBlock::BlockParagraph:
+ cur->close ();
+ cur = new WikiBlockBlank (this);
+ blockp->push_back (cur);
+ cur->addLine (b, e);
+ break;
+ case WikiBlock::BlockBlank:
+ cur->addLine (b, e);
+ break;
+ default:
+ cur->close ();
+ cur = NULL;
+ }
}
} else if (matchSkip (b, e, CharConst ("//"))) { // comment
} else if (checkClose (b, e)) {
@@ -1709,7 +1988,7 @@ void WikiFormat::compileLine (WikiLineScanner& scanner) {
cur = obj = new WikiBlockItem (WikiBlock::BlockItemOL, this);
blockp->push_back (cur);
obj->addLine (b, e);
- } else if (b[0] == kWikiNL) { // ]
+ } else if (b[0] == kWikiNL) { // +
WikiBlockItem* obj;
if (cur)
cur->close ();
@@ -1730,7 +2009,7 @@ void WikiFormat::compileLine (WikiLineScanner& scanner) {
cur = new WikiBlockParagraph (this);
blockp->push_back (cur);
}
- push_block (NULL);
+ push_block (blockp);
cur = new WikiBlockSelect (this);
cur->addLine (b, e);
} else if (b[0] == kWikiTABLE) { // |
@@ -1747,7 +2026,8 @@ void WikiFormat::compileLine (WikiLineScanner& scanner) {
cur = obj = new WikiBlockQuote (this);
blockp->push_back (cur);
push_block (&obj->block);
- } else if (matchHead (b, e, CharConst ("{div:"))) {
+// } else if (matchHead (b, e, CharConst ("{div:"))) {
+ } else if (matchHead (b, e, CharConst (uWikiDIV))) {
WikiBlockComplex* obj;
if (cur)
cur->close ();
@@ -1755,7 +2035,7 @@ void WikiFormat::compileLine (WikiLineScanner& scanner) {
blockp->push_back (cur);
cur->addLine (b, e);
push_block (&obj->block);
- } else if (curform == NULL && matchHead (b, e, CharConst ("{form:"))) {
+ } else if (curform == NULL && matchHead (b, e, CharConst (uWikiFORM))) {
WikiBlockComplex* obj;
if (cur)
cur->close ();
@@ -1763,6 +2043,14 @@ void WikiFormat::compileLine (WikiLineScanner& scanner) {
blockp->push_back (cur);
cur->addLine (b, e);
push_block (&obj->block);
+ } else if (curform == NULL && matchHead (b, e, CharConst (uWikiELEMENT))) {
+ WikiBlockComplex* obj;
+ if (cur)
+ cur->close ();
+ cur = obj = new WikiBlockElement (this);
+ blockp->push_back (cur);
+ cur->addLine (b, e);
+ push_block (&obj->block);
} else if (matchHead (b, e, CharConst ("----"))) { // ----
if (cur)
cur->close ();
@@ -1787,7 +2075,7 @@ void WikiFormat::compileLine (WikiLineScanner& scanner) {
void WikiFormat::compileLines (WikiLineScanner& scanner, bool (*fn)(WikiLine& spp, WikiLineScanner& scanner, WikiFormat* wiki, void* par), void* par) {
WikiLine* wl;
- while (wl = scanner.next ()) {
+ while ((wl = scanner.next ())) {
if (fn && fn (*scanner.cur (), scanner, this, par)) {
break;
} else {
@@ -1816,160 +2104,6 @@ int WikiFormat::countWikiH (uiterator& b, uiterator e) {
return ans;
}
-bool WikiFormat::paramID (const ustring& key, WikiMotorObjVec& vval, ustring& var_id, bool& ferr) {
- if (match (key, CharConst ("id"))) {
- ustring value (vval.textOut (this));
- if (value.length () > 0) {
- if (checkWikiID (value)) {
- var_id = value;
- ferr = false;
- } else {
- errorMsg.append (key).append (uEq).append (value).append (CharConst (": bad id\n"));
- ferr = true;
- }
- }
- return true;
- } else {
- return false;
- }
-}
-
-bool WikiFormat::paramClass (const ustring& key, WikiMotorObjVec& vval, std::vector& classes, bool& ferr) {
- if (match (key, CharConst ("class"))) {
- paramClassValue (vval, classes, ferr);
- return true;
- } else {
- return false;
- }
-}
-
-void WikiFormat::paramClassValue (WikiMotorObjVec& vval, std::vector& classes, bool& ferr) {
- WikiMotorObjVecVec args;
- ferr = false;
- vval.splitCharA (',', args);
- for (int i = 0; i < args.size (); i ++) {
- ustring value (args[i]->textOut (this));
- if (value.length () > 0) {
- if (checkWikiID (value)) {
- classes.push_back (value);
- } else {
- errorMsg.append (value).append (CharConst (": bad class name\n"));
- ferr = true;
- }
- }
- }
-}
-
-bool WikiFormat::paramName (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr) {
- if (match (key, CharConst ("name"))) {
- ustring value (vval.textOut (this));
- if (checkWikiID (value)) {
- var = value;
- ferr = false;
- } else {
- ferr = true;
- }
- return true;
- } else {
- return false;
- }
-}
-
-bool WikiFormat::paramWidth (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr) {
- if (match (key, CharConst ("width"), CharConst ("w"))) {
- ustring value (vval.textOut (this));
- if (checkWidth (value)) {
- var = value;
-// if (checkNum (value))
-// var.append (CharConst ("px"));
- ferr = false;
- } else {
- ferr = true;
- }
- return true;
- } else {
- return false;
- }
-}
-
-bool WikiFormat::paramHeight (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr) {
- if (match (key, CharConst ("height"), CharConst ("h"))) {
- ustring value (vval.textOut (this));
- if (checkWidth (value)) {
- var = value;
- ferr = false;
- } else {
- errorMsg.append (key).append (uEq).append (value).append (CharConst (": bad value\n"));
- ferr = true;
- }
- return true;
- } else {
- return false;
- }
-}
-
-bool WikiFormat::paramSize (const char* name, size_t namelen, const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr) {
- if (match (key, name, namelen)) {
- ustring value (vval.textOut (this));
- if (checkNum (value)) {
- var = value;
- ferr = false;
- } else {
- ferr = true;
- }
- return true;
- }
- return false;
-}
-
-void WikiFormat::paramUNum (const ustring& value, int& var, const ustring& name) {
- if (checkNum (value)) {
- var = strtoul (value);
- } else {
- errorMsg.append (name).append (uEq).append (value).append (uErrorBadValue).append (uLF);
- }
-}
-
-void WikiFormat::paramColor (const ustring& value, ustring& var, const ustring& name) {
- if (checkColor (value)) {
- var = value;
- } else {
- errorMsg.append (name).append (uEq).append (value).append (uErrorBadValue).append (uLF);
- }
-}
-
-bool WikiFormat::paramTargetCheck (const ustring& key) {
- return match (key, CharConst ("target"));
-}
-
-void WikiFormat::paramTargetBody (const ustring& key, const ustring& value, ustring& var, bool& ferr) {
- if (value.length () == 0 || checkWikiID (value)) {
- var = value;
- } else {
- if (key.length () > 0)
- errorMsg.append (key).append (uEq).append (value).append (CharConst (": bad target name.\n"));
- else
- errorMsg.append (value).append (CharConst (": bad target name.\n"));
- ferr = true;
- }
-}
-
-bool WikiFormat::paramOnClickCheck (const ustring& name) {
- return match (name, CharConst ("onclick"));
-}
-
-bool WikiFormat::paramOnFocusCheck (const ustring& name) {
- return match (name, CharConst ("onfocus"));
-}
-
-bool WikiFormat::paramOnBlurCheck (const ustring& name) {
- return match (name, CharConst ("onblur"));
-}
-
-bool WikiFormat::paramOnChangeCheck (const ustring& name) {
- return match (name, CharConst ("onchange"));
-}
-
void WikiFormat::outputName (MotorOutput* out, const char* name, size_t len, const ustring& val, bool cond) {
if (! cond || val.length () > 0)
out->out_raw (uSPC)
@@ -2029,6 +2163,35 @@ void WikiFormat::outputSubmitScript (MotorOutput* out, const char* name, size_t
}
}
+void WikiFormat::outputNum (MotorOutput* out, const char* name, size_t len, int val) {
+ out->out_raw (uSPC)
+ ->out_raw (name, len)
+ ->out_raw (CharConst ("="))
+ ->out_raw (to_ustring (val));
+}
+
+MNode* WikiFormat::arrayToTexp (const ustring& name) {
+ size_t i, n;
+ MNodeList e;
+
+ n = mlenv->getArySize (name);
+ for (i = 1; i <= n; i ++) {
+ e.append (mlenv->getAry (name, i));
+ }
+ return mlenv->retval = e ();
+}
+
+MNode* WikiFormat::evalVar (const ustring& name) {
+ // @NAME â getarray
+ // NAME â getvar
+ ustring sym;
+ if (checkAry (name, sym)) {
+ return arrayToTexp (sym);
+ } else {
+ return mlenv->getVar (name);
+ }
+}
+
void WikiFormat::wikiMotor (uiterator b, uiterator e, WikiMotorObjVec& ans) {
WikiMotor motor (b, e, this);
AutoInclCount autoIncl (env->mlenv);
@@ -2053,23 +2216,11 @@ void WikiFormat::wikiMotorInline (uiterator b, uiterator e, WikiMotorObjVec& an
objv.eval (ans, this);
}
-#if 0
-void WikiFormat::wikiMotorEval (uiterator b, uiterator e, WikiMotorObjVec& ans) {
- ans.push_back (WikiMotorObjPtr (new WikiMotorObjHtml (wikiMotor (b, e))));
-}
-#endif
-
-MNode* WikiFormat::buildArgs (WikiMotorObjVecVec::const_iterator b, WikiMotorObjVecVec::const_iterator e, bool dumpmode) {
+MNode* WikiFormat::buildArgs (WikiMotorObjVecVec::const_iterator b, WikiMotorObjVecVec::const_iterator e) {
MNodeList ans;
- if (dumpmode) {
- for (; b < e; b ++) {
- ans.append (newMNode_str (new ustring ((*b)->dump ())));
- }
- } else {
- for (; b < e; b ++) {
- ans.append (newMNode_str (new ustring ((*b)->textOut (this))));
- }
+ for (; b < e; b ++) {
+ ans.append ((*b)->toMNode (this));
}
return ans.release ();
@@ -2086,4 +2237,7 @@ void WikiFormat::logLispFunctionError (const ustring& msg, const ustring& cmd)
}
}
+/*DOC:
+$premode:
+*/
/* ============================================================ */
|