MCPcopy Create free account
hub / github.com/TruthHun/BookStack / calculateRowSpans

Function calculateRowSpans

static/word2md/mammoth.browser.js:1160–1205  ·  view source on GitHub ↗
(rows)

Source from the content-addressed store, hash-verified

1158 }
1159
1160 function calculateRowSpans(rows) {
1161 var unexpectedNonRows = _.any(rows, function(row) {
1162 return row.type !== documents.types.tableRow;
1163 });
1164 if (unexpectedNonRows) {
1165 return elementResultWithMessages(rows, [warning(
1166 "unexpected non-row element in table, cell merging may be incorrect"
1167 )]);
1168 }
1169 var unexpectedNonCells = _.any(rows, function(row) {
1170 return _.any(row.children, function(cell) {
1171 return cell.type !== documents.types.tableCell;
1172 });
1173 });
1174 if (unexpectedNonCells) {
1175 return elementResultWithMessages(rows, [warning(
1176 "unexpected non-cell element in table row, cell merging may be incorrect"
1177 )]);
1178 }
1179
1180 var columns = {};
1181
1182 rows.forEach(function(row) {
1183 var cellIndex = 0;
1184 row.children.forEach(function(cell) {
1185 if (cell._vMerge && columns[cellIndex]) {
1186 columns[cellIndex].rowSpan++;
1187 } else {
1188 columns[cellIndex] = cell;
1189 cell._vMerge = false;
1190 }
1191 cellIndex += cell.colSpan;
1192 });
1193 });
1194
1195 rows.forEach(function(row) {
1196 row.children = row.children.filter(function(cell) {
1197 return !cell._vMerge;
1198 });
1199 row.children.forEach(function(cell) {
1200 delete cell._vMerge;
1201 });
1202 });
1203
1204 return elementResult(rows);
1205 }
1206
1207 function readDrawingElement(element) {
1208 var blips = element

Callers

nothing calls this directly

Calls 3

warningFunction · 0.70
elementResultFunction · 0.70

Tested by

no test coverage detected