OSDN Git Service

WIKITABLEATTRIB build option.
authorvisor <visor@users.sourceforge.jp>
Sat, 3 Nov 2012 03:55:53 +0000 (12:55 +0900)
committervisor <visor@users.sourceforge.jp>
Sat, 3 Nov 2012 03:55:53 +0000 (12:55 +0900)
config.h
wiki/wikiattrib.cc
wiki/wikiattrib.h
wiki/wikiformat.cc

index 1a7a5f8..9e34691 100644 (file)
--- a/config.h
+++ b/config.h
@@ -22,7 +22,8 @@
 
 #define  SHARE_AUTHDB          1
 //#define  WIKICOMPAT          1
-//#define  TABLECOMPATFLAG     1
+//#define  WIKITABLEATTRIB     1
+//#define  WIKITABLECOMPATFLAG 1
 //#define  WIKIMOTORPRE                1
 //#define  COMPAT_STORAGE_CREATE       1
 //#define  HTTPS_NOCACHE       1
index 4bc769f..b6621f4 100644 (file)
@@ -414,9 +414,11 @@ void  WikiAttribTable::init () {
     halign = HAlignNone;
     valign = VAlignNone;
     fnowrap = false;
+#ifdef WIKITABLEATTRIB
     fnoborder = false;
     cellspacing = -1;
     cellpadding = -1;
+#endif
     fpadding = false;
 //     halign = HAlignNone;
     fnowhite = false;
@@ -455,6 +457,7 @@ bool  WikiAttribTable::readAttribMore (const ustring& key, WikiMotorObjVec& vval
     } else {
        switch (selector2) {
        case SEL_TABLE:
+#ifdef WIKITABLEATTRIB
            if (match (key, CharConst ("cellspacing"), CharConst ("spc"))) {
                paramUNum (vval.textOut (wiki), cellspacing, key);
            } else if (match (key, CharConst ("cellpadding"))) {
@@ -462,6 +465,9 @@ bool  WikiAttribTable::readAttribMore (const ustring& key, WikiMotorObjVec& vval
            } else {
                return false;
            }
+#else
+           return false;
+#endif
            break;
        case SEL_TR:
        case SEL_TD:
@@ -483,9 +489,12 @@ bool  WikiAttribTable::readAttribMore2 (const ustring& key, WikiMotorObjVec& cel
     } else {
        switch (selector2) {
        case SEL_TABLE:
+#ifdef WIKITABLEATTRIB
            if (match (key, CharConst ("noborder"), CharConst ("nb"))) {
                fnoborder = true;
-           } else if (match (key, CharConst ("padding"), CharConst ("pad"))) {
+           } else
+#endif
+           if (match (key, CharConst ("padding"), CharConst ("pad"))) {
                fpadding = true;
            } else if (match (key, CharConst ("expanding"), CharConst ("expand"))) {
                fpadding = false;
@@ -541,9 +550,11 @@ void  WikiAttribTable::outputMore (MotorOutput* out) {
 
     switch (selector2) {
     case SEL_TABLE:
+#ifdef WIKITABLEATTRIB
        wiki->outputName (out, CharConst ("border"), fnoborder ? 0 : 1, false);
        wiki->outputName (out, CharConst ("cellspacing"), cellspacing, false);
        wiki->outputName (out, CharConst ("cellpadding"), cellpadding, false);
+#endif
        break;
     case SEL_TR:
     case SEL_TD:
index 3df3312..ee5ca26 100644 (file)
@@ -121,9 +121,11 @@ class  WikiAttribTable: public WikiAttrib1 {
     ustring  height;
     ustring  bgcolor;
     bool  fnowrap;
+#ifdef WIKITABLEATTRIB
     bool  fnoborder;           /* table */
     int  cellspacing;
     int  cellpadding;
+#endif
     bool  fpadding;
     bool  fnowhite;
     bool  fturn;
index 58eca5a..e85e756 100644 (file)
@@ -19,7 +19,7 @@
 /*
   WIKIMOTORPRE: セットすると,フォーマット済みテキストブロックの中でインライン要素の解釈を行う。
   UTF8JP: セットすると,条件によりパラグラフ内の改行を空白に置き換えない。
-  TABLECOMPATFLAG: セットすると,旧形式の表の継続記号もゆるす。
+  WIKITABLECOMPATFLAG: セットすると,旧形式の表の継続記号もゆるす。
 */
 
 #define  kComment      "//"
@@ -631,9 +631,9 @@ void  WikiBlockItemDL::output (MotorOutput* out) {
 
 |table:||c:||
 |h:名前|h:省略形|h:意味|
-|noborder|nb|border="0"を出力する。|
-|cellspacing=''integer''|spc=|cellspacing属性を出力する。|
-|cellpadding=''integer''||cellpadding属性を出力する。|
+//|noborder|nb|border="0"を出力する。|
+//|cellspacing=''integer''|spc=|cellspacing属性を出力する。|
+//|cellpadding=''integer''||cellpadding属性を出力する。|
 |padding|pad|テーブルの最大のカラム数よりカラムが少ない行に,空のカラムを追加する。|
 |expanding|expand|テーブルの最大のカラム数よりカラムが少ない行の最後のカラムを引き延ばす。|
 |center|c|テーブルをセンタリングする。|
@@ -796,7 +796,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]*))?(&)$))");
@@ -870,7 +870,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]*))?(&)$");
@@ -1029,10 +1029,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 ("<table"));
     attrib.output (out);
     out->out_raw (CharConst (">\n"));