OSDN Git Service

experimental wiki tag <zwsp>.
authorvisor <visor@users.sourceforge.jp>
Sat, 5 Mar 2011 15:27:48 +0000 (00:27 +0900)
committervisor <visor@users.sourceforge.jp>
Sat, 5 Mar 2011 15:27:48 +0000 (00:27 +0900)
wiki/wikimotor.cc
wiki/wikimotor.h

index 87e0368..d46496c 100644 (file)
@@ -47,7 +47,7 @@ uregex  re_wiki1 (
        "|"
                "( )"                           // 15
        "|"
-               "(<br>)"                        // 16
+               "(<br>|<zwsp>)"                 // 16
        "|"
                "(''+)"                         // 17
        );
@@ -636,6 +636,19 @@ ustring  WikiMotorObjBR::dump () {
 }
 
 /* ============================================================ */
+ustring  WikiMotorObjZWSP::textOut (WikiFormat* wiki) {
+    return ustring (CharConst ("<zwsp>"));
+}
+
+ustring  WikiMotorObjZWSP::htmlOut (WikiFormat* wiki) {
+    return ustring (CharConst ("&#8203;"));
+}
+
+ustring  WikiMotorObjZWSP::dump () {
+    return ustring (CharConst ("<zwsp>"));
+}
+
+/* ============================================================ */
 ustring  WikiMotorObjVar::textOut (WikiFormat* wiki) {
 //    return fixUTF8 (omitCtrl (wiki->getVar (name)));
     return fixUTF8 (wiki->getVar (name));
@@ -990,9 +1003,12 @@ void  WikiMotor::compile (WikiMotorObjVec& out, int tmatch) {
                compile_text (out);
                return;
            }
-       } else if (sp.match (re_wiki1_br)) { // <br>
+       } else if (sp.match (re_wiki1_br)) { // <br>|<zwsp>
            compile_text (out);
-           out.push_back (WikiMotorObjPtr (new WikiMotorObjBR ()));
+           if (*(sp.matchBegin (re_wiki1_br) +1) == 'b')
+               out.push_back (WikiMotorObjPtr (new WikiMotorObjBR ()));
+           else
+               out.push_back (WikiMotorObjPtr (new WikiMotorObjZWSP ()));
        } else if (sp.match (re_wiki1_quote)) { // ''
            compile_text (out);
            if (tmatch & TMATCH_QUOT) {
index 7f7d46f..bd0d70d 100644 (file)
@@ -68,6 +68,7 @@ class  WikiMotorObj {
        wiki_char,
        wiki_emph,
        wiki_br,
+       wiki_zwsp,
        wiki_var,
        wiki_func1,
        wiki_funcM,
@@ -159,6 +160,15 @@ class  WikiMotorObjBR: public WikiMotorObj {
     virtual ustring  dump ();
 };
 
+class  WikiMotorObjZWSP: public WikiMotorObj {
+ public:
+    WikiMotorObjZWSP (): WikiMotorObj (wiki_br) {};
+    virtual  ~WikiMotorObjZWSP () {};
+    virtual ustring  textOut (WikiFormat* wiki);
+    virtual ustring  htmlOut (WikiFormat* wiki);
+    virtual ustring  dump ();
+};
+
 class  WikiMotorObjVar: public WikiMotorObj {
  public:
     ustring  name;