OSDN Git Service

ulclass, ulid option of the wiki tags.
authorvisor <visor@users.sourceforge.jp>
Thu, 1 Nov 2012 15:20:55 +0000 (00:20 +0900)
committervisor <visor@users.sourceforge.jp>
Thu, 1 Nov 2012 15:20:55 +0000 (00:20 +0900)
wiki/wikiattrib.cc
wiki/wikiattrib.h
wiki/wikiformat.cc
wiki/wikiformat.h

index eebaced..4bc769f 100644 (file)
@@ -16,30 +16,33 @@ bool  WikiAttrib1::readAttrib1 (WikiMotorObjVec* cell, bool& rc) {
            return false;
     }
     if (cell->splitChar_keyword ('=', key, vval)) {
-       if (wiki->paramID (key, vval, id, ferr)) {
-       } else if (wiki->paramClass (key, vval, classlist, ferr)) {
-       } else if (wiki->paramOnClickCheck (key)) {
+       if (paramID (key, vval, ferr)) {
+       } else if (paramClass (key, vval, ferr)) {
+#ifdef BOOTSTRAPHACK
+       } else if (paramDataPrefix (key, vval, dataprefix, ferr)) {
+#endif
+       } else if (paramOnClickCheck (key)) {
            if (! checkScript (vval, onclick, ferr)) {
                wiki->errorMsg.append (cell->dump ()).append (CharConst (": link script error.\n"));
                ferr = true;
            }
-       } else if (wiki->paramOnFocusCheck (key)) {
+       } else if (paramOnFocusCheck (key)) {
            if (! checkScript (vval, onfocus, ferr)) {
                wiki->errorMsg.append (cell->dump ()).append (CharConst (": link script error.\n"));
                ferr = true;
            }
-       } else if (wiki->paramOnBlurCheck (key)) {
+       } else if (paramOnBlurCheck (key)) {
            if (! checkScript (vval, onblur, ferr)) {
                wiki->errorMsg.append (cell->dump ()).append (CharConst (": link script error.\n"));
                ferr = true;
            }
-       } else if (wiki->paramOnChangeCheck (key)) {
+       } else if (paramOnChangeCheck (key)) {
            if (! checkScript (vval, onchange, ferr)) {
                wiki->errorMsg.append (cell->dump ()).append (CharConst (": link script error.\n"));
                ferr = true;
            }
-       } else if ((selector & SEL_TARGET) && wiki->paramTargetCheck (key)) {
-           wiki->paramTargetBody (key, vval.textOut (wiki), target, ferr);
+       } else if ((selector & SEL_TARGET) && paramTargetCheck (key)) {
+           paramTargetBody (key, vval.textOut (wiki), target, ferr);
        } else if (readAttribMore (key, vval, ferr)) {
        } else {
            if (mode == M_ATTRIB) {
@@ -50,9 +53,9 @@ bool  WikiAttrib1::readAttrib1 (WikiMotorObjVec* cell, bool& rc) {
        }
     } else {
        if (selector & SEL_CLASS2) {
-           wiki->paramClassValue (*cell, classlist, ferr);
+           paramClassValue (*cell, classlist, ferr);
        } else if (selector & SEL_TARGET2) {
-           wiki->paramTargetBody (uEmpty, cell->textOut (wiki), target, ferr);
+           paramTargetBody (uEmpty, cell->textOut (wiki), target, ferr);
        } else if ((selector & SEL_ONCLICK2) && checkScript (*cell, onclick, ferr)) {
        } else if ((selector & SEL_MULTIPLE2) && match (key, CharConst ("multiple"))) {
            fmultiple = true;
@@ -190,7 +193,6 @@ bool  WikiAttrib1::readLink (WikiMotorObjVecVec::const_iterator& b, const WikiMo
        fscript = true;
        b ++;
        return true;
-//    } else if (rc && cell->match (CharConst ("http"), CharConst ("https"))) {
     } else if (rc && cell->regmatch (re)) {
        ustring  proto = cell->dump ();
        b ++;
@@ -232,6 +234,14 @@ bool  WikiAttrib1::shiftName (WikiMotorObjVecPtr& vec, ustring& name) {
 void  WikiAttrib1::output (MotorOutput* out) {
     wiki->outputID (out, id);
     wiki->outputClass (out, classlist);
+#ifdef BOOTSTRAPHACK
+    std::pair<ustring,ustring>::const_iterator  b, e;
+    b = datapre.begin ();
+    e = datapre.end ();
+    for (; b < e; b ++) {
+       wiki->outputName (out, b.first, b.second);
+    }
+#endif
     wiki->outputSubmitScript (out, CharConst ("onclick"), onclick, scriptcut);
     wiki->outputSubmitScript (out, CharConst ("onfocus"), onfocus, scriptcut);
     wiki->outputSubmitScript (out, CharConst ("onblur"), onblur, scriptcut);
@@ -242,6 +252,162 @@ void  WikiAttrib1::output (MotorOutput* out) {
     outputMore (out);
 }
 
+bool  WikiAttrib1::paramID (const ustring& key, WikiMotorObjVec& vval, bool& ferr) {
+    if (match (key, CharConst ("id"))) {
+       paramIDValue (key, vval, id, ferr);
+       return true;
+    } else {
+       return false;
+    }
+}
+
+void  WikiAttrib1::paramIDValue (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr) {
+    ustring  value (vval.textOut (wiki));
+    if (checkWikiID (value)) {
+       var = value;
+       ferr = false;
+    } else {
+       wiki->errorMsg.append (key).append (uEq).append (value).append (CharConst (": bad value\n"));
+       ferr = true;
+    }
+}
+
+bool  WikiAttrib1::paramClass (const ustring& key, WikiMotorObjVec& vval, bool& ferr) {
+    if (match (key, CharConst ("class"))) {
+       paramClassValue (vval, classlist, ferr);
+       return true;
+    } else {
+       return false;
+    }
+}
+
+void  WikiAttrib1::paramClassValue (WikiMotorObjVec& vval, std::vector<ustring>& var, bool& ferr) {
+    WikiMotorObjVecVec  args;
+    ferr = false;
+    vval.splitCharA (',', args);
+    for (int i = 0; i < args.size (); i ++) {
+       ustring  value (args[i]->textOut (wiki));
+       if (value.length () > 0) {
+           if (checkWikiID (value)) {
+               var.push_back (value);
+           } else {
+               wiki->errorMsg.append (value).append (CharConst (": bad class name\n"));
+               ferr = true;
+           }
+       }
+    }
+}
+
+bool  WikiAttrib1::paramWidth (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr) {
+    if (match (key, CharConst ("width"), CharConst ("w"))) {
+       paramWidthValue (key, vval, var, ferr);
+       return true;
+    } else {
+       return false;
+    }
+}
+
+bool  WikiAttrib1::paramHeight (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr) {
+    if (match (key, CharConst ("height"), CharConst ("h"))) {
+       paramWidthValue (key, vval, var, ferr);
+       return true;
+    } else {
+       return false;
+    }
+}
+
+void  WikiAttrib1::paramWidthValue (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr) {
+    ustring  value (vval.textOut (wiki));
+    if (checkWidth (value)) {
+       var = value;
+//         if (checkNum (value))
+//             var.append (CharConst ("px"));
+       ferr = false;
+    } else {
+       wiki->errorMsg.append (key).append (uEq).append (value).append (CharConst (": bad value\n"));
+       ferr = true;
+    }
+}
+
+bool  WikiAttrib1::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 (wiki));
+       if (checkNum (value)) {
+           var = value;
+           ferr = false;
+       } else {
+           ferr = true;
+       }
+       return true;
+    }
+    return false;
+}
+
+void  WikiAttrib1::paramUNum (const ustring& value, int& var, const ustring& name) {
+    if (checkNum (value)) {
+       var = strtoul (value);
+    } else {
+       wiki->errorMsg.append (name).append (uEq).append (value).append (uErrorBadValue).append (uLF);
+    }
+}
+
+void  WikiAttrib1::paramColor (const ustring& value, ustring& var, const ustring& name) {
+    if (checkColor (value)) {
+       var = value;
+    } else {
+       wiki->errorMsg.append (name).append (uEq).append (value).append (uErrorBadValue).append (uLF);
+    }
+}
+
+bool  WikiAttrib1::paramTargetCheck (const ustring& key) {
+    return match (key, CharConst ("target"));
+}
+
+void  WikiAttrib1::paramTargetBody (const ustring& key, const ustring& value, ustring& var, bool& ferr) {
+    if (value.length () == 0 || checkWikiID (value)) {
+       var = value;
+    } else {
+       if (key.length () > 0)
+           wiki->errorMsg.append (key).append (uEq).append (value).append (CharConst (": bad target name.\n"));
+       else
+           wiki->errorMsg.append (value).append (CharConst (": bad target name.\n"));
+       ferr = true;
+    }
+}
+
+bool  WikiAttrib1::paramOnClickCheck (const ustring& name) {
+    return match (name, CharConst ("onclick"));
+}
+
+bool  WikiAttrib1::paramOnFocusCheck (const ustring& name) {
+    return match (name, CharConst ("onfocus"));
+}
+
+bool  WikiAttrib1::paramOnBlurCheck (const ustring& name) {
+    return match (name, CharConst ("onblur"));
+}
+
+bool  WikiAttrib1::paramOnChangeCheck (const ustring& name) {
+    return match (name, CharConst ("onchange"));
+}
+
+#ifdef BOOTSTRAPHACK
+bool  WikiAttrib1::paramDataPrefix (const ustring& key, WikiMotorObjVec& vval, bool& ferr) {
+    if (match (CharConst ("data-"), key) && checkWikiID (key)) {
+       ustring  value (vval.textOut (wiki));
+       if (checkWikiID (value)) {
+           datapre.push_back (std::pair (key, value));
+           ferr = false;
+       } else {
+           wiki->errorMsg.append (key).append (uEq).append (value).append (CharConst (": bad value\n"));
+           ferr = true;
+       }
+       return true;
+    } else {
+       return flase;
+    }
+}
+#endif
 /* ============================================================ */
 void  WikiAttribTable::init () {
     fheader = false;
@@ -282,17 +448,17 @@ void  WikiAttribTable::copyFrom (WikiAttribTable& b) {
 }
 
 bool  WikiAttribTable::readAttribMore (const ustring& key, WikiMotorObjVec& vval, bool& ferr) {
-    if (wiki->paramWidth (key, vval, width, ferr)) {
-    } else if (wiki->paramHeight (key, vval, height, ferr)) {
+    if (paramWidth (key, vval, width, ferr)) {
+    } else if (paramHeight (key, vval, height, ferr)) {
     } else if (match (key, CharConst ("bgcolor"), CharConst ("bg"))) {
-       wiki->paramColor (vval.textOut (wiki), bgcolor, key);
+       paramColor (vval.textOut (wiki), bgcolor, key);
     } else {
        switch (selector2) {
        case SEL_TABLE:
            if (match (key, CharConst ("cellspacing"), CharConst ("spc"))) {
-               wiki->paramUNum (vval.textOut (wiki), cellspacing, key);
+               paramUNum (vval.textOut (wiki), cellspacing, key);
            } else if (match (key, CharConst ("cellpadding"))) {
-               wiki->paramUNum (vval.textOut (wiki), cellpadding, key);
+               paramUNum (vval.textOut (wiki), cellpadding, key);
            } else {
                return false;
            }
@@ -401,8 +567,8 @@ void  WikiAttribTable::outputMore (MotorOutput* out) {
 
 /* ============================================================ */
 bool  WikiAttribImg::readAttribMore (const ustring& key, WikiMotorObjVec& vval, bool& ferr) {
-    if (wiki->paramWidth (key, vval, width, ferr)) {
-    } else if (wiki->paramHeight (key, vval, height, ferr)) {
+    if (paramWidth (key, vval, width, ferr)) {
+    } else if (paramHeight (key, vval, height, ferr)) {
     } else if (match (key, CharConst ("alt"))) {
        alt = vval.textOut (wiki);
     } else {
@@ -419,7 +585,7 @@ void  WikiAttribImg::outputMore (MotorOutput* out) {
 
 /* ============================================================ */
 bool  WikiAttribInput::readAttribMore (const ustring& key, WikiMotorObjVec& vval, bool& ferr) {
-    if ((selector2 & SEL_INPUT) && wiki->paramSize (CharConst ("size"), key, vval, psize, ferr)) {
+    if ((selector2 & SEL_INPUT) && paramSize (CharConst ("size"), key, vval, psize, ferr)) {
     } else if ((selector2 & SEL_ELSIZE) && match (key, CharConst ("size"))) {
        ustring  v = vval.textOut (wiki);
        if (match (v, CharConst ("*"))) {
@@ -432,9 +598,9 @@ bool  WikiAttribInput::readAttribMore (const ustring& key, WikiMotorObjVec& vval
        } else {
            elsize = 1;
        }
-    } else if (wiki->paramWidth (key, vval, pwidth, ferr)) {
-    } else if ((selector2 & SEL_TEXTAREA) && wiki->paramSize (CharConst ("cols"), key, vval, pcols, ferr)) {
-    } else if ((selector2 & SEL_TEXTAREA) && wiki->paramSize (CharConst ("rows"), key, vval, prows, ferr)) {
+    } else if (paramWidth (key, vval, pwidth, ferr)) {
+    } else if ((selector2 & SEL_TEXTAREA) && paramSize (CharConst ("cols"), key, vval, pcols, ferr)) {
+    } else if ((selector2 & SEL_TEXTAREA) && paramSize (CharConst ("rows"), key, vval, prows, ferr)) {
     } else if ((selector2 & SEL_TEXTAREA) && match (key, CharConst ("wrap"))) {
        ustring  value (vval.textOut (wiki));
        if (match (value, CharConst ("off"))) {
@@ -443,7 +609,7 @@ bool  WikiAttribInput::readAttribMore (const ustring& key, WikiMotorObjVec& vval
            pwrap = W_SOFT;
        } else if (match (value, CharConst ("hard"))) {
            pwrap = W_HARD;
-       } else if (wiki->paramWidth (key, vval, pwidth, ferr)) {
+       } else if (paramWidth (key, vval, pwidth, ferr)) {
        } else {
            wiki->errorMsg.append (key).append (CharConst ("=")).append (vval.dump ()).append (CharConst (": link script error.\n"));
            ferr = true;
@@ -542,3 +708,19 @@ bool  WikiAttribButton::readAttrib (WikiMotorObjVecVec::const_iterator& b, const
 }
 
 /* ============================================================ */
+bool  WikiAttribItem::readAttribMore (const ustring& key, WikiMotorObjVec& vval, bool& ferr) {
+    if (match (key, CharConst ("ulclass"))) {
+       if (owner && owner->parent && owner->parent->attrib.classlist.size () == 0) {
+           paramClassValue (vval, owner->parent->attrib.classlist, ferr);
+       }
+    } else if (match (key, CharConst ("ulid"))) {
+       if (owner && owner->parent && owner->parent->attrib.id.size () == 0) {
+           paramIDValue (key, vval, owner->parent->attrib.id, ferr);
+       }
+    } else {
+       return false;
+    }
+    return true;
+}
+
+/* ============================================================ */
index d7f2d27..3df3312 100644 (file)
@@ -40,6 +40,9 @@ class  WikiAttrib1 {
     bool  fmultiple;
     bool  fdefault;            /* no output */
     ustring  script;           /* no output */
+#ifdef BOOTSTRAPHACK
+    typedef  std::pair<ustring,ustring>  datapre;
+#endif
     
     WikiAttrib1 (WikiFormat* _wiki, uint32_t _selector, bool _scriptcut, mode_t _mode /*= M_NORMAL*/) {
        wiki = _wiki;
@@ -67,6 +70,27 @@ class  WikiAttrib1 {
        return false;
     };
     virtual void  outputMore (MotorOutput* out) {};
+
+ public:
+    virtual bool  paramID (const ustring& key, WikiMotorObjVec& vval, bool& ferr);
+    virtual void  paramIDValue (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr);
+    virtual bool  paramClass (const ustring& key, WikiMotorObjVec& vval, bool& ferr);
+    virtual void  paramClassValue (WikiMotorObjVec& vval, std::vector<ustring>& var, bool& ferr);
+    virtual bool  paramWidth (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr);
+    virtual bool  paramHeight (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr);
+    virtual void  paramWidthValue (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr);
+    virtual bool  paramSize (const char* name, size_t namelen, const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr);
+    virtual void  paramUNum (const ustring& value, int& var, const ustring& name);
+    virtual void  paramColor (const ustring& value, ustring& var, const ustring& name);
+    virtual bool  paramTargetCheck (const ustring& key);
+    virtual void  paramTargetBody (const ustring& key, const ustring& value, ustring& var, bool& ferr);
+    virtual bool  paramOnClickCheck (const ustring& name);
+    virtual bool  paramOnFocusCheck (const ustring& name);
+    virtual bool  paramOnBlurCheck (const ustring& name);
+    virtual bool  paramOnChangeCheck (const ustring& name);
+#ifdef BOOTSTRAPHACK
+    virtual bool  paramDataPrefix (const ustring& key, WikiMotorObjVec& vval, bool& ferr);
+#endif
 };
 
 class  WikiAttribTable: public WikiAttrib1 {
@@ -174,4 +198,16 @@ class  WikiAttribButton: public WikiAttrib1 {
     virtual bool  readAttrib (WikiMotorObjVecVec::const_iterator& b, const WikiMotorObjVecVec::const_iterator& e);
 };
 
+class  WikiBlockItemText;
+class  WikiAttribItem: public WikiAttrib1 {
+ public:
+    WikiBlockItemText*  owner;
+
+    WikiAttribItem (WikiFormat* _wiki, WikiBlockItemText* _b): WikiAttrib1 (_wiki, SEL_ID, false, M_NORMAL) {
+       owner = _b;
+    };
+    virtual  ~WikiAttribItem () {};
+    virtual bool  readAttribMore (const ustring& key, WikiMotorObjVec& vval, bool& ferr);
+};
+
 #endif /* WIKIATTRIB_H */
index 0c4e6d7..58eca5a 100644 (file)
@@ -316,9 +316,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;
@@ -342,9 +339,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);
 }
 
@@ -404,7 +398,6 @@ void  WikiBlockPreformatRaw::addLine (uiterator b, uiterator e) {
 
 void  WikiBlockPreformatRaw::output (MotorOutput* out) {
     out->out_raw (CharConst ("<pre>"))->out_toText (text)->out_raw (CharConst ("</pre>\n"));
-//     out->out_raw (CharConst ("<pre>"))->out_toHTML (text)->out_raw (CharConst ("</pre>\n"));
 }
 
 /* ============================================================ */
@@ -505,7 +498,7 @@ void  WikiBlockItem::addLine (uiterator b, uiterator e) {
     assert (b != e && b[0] == ch);
     b ++;
     if (b == e) {
-       wbt = new WikiBlockItemText (wiki);
+       wbt = new WikiBlockItemText (wiki, this);
        block.push_back (wbt);
        wbt->addLine (b, e);
     } else {
@@ -519,7 +512,7 @@ void  WikiBlockItem::addLine (uiterator b, uiterator e) {
            case kWikiOL:       // #
                wbi = new WikiBlockItem (WikiBlock::BlockItemOL, wiki);
                break;
-           case kWikiNL:       // ]
+           case kWikiNL:       // +
                wbi = new WikiBlockItem (WikiBlock::BlockItemNL, wiki);
                break;
            default:
@@ -531,14 +524,14 @@ void  WikiBlockItem::addLine (uiterator b, uiterator e) {
                    wbi->addLine (b, e);
                    wbt->block.push_back (wbi);
                } else {
-                   wbt = new WikiBlockItemText (wiki);
+                   wbt = new WikiBlockItemText (wiki, this);
                    block.push_back (wbt);
                    wbi->addLine (b, e);
                    wbt->block.push_back (wbi);
                    wbt->indentHack = true;
                }
            } else {
-               wbt = new WikiBlockItemText (wiki);
+               wbt = new WikiBlockItemText (wiki, this);
                block.push_back (wbt);
                wbt->addLine (b, e);
            }
@@ -551,17 +544,25 @@ void  WikiBlockItem::output (MotorOutput* out) {
 
     switch (type) {
     case BlockItemUL:
-       out->out_raw (CharConst ("<ul>\n"));
+       out->out_raw (CharConst ("<ul"));
+       attrib.output (out);
+       out->out_raw (CharConst (">\n"));
        outputBlock (out);
        out->out_raw (CharConst ("</ul>\n"));
        break;
     case BlockItemOL:
-       out->out_raw (CharConst ("<ol>\n"));
+       out->out_raw (CharConst ("<ol"));
+       attrib.output (out);
+       out->out_raw (CharConst (">\n"));
        outputBlock (out);
        out->out_raw (CharConst ("</ol>\n"));
        break;
     case BlockItemNL:
-       out->out_raw (CharConst ("<ul class=\"nobull\">\n"));
+       out->out_raw (CharConst ("<ul"));
+       attrib.classlist.push_back (ustring (CharConst ("nobull")));
+       attrib.output (out);
+       attrib.classlist.pop_back ();
+       out->out_raw (CharConst (">\n"));
        outputBlock (out);
        out->out_raw (CharConst ("</ul>\n"));
        break;
@@ -1701,7 +1702,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 ();
@@ -1808,160 +1809,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<ustring>& classes, bool& ferr) {
-    if (match (key, CharConst ("class"))) {
-       paramClassValue (vval, classes, ferr);
-       return true;
-    } else {
-       return false;
-    }
-}
-
-void  WikiFormat::paramClassValue (WikiMotorObjVec& vval, std::vector<ustring>& 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)
@@ -2067,12 +1914,6 @@ 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) {
     MNodeList  ans;
 
index 7f286dd..f1803d7 100644 (file)
@@ -257,14 +257,17 @@ class  WikiBlockPreformatRaw: public WikiBlock {
     virtual void  output (MotorOutput* out);
 };
 
+class  WikiBlockItem;
 class  WikiBlockItemText: public WikiBlockComplex {
  public:
     ustring  html;
     bool  indentHack;
-    WikiAttrib1  attrib;
+    WikiAttribItem  attrib;
+    WikiBlockItem*  parent;
 
-    WikiBlockItemText (WikiFormat* w): WikiBlockComplex (BlockItemText, w), attrib (w, WikiAttrib1::SEL_ID, false, WikiAttrib1::M_NORMAL) {
+    WikiBlockItemText (WikiFormat* w, WikiBlockItem* _p): WikiBlockComplex (BlockItemText, w), attrib (w, this) {
        indentHack = false;
+       parent = _p;
     };
     virtual  ~WikiBlockItemText () {};
     virtual bool  nextLine (uiterator b, uiterator e);
@@ -277,8 +280,9 @@ class  WikiBlockItem: public WikiBlock {
  public:
     int  ch;
     boost::ptr_vector<WikiBlockItemText>  block;
+    WikiAttrib1  attrib;
 
-    WikiBlockItem (blockType t, WikiFormat* w): WikiBlock (t, w) {
+    WikiBlockItem (blockType t, WikiFormat* w): WikiBlock (t, w), attrib (w, WikiAttrib1::SEL_ID, false, WikiAttrib1::M_NORMAL) {
        assert (t == BlockItemUL || t == BlockItemOL || t == BlockItemNL);
        ch = 0;
     };
@@ -571,22 +575,6 @@ class  WikiFormat {
     virtual void  wikiMotor (uiterator b, uiterator e, WikiMotorObjVec& ans);
     virtual ustring  wikiMotor (uiterator b, uiterator e);
     virtual void  wikiMotorInline (uiterator b, uiterator e, WikiMotorObjVec& ans);
-//    virtual void  wikiMotorEval (uiterator b, uiterator e, WikiMotorObjVec& ans);
-    virtual bool  paramID (const ustring& key, WikiMotorObjVec& vval, ustring& var_id, bool& ferr);
-    virtual bool  paramClass (const ustring& key, WikiMotorObjVec& vval, std::vector<ustring>& classes, bool& ferr);
-    virtual void  paramClassValue (WikiMotorObjVec& vval, std::vector<ustring>& classes, bool& ferr);
-    virtual bool  paramName (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr);
-    virtual bool  paramWidth (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr);
-    virtual bool  paramHeight (const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr);
-    virtual bool  paramSize (const char* name, size_t namelen, const ustring& key, WikiMotorObjVec& vval, ustring& var, bool& ferr);
-    virtual void  paramUNum (const ustring& value, int& var, const ustring& name);
-    virtual void  paramColor (const ustring& value, ustring& var, const ustring& name);
-    virtual bool  paramTargetCheck (const ustring& key);
-    virtual void  paramTargetBody (const ustring& key, const ustring& value, ustring& var, bool& ferr);
-    virtual bool  paramOnClickCheck (const ustring& name);
-    virtual bool  paramOnFocusCheck (const ustring& name);
-    virtual bool  paramOnBlurCheck (const ustring& name);
-    virtual bool  paramOnChangeCheck (const ustring& name);
     virtual void  outputName (MotorOutput* out, const char* name, size_t len, const ustring& val, bool cond = true);
     virtual void  outputName (MotorOutput* out, const char* name, size_t len, long val, bool cond = true);
     virtual void  outputFlag (MotorOutput* out, const char* name, size_t len, bool flag);