mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
add tc-table-data as new utility class
This commit is contained in:
parent
815182cf7a
commit
9c252083d1
@ -128,10 +128,12 @@ var processRow = function(prevColumns,options) {
|
|||||||
// Move back to the closing `|`
|
// Move back to the closing `|`
|
||||||
this.parser.pos--;
|
this.parser.pos--;
|
||||||
cell.end = this.parser.pos;
|
cell.end = this.parser.pos;
|
||||||
|
if(this.addData) {
|
||||||
$tw.utils.addClassToParseTreeNode(cell,colCount%2 ? "oddCol" : "evenCol");
|
$tw.utils.addClassToParseTreeNode(cell,colCount%2 ? "oddCol" : "evenCol");
|
||||||
$tw.utils.addAttributeToParseTreeNode(cell,"data-col",colCount);
|
$tw.utils.addAttributeToParseTreeNode(cell,"data-col",colCount);
|
||||||
$tw.utils.addAttributeToParseTreeNode(cell,"data-addr",options.rowCount + "/" + colCount);
|
$tw.utils.addAttributeToParseTreeNode(cell,"data-addr",options.rowCount + "/" + colCount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
col++;
|
col++;
|
||||||
cellRegExp.lastIndex = this.parser.pos;
|
cellRegExp.lastIndex = this.parser.pos;
|
||||||
cellMatch = cellRegExp.exec(this.parser.source);
|
cellMatch = cellRegExp.exec(this.parser.source);
|
||||||
@ -155,6 +157,7 @@ exports.parse = function() {
|
|||||||
var rowType = rowMatch[2];
|
var rowType = rowMatch[2];
|
||||||
// Check if it is a class assignment
|
// Check if it is a class assignment
|
||||||
if(rowType === "k") {
|
if(rowType === "k") {
|
||||||
|
this.addData = rowMatch[1].split(" ").indexOf("tc-table-data") !== -1;
|
||||||
$tw.utils.addClassToParseTreeNode(table,rowMatch[1]);
|
$tw.utils.addClassToParseTreeNode(table,rowMatch[1]);
|
||||||
this.parser.pos = rowMatch.index + rowMatch[0].length;
|
this.parser.pos = rowMatch.index + rowMatch[0].length;
|
||||||
} else {
|
} else {
|
||||||
@ -181,7 +184,9 @@ exports.parse = function() {
|
|||||||
// Create the row
|
// Create the row
|
||||||
var theRow = {type: "element", tag: "tr", children: [], start: rowMatch.index};
|
var theRow = {type: "element", tag: "tr", children: [], start: rowMatch.index};
|
||||||
$tw.utils.addClassToParseTreeNode(theRow,rowCount%2 ? "oddRow" : "evenRow");
|
$tw.utils.addClassToParseTreeNode(theRow,rowCount%2 ? "oddRow" : "evenRow");
|
||||||
|
if(this.addData) {
|
||||||
$tw.utils.addAttributeToParseTreeNode(theRow,"data-row",rowCount);
|
$tw.utils.addAttributeToParseTreeNode(theRow,"data-row",rowCount);
|
||||||
|
}
|
||||||
rowContainer.children.push(theRow);
|
rowContainer.children.push(theRow);
|
||||||
// Process the row
|
// Process the row
|
||||||
theRow.children = processRow.call(this,prevColumns,{rowCount: rowCount});
|
theRow.children = processRow.call(this,prevColumns,{rowCount: rowCount});
|
||||||
|
Loading…
Reference in New Issue
Block a user