From 385979af2d452cc364a0f6204ad26a410a362591 Mon Sep 17 00:00:00 2001 From: visor Date: Thu, 28 Jul 2011 00:45:19 +0900 Subject: [PATCH] table caption in the wiki function. --- wiki/wikiformat.cc | 14 ++++++++++++-- wiki/wikiformat.h | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/wiki/wikiformat.cc b/wiki/wikiformat.cc index 0a17359..80c316e 100644 --- a/wiki/wikiformat.cc +++ b/wiki/wikiformat.cc @@ -626,13 +626,14 @@ void WikiBlockItemDL::output (MotorOutput* out) { /* ============================================================ */ /*DOC: ===表=== - |table:w=100%|head:right:||right:| + |table:w=100%:数量リスト|head:right:||right:| |*:|head:品名|head:数量| |1|テレビ|2| |2|空気清浄機|3| +・テーブルセルオプション -表定義の最初の行の最初のカラムに「table:」を書くと,この行はテーブルオプション指定行になる。2番目以降のカラムは,デフォルトのカラムオプション指定になる。 +表定義の最初の行の最初のカラムに「table:」を書くと,この行はテーブルオプション指定行になる。属性指定の後にテキストを書くと,表のキャプションになる。 +2番目以降のカラムは,デフォルトのカラムオプション指定になる。 |table:||c:|| |h:名前|h:省略形|h:意味| @@ -854,6 +855,12 @@ void WikiBlockTable::addLine_head (uiterator b, uiterator e) { if (objvv.size () > 0 && objvv.back ()->size () == 0) objvv.pop_back (); attrib.shiftAttrib (objvv[0]); + + cell = new TableCell (wiki, false); + cell->cellBody (objvv[0].get (), this, 0); + captionHtml = cell->html; + delete cell; + for (i = 1; i < objvv.size (); i ++) { cell = new TableCell (wiki, true); cell->cellattrib.shiftAttrib (objvv[i]); @@ -1032,6 +1039,9 @@ void WikiBlockTable::outputTableTag (MotorOutput* out) { out->out_raw (CharConst ("out_raw (CharConst (">\n")); + if (captionHtml.length () > 0) { + out->out_raw (CharConst (""))->out_toText (captionHtml)->out_raw (CharConst ("\n")); + } } void WikiBlockTable::outputTBody (MotorOutput* out) { diff --git a/wiki/wikiformat.h b/wiki/wikiformat.h index 5ad2c75..b8453a2 100644 --- a/wiki/wikiformat.h +++ b/wiki/wikiformat.h @@ -343,8 +343,9 @@ class WikiBlockTable: public WikiBlock { int ccont; CellList_t defaultList; TableAry_t ary; + ustring captionHtml; - WikiBlockTable (WikiFormat* _wiki): WikiBlock (BlockTable, _wiki), attrib (_wiki, WikiAttribTable::SEL_TABLE, true), defaultList (_wiki) { + WikiBlockTable (WikiFormat* _wiki): WikiBlock (BlockTable, _wiki), attrib (_wiki, WikiAttribTable::SEL_TABLE, false), defaultList (_wiki) { n = 0; cont = false; ccont = 0; -- 2.11.0