Skip to content

feat(db): tag sqlAsTable HTML output with class="ijava-db-table" - #2

Open
emmanuelbruno wants to merge 1 commit into
chore/build-correctnessfrom
feature/db-table-class
Open

emmanuelbruno wants to merge 1 commit into
chore/build-correctnessfrom
feature/db-table-class

Conversation

@emmanuelbruno

Copy link
Copy Markdown
Collaborator

Why

%%sqlAsTable emits its default HTML output as <table border=1 style="border-collapse:collapse; width:100%;"> via display_data. Quarto 1.10.18's notebook-output pandoc pass neuters kernel-HTML table attributes: border becomes an inert data-border="1", inline style is dropped — so the tables render borderless on custom themes. Probe-verified on the ebpro render image (Quarto 1.10.18): custom class and data-* attributes survive the neutering.

Consumers today anchor the fragile table[data-border="1"] selector (a pandoc-mutated artifact). This PR gives them a stable, intentional hook.

Change

Add class="ijava-db-table" to both <table …> opening tags emitted by the sqlAsTable default-HTML path in JavaDBMSMagics.java (L559 and L626 — the two result-set render branches). border and style are kept as-is for backward compatibility: existing data-border="1" CSS anchors keep working unchanged.

-html.append("<table border=1 style=\"border-collapse:collapse; width:100%;\">\n<thead><tr>");
+html.append("<table class=\"ijava-db-table\" border=1 style=\"border-collapse:collapse; width:100%;\">\n<thead><tr>");

Downstream plan (ebpro consumer side)

  • Fleet lesson CSS switches from the table[data-border="1"] anchor to .ijava-db-table as the primary hook; the data-border anchor is retained belt-and-braces for jars predating this change.
  • Affected surface today: ebpro lab lab-quarto-lookandfeel lesson 07 (3 DB tables rendered via %%sqlAsTable).

Verification

  • ./gradlew compileJava compileTestJava — green (Temurin JDK 25, Gradle 9.7.1).
  • ./gradlew :test --tests 'io.github.spencerpark.ijava.magics.*' — green; existing JavaDBMSMagicsTest asserts on contains("<table"), unaffected by the added attribute.

Base note

Branches from chore/build-correctness (tip = tag v1.4.6-pr12, the lineage that produces the shipped IJava-v1.4.6-pr12.jar). master predates the %%sqlAsTable/%%rdbmsSchema magics entirely, so it cannot host this change.

Quarto 1.10.18 neutering kernel-HTML border attr to data-border="1"; class attrs survive.
Stable CSS hook for downstream renderers; border/style kept for backward compat.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant