Skip to content

Commit 5902846

Browse files
committed
static table text alignment
1 parent 84bd4d2 commit 5902846

File tree

3 files changed

+172
-172
lines changed
  • core
    • generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io
    • src/main/kotlin/org/jetbrains/kotlinx/dataframe/io
  • examples/notebooks/netflix

3 files changed

+172
-172
lines changed

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/html.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,14 @@ public fun AnyFrame.toStaticHtml(
220220
// properly laid out with borders.
221221
fun StringBuilder.emitHeader() = emitTag("thead") {
222222
for (row in colGrid) {
223-
emitTag("tr", "align=\"left\"") {
223+
emitTag("tr") {
224224
for ((j, col) in row.withIndex()) {
225225
val colBorders = col.borders.toMutableSet()
226226
// check if the next cell has a left border, and if so, add a right border to this cell
227227
if (row.getOrNull(j + 1)?.borders?.contains(Border.LEFT) == true) {
228228
colBorders += Border.RIGHT
229229
}
230-
emitTag("th", colBorders.toClass()) {
230+
emitTag("th", "${colBorders.toClass()} style=\"text-align:left\"") {
231231
append(col.columnWithPath?.name ?: "")
232232
}
233233
}
@@ -267,7 +267,7 @@ public fun AnyFrame.toStaticHtml(
267267
}
268268

269269
// Adds a single row to the html. This row uses the flattened columns to get them displayed non-collapsed.
270-
fun StringBuilder.emitRow(row: AnyRow) = emitTag("tr", "align=\"right\"") {
270+
fun StringBuilder.emitRow(row: AnyRow) = emitTag("tr") {
271271
for ((i, col) in flattenedCols.withIndex()) {
272272
val border = borders[i].toMutableSet()
273273
// check if the next cell has a left border, and if so, add a right border to this cell

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/html.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,14 @@ public fun AnyFrame.toStaticHtml(
220220
// properly laid out with borders.
221221
fun StringBuilder.emitHeader() = emitTag("thead") {
222222
for (row in colGrid) {
223-
emitTag("tr", "align=\"left\"") {
223+
emitTag("tr") {
224224
for ((j, col) in row.withIndex()) {
225225
val colBorders = col.borders.toMutableSet()
226226
// check if the next cell has a left border, and if so, add a right border to this cell
227227
if (row.getOrNull(j + 1)?.borders?.contains(Border.LEFT) == true) {
228228
colBorders += Border.RIGHT
229229
}
230-
emitTag("th", colBorders.toClass()) {
230+
emitTag("th", "${colBorders.toClass()} style=\"text-align:left\"") {
231231
append(col.columnWithPath?.name ?: "")
232232
}
233233
}
@@ -267,7 +267,7 @@ public fun AnyFrame.toStaticHtml(
267267
}
268268

269269
// Adds a single row to the html. This row uses the flattened columns to get them displayed non-collapsed.
270-
fun StringBuilder.emitRow(row: AnyRow) = emitTag("tr", "align=\"right\"") {
270+
fun StringBuilder.emitRow(row: AnyRow) = emitTag("tr") {
271271
for ((i, col) in flattenedCols.withIndex()) {
272272
val border = borders[i].toMutableSet()
273273
// check if the next cell has a left border, and if so, add a right border to this cell

0 commit comments

Comments
 (0)