Table caption rendered differently with MediaWikiTableFormatterPlugin

36 views
Skip to first unread message

G.J.Robert

unread,
Aug 1, 2012, 3:45:35 AM8/1/12
to tiddl...@googlegroups.com
(Is Mr. Martin Budden still here?)

Hi Martin,

Could you kindly check http://gjrobert-test.tiddlyspace.com/tiddlers.wiki#%5B%5BTable%20captions%20of%20MediaWikiTableFormatterPlugin%20and%20TiddlyWiki%20default%20markup%5D%5D ?

It seems that the default TiddlyWiki markup makes the <caption> element inside the <table> but independent of <tbody>, while MediaWikiTableFormatterPlugin puts <caption> inside <tbody>, so the caption only occupies the width of a column, not the width of the whole table.

Perhaps we can check the code of the plugin? This formatter is such a useful one, which makes multi-line content more surviving.

Thank you all.

G.J.Robert

unread,
Aug 1, 2012, 7:02:36 PM8/1/12
to tiddl...@googlegroups.com
Hi,

Could anyone else kindly advise how to change the code so to put <caption> outside <tbody>?

Below seems to be the code to create the <tbody> element (pardon for my super novice JS knowledge):
config.formatters.push({
    name: 'enhancedTable',
    match: '^\\{\\|',
    handler: function(w) {
        var pair = MediaWikiTemplate.findTableBracePair(w.source,w.matchStart);
        if(pair.start==w.matchStart) {
            w.nextMatch = w.matchStart;
            var table = MediaWikiTemplate.createElement(w.output,'table');
            var tbody = MediaWikiTemplate.createElement(table,'tbody'); // required for IE
            var mwt = new MediaWikiTemplate();
            mwt.wikifyTable(tbody,w,pair);
        }
    }
});
As we can see, the original code seems to create a <tbody> with the same content of the whole tiddler source part to be wikified, and the scope seems to be the same as the <table> element, thus incorporating the <caption> element too.

And below there's surely a section of code to create the <caption> element. How can I modify the code so that the final <caption> can be created outside of <tbody> instead of inside of it?

Any suggestion is appreciated, thanks!
G.J.Robert於 2012年8月1日星期三UTC+8下午3時45分35秒寫道:
Reply all
Reply to author
Forward
0 new messages