Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation decoration style #136

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/backends/html/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,41 @@ export HTMLDecoration, HTMLHighlighter, HTMLTableFormat
HTMLDecoration

Structure that defines parameters to decorate a table cell.
All the style parameters are added in-line to the HTML style of the cell

# Fields

The following 5 fields can be provided as keyword argumets and are useed to set the
relevant HTML/CSS style attributes of the same name:
- `color::String`
- `background::String`
- `font_family::String`
- `font_weight::String`
- `text_decoration::String`

Additionally, a final field:
- `style::Dict{String,String}`
is used to provide a dictionary where the keys are names of arbitrary CSS style values
and the values are the corresponding style values to assign to the cell.

# Remark
Any style attribute provided among the first 5 fields of the HMTLDecoration element will
overwrite existing values for the same attribute in the optionally provided `style` Dict.

"""
@kwdef struct HTMLDecoration
color::String = ""
background::String = ""
font_family::String = ""
font_weight::String = ""
text_decoration::String = ""
style::Dict{String,String} = Dict{String,String}()
end

HTMLDecoration(color::String) = HTMLDecoration(color = color)

function Dict(d::HTMLDecoration)
style = Dict{String,String}()
style = d.style

!isempty(d.color) && (style["color"] = d.color)
!isempty(d.background) && (style["background"] = d.background)
Expand Down