This function takes a section title, a content-generating function, and a data frame, then produces an HTML file that displays the section header and its content. This generic function works for any section (e.g. Conflict of Interest, Author Contributions, Acknowledgements).
Usage
render_section_html(
section_title,
content_function,
data,
output_file = tempfile(fileext = ".html"),
...
)Arguments
- section_title
A character string for the section header (e.g., "Conflict of Interest").
- content_function
A function that accepts a data frame and returns a formatted character string.
- data
A data frame containing the necessary columns.
- output_file
The path to the output HTML file. Defaults to a temporary file.
- ...
Additional arguments passed to
content_function.
Examples
if (FALSE) { # \dontrun{
# To render the Conflict of Interest section:
html_path <- render_section_html("Conflict of Interest", generate_conflict, authors)
browseURL(html_path)
} # }
