OSDN Git Service

div tag option and function updates.
authorvisor <visor@users.sourceforge.jp>
Sun, 18 Dec 2016 10:58:25 +0000 (19:58 +0900)
committervisor <visor@users.sourceforge.jp>
Sun, 18 Dec 2016 10:58:25 +0000 (19:58 +0900)
lib/util_string.cc
modules/ml-neon.cc
modules/ml-neon.h
modules/ml-texp.cc
modules/ml-texp.h
wiki/wikiattrib.cc
wiki/wikiattrib.h
wiki/wikiformat.cc
wiki/wikiformat.h

index 7c4cd0d..c43ac37 100644 (file)
@@ -39,11 +39,7 @@ ustring  UIConv::cv (const ustring& text, bool flush) {
        while (isize > 0) {
            obuf = buf;
            osize = 4096;
-#if defined(Linux) || defined(FreeBSDPortsIConv)
            rsize = ::iconv (cd, (char**)&ibuf, &isize, &obuf, &osize);
-#else
-           rsize = ::iconv (cd, &ibuf, &isize, &obuf, &osize);
-#endif
            if (rsize == -1) {
                if (errno == EILSEQ) {
                    ibuf ++;    
index 9496955..6f82b82 100644 (file)
@@ -386,11 +386,11 @@ void  NeonQuery::submit () {
     buildHeader ();
     switch (method) {
     case METHOD_POST:
-       if (! rawquery.isEmpty ()) {
+       if (! rawQuery.isEmpty ()) {
            setRawQuery (fd);
        } else {
-           rawquery.setText ();
-           buildQuery (queryParam (), rawquery.param);
+           rawQuery.setText ();
+           buildQuery (queryParam (), rawQuery.param);
            setRawQuery (fd);
        }
        break;
@@ -399,7 +399,7 @@ void  NeonQuery::submit () {
        ne_set_request_body_provider (req, qbody->calcLength (), qbodyProvider, qbody.get ());
        break;
     case METHOD_PUT:
-       if (! rawquery.isEmpty ()) {
+       if (! rawQuery.isEmpty ()) {
            setRawQuery (fd);
        }
        break;
@@ -462,11 +462,13 @@ const char*  NeonQuery::methodStr () {
 ustring  NeonQuery::buildGetQuery () {
     ustring  ans;
 
-    if (! isNil (queryParamGet ())) {
-       buildQuery (queryParamGet (), ans);
+    if (! isNil (getQueryParam ())) {
+       buildQuery (getQueryParam (), ans);
+    } else if (! rawGetQuery.isEmpty () && rawGetQuery.isText ()) {
+       ans = rawGetQuery.read ();
     } else if (method == METHOD_GET) {
-       if (! rawquery.isEmpty () && rawquery.isText ()) {
-           ans = rawquery.read ();
+       if (! rawQuery.isEmpty () && rawQuery.isText ()) {
+           ans = rawQuery.read ();
        } else if (! isNil (queryParam ())) {
            buildQuery (queryParam (), ans);
        }
@@ -735,10 +737,10 @@ void  NeonQuery::parseCookie () {
 
 void  NeonQuery::setRawQuery (FileMacro& fd) {
     setFormType ();
-    if (rawquery.isText ()) {
-       ne_set_request_body_buffer (req, rawquery.param.c_str (), rawquery.param.size ());
+    if (rawQuery.isText ()) {
+       ne_set_request_body_buffer (req, rawQuery.param.c_str (), rawQuery.param.size ());
     } else {
-       ustring  src = rawquery.src ();
+       ustring  src = rawQuery.src ();
        if (src.length () > 0) {
            if (fd.openRead (src.c_str ())) {
                ne_set_request_body_fd (req, fd.fd, 0, fd.size ());
@@ -925,11 +927,12 @@ static MNode*  checkConsList (MNode* e) {
        :basic-user '(ID . PASSWORD)
        :query '((NAME . VALUE) ...)
        :get-query '((NAME . VALUE) ...)
-       #no-encode
+//     #no-encode
        :post-file-serial '((NAME . FILE) ...)
        :post-file-named '((NAME . FILE) ...)
        :post-file-static '((NAME . FILE) ...)
        :raw-query TEXT :raw-file-serial FILE :raw-file-named FILE :raw-file-static FILE
+       :raw-get-query TEXT
        :query-type MIMETYPE
        :cookie '((NAME . VALUE) ...) :header '((NAME . VALUE) ...)
        [#sjis | #euc-jp | :iconv NAME]
@@ -971,6 +974,7 @@ MNode*  ml_neon_http_request (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
        {CharConst ("euc-jp"), true},                   // 20
        {CharConst ("iconv"), false},                   // 21
        {CharConst ("module"), false},                  // 22
+       {CharConst ("raw-get-query"), false},           // 23
        {NULL, 0, 0}
     };
 
@@ -1002,7 +1006,9 @@ MNode*  ml_neon_http_request (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
     if (evkw (7, t))                           // 7:query
        obj->query->queryParam = checkConsList (t ());
     if (evkw (8, t))                           // 8:get-query
-       obj->query->queryParamGet = checkConsList (t ());
+       obj->query->getQueryParam = checkConsList (t ());
+    if (evkw (23, t))                          // 23:raw-get-query
+       obj->query->rawGetQuery.srcText (to_string (t ()));
     if (evkw (9, t))                           // 9:post-file-serial
        postFileSerial = checkConsList (t ());
     if (evkw (10, t))                          // 10:post-file-named
@@ -1010,13 +1016,13 @@ MNode*  ml_neon_http_request (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
     if (evkw (11, t))                          // 11:post-file-static
        postFileStatic = checkConsList (t ());
     if (evkw (12, t))          // 12:raw-query
-       obj->query->rawquery.srcText (to_string (t ()));
+       obj->query->rawQuery.srcText (to_string (t ()));
     if (evkw (13, t))          // 13:raw-file-serial
-       obj->query->rawquery.srcSerial (to_string (t ()));
+       obj->query->rawQuery.srcSerial (to_string (t ()));
     if (evkw (14, t))          // 14:raw-file-named
-       obj->query->rawquery.srcNamed (to_string (t ()));
+       obj->query->rawQuery.srcNamed (to_string (t ()));
     if (evkw (15, t))          // 15:raw-file-static
-       obj->query->rawquery.srcStatic (to_string (t ()));
+       obj->query->rawQuery.srcStatic (to_string (t ()));
     if (evkw (16, t)) {                // 16:query-type
        obj->query->querytype = to_string (t ());
        if (! matchASCII (obj->query->querytype.begin (), obj->query->querytype.end ()))
@@ -1185,13 +1191,15 @@ MNode*  ml_neon_http_response_output (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
 }
 
 /*DOC:
-====get-cookie====
- (get-cookie NAME :module MODULE) -> STRING
+====http-get-cookie====
+ (http-get-cookie NAME :module MODULE) -> STRING
 
 */
-//#SFUNC       get-cookie      ml_neon_get_cookie      $neon
-//#SFUNC       get-cookie      ml_neon_get_cookie      %neon
-MNode*  ml_neon_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
+//#SFUNC       http-get-cookie ml_neon_http_get_cookie $neon
+//#SFUNC       http-get-cookie ml_neon_http_get_cookie %neon
+//#SFUNC       get-cookie      ml_neon_http_get_cookie $neon
+//#SFUNC       get-cookie      ml_neon_http_get_cookie %neon
+MNode*  ml_neon_http_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
     MNode*  arg = cell->cdr ();
     MLNeon*  obj = (MLNeon*)mobj;
     ustring  name;
@@ -1220,13 +1228,17 @@ MNode*  ml_neon_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
 }
 
 /*DOC:
-====get-cookie-all====
- (get-cookie-all :module MODULE) -> LIST of (NAME . VALUE)
+====http-get-all-cookies====
+ (http-get-all-cookies :module MODULE) -> LIST of (NAME . VALUE)
 
 */
-//#SFUNC       get-cookie-all  ml_neon_get_cookie_all  $neon
-//#SFUNC       get-cookie-all  ml_neon_get_cookie_all  %neon
-MNode*  ml_neon_get_cookie_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
+//#SFUNC       http-get-all-cookies    ml_neon_http_get_all_cookies    $neon
+//#SFUNC       http-get-all-cookies    ml_neon_http_get_all_cookies    %neon
+// --quirk
+//#SFUNC       get-cookie-all  ml_neon_http_get_all_cookies    $neon
+//#SFUNC       get-cookie-all  ml_neon_http_get_all_cookies    %neon
+// quirk--
+MNode*  ml_neon_http_get_all_cookies (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
     MNode*  arg = cell->cdr ();
     MLNeon*  obj = (MLNeon*)mobj;
     MNodePtr  t;
@@ -1322,13 +1334,17 @@ MNode*  ml_neon_http_get_header (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
 }
 
 /*DOC:
-====http-get-header-all====
- (http-get-header-all :module MODULE) -> LIST of (NAME . VALUE)
+====http-get-all-headers====
+ (http-get-all-headers :module MODULE) -> LIST of (NAME . VALUE)
 
 */
-//#SFUNC       http-get-header-all     ml_neon_http_get_header_all     $neon
-//#SFUNC       http-get-header-all     ml_neon_http_get_header_all     %neon
-MNode*  ml_neon_http_get_header_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
+//#SFUNC       http-get-all-headers    ml_neon_http_get_all_headers    $neon
+//#SFUNC       http-get-all-headers    ml_neon_http_get_all_headers    %neon
+// --quirk
+//#SFUNC       http-get-header-all     ml_neon_http_get_all_headers    $neon
+//#SFUNC       http-get-header-all     ml_neon_http_get_all_headers    %neon
+// quirk--
+MNode*  ml_neon_http_get_all_headers (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
     MNode*  arg = cell->cdr ();
     MLNeon*  obj = (MLNeon*)mobj;
     MNodePtr  t;
index 97e4412..0ad8094 100644 (file)
@@ -107,8 +107,9 @@ class  NeonQuery {
     ustring  basicID;
     ustring  basicPW;
     MNodePtr  queryParam;
-    MNodePtr  queryParamGet;
-    StoreType  rawquery;
+    MNodePtr  getQueryParam;
+    StoreType  rawQuery;
+    StoreType  rawGetQuery;
     ustring  querytype;                /* リクエストヘッダのcontent-type */
     MNodePtr  cookie;
     MNodePtr  header;
@@ -124,7 +125,7 @@ class  NeonQuery {
     std::vector<CookieInfo>  replyCookie;
     bool  replyCookieDone;
 
-    NeonQuery (ne_session* _session, MlEnv* _mlenv): rawquery (_mlenv) {
+    NeonQuery (ne_session* _session, MlEnv* _mlenv): rawQuery (_mlenv), rawGetQuery (_mlenv) {
        session = _session;
        req = NULL;
        method = METHOD_GET;
@@ -198,10 +199,10 @@ MNode*  ml_neon_http_status (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
 MNode*  ml_neon_http_response (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
 MNode*  ml_neon_http_response_file (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
 MNode*  ml_neon_http_response_output (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
-MNode*  ml_neon_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
-MNode*  ml_neon_get_cookie_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
+MNode*  ml_neon_http_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
+MNode*  ml_neon_http_get_all_cookies (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
 MNode*  ml_neon_http_content_type (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
 MNode*  ml_neon_http_get_header (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
-MNode*  ml_neon_http_get_header_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
+MNode*  ml_neon_http_get_all_headers (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
 
 #endif /* ML_NEON_H */
index 0574de2..bdc4418 100644 (file)
@@ -34,11 +34,14 @@ MNode*  ml_vector (MNode* cell, MlEnv* mlenv) {
 
 /*DOC:
 ===vector-get===
- (vector-get VECTOR N) -> VALUE
+ (vector-get VECTOR N [) -> VALUE
 
 */
-//#AFUNC       vector-get      ml_vector_get
+//#AFUNC       vector-get      ml_table_get
 //#WIKIFUNC    vector-get
+////#AFUNC     vector-get      ml_vector_get
+////#WIKIFUNC  vector-get
+/*
 MNode*  ml_vector_get (MNode* cell, MlEnv* mlenv) {
     MNode*  arg = cell->cdr ();
     MNodePtr  vec;
@@ -60,6 +63,7 @@ MNode*  ml_vector_get (MNode* cell, MlEnv* mlenv) {
     else
        return mlenv->retval = vec ()->vectorGet (n);
 }
+*/
 
 /*DOC:
 ===vector-back===
@@ -572,7 +576,7 @@ MNode*  ml_table (MNode* cell, MlEnv* mlenv) {
 
 /*DOC:
 ===table-get===
- (table-get TABLE NAME) -> VALUE
+ (table-get TABLE NAME [NAME | N]...) -> VALUE
 
 */
 //#AFUNC       table-get       ml_table_get
@@ -580,23 +584,27 @@ MNode*  ml_table (MNode* cell, MlEnv* mlenv) {
 MNode*  ml_table_get (MNode* cell, MlEnv* mlenv) {
     MNode*  arg = cell->cdr ();
     MNodePtr  tbl;
-    ustring  name;
+    MNodePtr  e;
 
     if (! arg)
        throw (uErrorWrongNumber);
     tbl = eval (arg->car (), mlenv);
     nextNodeNonNil (arg);
-    name = eval_str (arg->car (), mlenv);
-    nextNode (arg);
-    if (arg)
-       throw (uErrorWrongNumber);
-
-    if (isNil (tbl ()))
-       return NULL;
-    if (! tbl ()->isTable ())
-       throw (uErrorWrongType);
+    while (arg) {
+       e = eval (arg->car (), mlenv);
+       nextNode (arg);
+       if (isNil (tbl ())) {
+           return NULL;
+       } else if (tbl ()->isTable ()) {
+           tbl = tbl ()->tableGet (to_string (e ()));
+       } else if (tbl ()->isVector ()) {
+           tbl = tbl ()->vectorGet (to_int (e ()));
+       } else {
+           throw (uErrorWrongType);
+       }
+    }
 
-    return mlenv->retval = tbl ()->tableGet (name);
+    return mlenv->retval = tbl ();
 }
 
 /*DOC:
index 49768ea..ab2b635 100644 (file)
@@ -78,7 +78,7 @@ class  ListMakerPtr {
 };
 
 MNode*  ml_vector (MNode* cell, MlEnv* mlenv);
-MNode*  ml_vector_get (MNode* cell, MlEnv* mlenv);
+//MNode*  ml_vector_get (MNode* cell, MlEnv* mlenv);
 MNode*  ml_vector_back (MNode* cell, MlEnv* mlenv);
 MNode*  ml_vector_size (MNode* cell, MlEnv* mlenv);
 MNode*  ml_vector_put (MNode* cell, MlEnv* mlenv);
index f6b5b09..c3efeb6 100644 (file)
@@ -291,7 +291,9 @@ void  WikiAttrib1::paramClassValue (WikiMotorObjVec& vval, std::vector<ustring>&
     for (int i = 0; i < args.size (); i ++) {
        ustring  value (args[i]->textOut (wiki));
        if (value.length () > 0) {
-           if (matchWikiID (value)) {
+           if ((selector & SEL_DIRECT) && value[0] == '#' && matchWikiID (ustring (value.begin () + 1, value.end ()))) {
+               directlist.push_back (value);           // SEL_DIRECTが指定してある場合のみ有効
+           } else if (matchWikiID (value)) {
                var.push_back (value);
            } else {
                wiki->errorMsg.append (value).append (CharConst (": bad class name\n"));
index ce6a5f8..c11490d 100644 (file)
@@ -20,6 +20,7 @@ class  WikiAttrib1 {
     static const uint32_t  SEL_MULTIPLE2 = 0x0100;
     static const uint32_t  SEL_SCRIPT2   = 0x0200;
     static const uint32_t  SEL_START     = 0x0400;
+    static const uint32_t  SEL_DIRECT    = 0x0800;     // #指定
     typedef enum {
        M_NORMAL,
        M_ATTRIB,
@@ -32,6 +33,7 @@ class  WikiAttrib1 {
     bool  ferr;
     ustring  id;
     std::vector<ustring>  classlist;
+    std::vector<ustring>  directlist;  // #指定
     ustring  onclick;
     ustring  onfocus;
     ustring  onblur;
index eddd786..a47e444 100644 (file)
@@ -132,9 +132,20 @@ void  WikiBlockComplex::outputBlock (MotorOutput* out) {
  ^行頭が他のマークアップ文字になるときは,行頭に^を書く。
  
  空行は,段落を分ける。
-
  段落と段落の間に空行を2行以上入れると、「<div class="pggap"></div>」を出力する。
 
+{div:greenbox
+マークアップ文字以外の文字で書き出すと,段落になる。
+^行頭が他のマークアップ文字になるときは,行頭に^を書く。
+
+空行は,段落を分ける。
+
+
+段落と段落の間に空行を2行以上入れると、「<div class="pggap"></div>」を出力する。
+}
+
 */
 bool  WikiBlockParagraph::nextLine (uiterator b, uiterator e) {
     if (*b == kWikiP) {
@@ -217,11 +228,16 @@ void  WikiBlockParagraph::output (MotorOutput* out) {
 /* ============================================================ */
 /*DOC:
 ===タイトル===
+行頭に=を書くと,タイトルになる。行末の=は,省略可。
+
  =タイトル1=
  ==タイトル2==
  ===タイトル3===#anchor1
-
-行頭に=を書くと,タイトルになる。行末の=は,省略可。
+{div:greenbox
+=タイトル1=
+==タイトル2==
+===タイトル3===#anchor1
+}
 
 */
 
@@ -378,6 +394,9 @@ bool  WikiBlockH::checkEmpty () {
 ===フォーマット済みテキストブロック===
   行頭に空白文字を書くと,<pre>〜</pre>タグで囲まれます。
 インライン要素の解釈は行われない。
+{div:greenbox
+ 行頭に空白文字を書くと,<pre>〜</pre>タグで囲まれます。
+}
 
 */
 bool  WikiBlockPreformatRaw::nextLine (uiterator b, uiterator e) {
@@ -454,12 +473,16 @@ void  WikiBlockItemText::output (MotorOutput* out) {
     if (indentHack) {
        outputBlock (out);
     } else {
-       out->out_raw (CharConst ("<li"));
-       attrib.output (out);
-       out->out_raw (CharConst (">"));
-       out->out_toText (html);
-       outputBlock (out);
-       out->out_raw (CharConst ("</li>\n"));
+       if (html.length () > 0) {
+           out->out_raw (CharConst ("<li"));
+           attrib.output (out);
+           out->out_raw (CharConst (">"));
+           out->out_toText (html);
+           outputBlock (out);
+           out->out_raw (CharConst ("</li>\n"));
+       } else {
+           outputBlock (out);
+       }
     }
 }
 
@@ -473,6 +496,8 @@ void  WikiBlockItemText::output (MotorOutput* out) {
  +インデント1
  ++インデント1-1
  *''[OPTION1:OPTION2:...:]''TEXT
+ *id=item1:class=style1:onclick=[[ignore:]]:TEXT
+
 行頭に「*」を書くと,<UL>タグによるリスト,「#」を書くと<NL>タグによる番号付きリスト,「+」を書くとnobullクラス指定の<UL>タグによるリスト。
 
 オプションパラメータ
@@ -487,6 +512,16 @@ void  WikiBlockItemText::output (MotorOutput* out) {
 |'''onchange='''''Link''||onchange属性。Javascriptリンク。|
 |'''start='''''Number''||start属性。OLのみ。|
 
+{div:greenbox
+*項目1
+**項目1-1
+#ナンバリング1
+##ナンバリング1-2
++インデント1
+++インデント1-1
+*id=item1:class=style1:onclick=[[ignore:]]:TEXT
+}
+
 */
 bool  WikiBlockItem::nextLine (uiterator b, uiterator e) {
     if (*b == ch) {
@@ -598,6 +633,10 @@ void  WikiBlockItem::outputBlock (MotorOutput* out) {
 ===定義リスト===
  ;見出し:説明文
 
+{div:greenbox
+;見出し:説明文
+}
+
 */
 bool  WikiBlockItemDL::nextLine (uiterator b, uiterator e) {
     if (*b == kWikiDL) {
@@ -673,8 +712,8 @@ void  WikiBlockItemDL::output (MotorOutput* out) {
 行オプションで指定できる属性はセルオプションと同じものである。
 
 +・セルオプション
- |header:名前|class=big:東武|
- |header:
+// |header:名前|class=big:東武|
+// |header:
 
 |table:w=100%:行オプション,セルオプション|t:w=20%|c:w=10%|t:|
 |h:オプション|h:省略形|h:説明|
@@ -1319,7 +1358,8 @@ void  WikiBlockQuote::output (MotorOutput* out) {
 |'''onfocus='''''Link''||onfocus属性。Javascriptリンク。|
 |'''onblur='''''Link''||onblur属性。Javascriptリンク。|
 |'''onchange='''''Link''||onchange属性。Javascriptリンク。|
-|'''ClassList'''||class=は省略できる。|
+|''ClassList''||class=は省略できる。|
+|'''#nop'''||divタグを出力しない。pタグを抑制する。|
 
 */
 bool  WikiBlockDiv::nextLine (uiterator b, uiterator e) {
@@ -1327,14 +1367,24 @@ bool  WikiBlockDiv::nextLine (uiterator b, uiterator e) {
 }
 
 void  WikiBlockDiv::addLine (uiterator b, uiterator e) {
-//    bool  rc = matchSkip (b, e, CharConst ("{div:"));
-    bool  rc = matchSkip (b, e, CharConst (uWikiDIV));
+    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<ustring>::const_iterator  b = attrib.directlist.begin ();
+       std::vector<ustring>::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) {
@@ -1350,21 +1400,39 @@ 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<WikiBlock>::iterator  b = block.begin ();
+       boost::ptr_vector<WikiBlock>::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 ("<div"));
+       attrib.output (out);
+       if (nonl)
+           out->out_raw (CharConst (">"));
+       else
+           out->out_raw (CharConst (">\n"));
     }
-    out->out_raw (CharConst ("<div"));
-    attrib.output (out);
-    if (nonl)
-       out->out_raw (CharConst (">"));
-    else
-       out->out_raw (CharConst (">\n"));
     outputBlock (out);
-    out->out_raw (CharConst ("</div>\n"));
+    if (! nopflag) {
+       out->out_raw (CharConst ("</div>\n"));
+    } else {
+       out->out_raw (uLF);
+    }
 }
 
 /* ============================================================ */
index d40ec28..18e230d 100644 (file)
@@ -425,8 +425,11 @@ class  WikiBlockQuote: public WikiBlockComplex {
 class  WikiBlockDiv: public WikiBlockComplex {
  public:
     WikiAttrib1  attrib;
+    bool  nopflag;
 
-    WikiBlockDiv (WikiFormat* w): WikiBlockComplex (BlockDiv, w), attrib (w, WikiAttrib1::SEL_CLASS2, false, WikiAttrib1::M_ATTRIB) {};
+    WikiBlockDiv (WikiFormat* w): WikiBlockComplex (BlockDiv, w), attrib (w, WikiAttrib1::SEL_CLASS2 | WikiAttrib1::SEL_DIRECT, false, WikiAttrib1::M_ATTRIB) {
+       nopflag = false;
+    };
     virtual  ~WikiBlockDiv () {};
 
     virtual bool  nextLine (uiterator b, uiterator e);