(options, noPrefix)
| 20091 | * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) |
| 20092 | * |
| 20093 | * @returns {Summary} summary instance |
| 20094 | */ |
| 20095 | addList(items, ordered = false) { |
| 20096 | const tag = ordered ? "ol" : "ul"; |
| 20097 | const listItems = items.map((item) => this.wrap("li", item)).join(""); |
| 20098 | const element = this.wrap(tag, listItems); |
| 20099 | return this.addRaw(element).addEOL(); |
| 20100 | } |
| 20101 | /** |
| 20102 | * Adds an HTML table to the summary buffer |
| 20103 | * |
| 20104 | * @param {SummaryTableCell[]} rows table rows |
| 20105 | * |
| 20106 | * @returns {Summary} summary instance |
| 20107 | */ |
| 20108 | addTable(rows) { |
| 20109 | const tableBody = rows.map((row) => { |
| 20110 | const cells = row.map((cell) => { |
| 20111 | if (typeof cell === "string") { |
| 20112 | return this.wrap("td", cell); |
| 20113 | } |
| 20114 | const { header, data, colspan, rowspan } = cell; |
| 20115 | const tag = header ? "th" : "td"; |
| 20116 | const attrs = Object.assign(Object.assign({}, colspan && { colspan }), rowspan && { rowspan }); |
| 20117 | return this.wrap(tag, data, attrs); |
| 20118 | }).join(""); |
| 20119 | return this.wrap("tr", cells); |
| 20120 | }).join(""); |
| 20121 | const element = this.wrap("table", tableBody); |
| 20122 | return this.addRaw(element).addEOL(); |
| 20123 | } |
| 20124 | /** |
no test coverage detected