co-analysis / a11ytables

R package: generate best-practice stats spreadsheets for publication
https://co-analysis.github.io/a11ytables/
Other
40 stars 3 forks source link

Allow multiple rows under a section on the cover page #102

Closed matt-dray closed 7 months ago

matt-dray commented 8 months ago

Right now for the cover, the user provides a data.frame. One column of the input gives each section heading and a second column provides the corresponding content for that section; in the final output this ends up as header-section-header-section, etc, down the column.

Downside as it stands: all the section content must goes in a single cell, which makes #47 tricky. It may also just be easier to break up information and allow people to better tab through it if each piece of information is in its own row.

Allow users to provide a list instead, so:

list(
  About = "This is a spreadsheet.",
  Section = "Here's some more notes.",
  Contact = c(
    "[Email](mailto:test@fake.net)",
    "[Website](https://rstats.lol)"
  )
)

Where each list element is a section named for the title it'll get, and the content of each list element is a vector of text, each of which will be a separate row under the corresponding header. Markdown links could be provided for hyperlinks (as per #47).

Don't deprecate the ability to provide a data.frame for the cover though, otherwise we lose backwards compatibility.

matt-dray commented 8 months ago

If the user provides a dataframe as input to the cover 'table' then the styling occurs every other cell, which is very simple. Given a list input, we'll need to locate (which()) the row indices containing subheaders so that these can be targeted for styling.

matt-dray commented 7 months ago

This requires writeFormula() if a cell contains a formula , otherwise writeData(). But should the whole thing should be marked up as a table (which is done with writeDataTable() per the tables of data)? I'm pretty sure it shouldn't be marked-up as a table, since it isn't a table and doesnt have headers like a table.