Skip to content

Commit

Permalink
Merge pull request #16 from openmls/keks/add-checkset-html-id
Browse files Browse the repository at this point in the history
Allow linking check sets
  • Loading branch information
keks authored Sep 27, 2024
2 parents dd018a7 + ab883a0 commit b02a7ae
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions utils/html.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,12 @@ let Check/tableRow
, content = [ XML.text "" ]
}

let linkCell =
XML.element
{ name = "td"
, attributes = XML.emptyAttributes
, content = [ checkLink ]
}

let idCell =
XML.element
{ name = "td"
, attributes = XML.emptyAttributes
, content = [ XML.text idString ]
, content =
[ XML.text idString, XML.rawText " ", checkLink ]
}

let statusCell =
Expand Down Expand Up @@ -207,7 +201,7 @@ let Check/tableRow
{ name = "tr"
, attributes = [ XML.attribute "id" idString ]
, content =
[ linkCell, idCell, statusCell, descCell, rfcLinksCell, notesCell ]
[ idCell, statusCell, descCell, rfcLinksCell, notesCell ]
}

let thead =
Expand All @@ -216,11 +210,6 @@ let thead =
( XML/wrapList
"tr"
[ XML.element
{ name = "th"
, attributes = XML.emptyAttributes
, content = [ ]: List XML.Type
}
,XML.element
{ name = "th"
, attributes = XML.emptyAttributes
, content = [ XML.text "id" ]
Expand Down Expand Up @@ -251,38 +240,49 @@ let thead =
let CheckSet/table
: Types.CheckSet -> XML.Type
= \(checkSet : Types.CheckSet) ->
XML.element
{ name = "div"
, attributes = XML.emptyAttributes
, content =
[ XML.element
{ name = "h2"
, attributes = XML.emptyAttributes
, content = [ XML.text checkSet.name ]
}
, XML.element
{ name = "div"
, attributes = [ XML.attribute "class" "check-set-desc" ]
, content =
[ XML.rawText checkSet.desc.text, RfcRef/links checkSet.desc ]
}
, XML.element
{ name = "table"
, attributes = XML.emptyAttributes
, content =
[ thead
, XML/wrapList
"tbody"
( Prelude.List.map
Types.Check
XML.Type
Check/tableRow
checkSet.checks
)
]
let idString = "cs" ++ Natural/padToText 2 checkSet.id

let checkLink =
XML.element
{ name = "a"
, attributes = [ XML.attribute "href" ("#" ++ idString) ]
, content = [ XML.text "" ]
}
]
}

in XML.element
{ name = "div"
, attributes = [ XML.attribute "id" idString ]
, content =
[ XML.element
{ name = "h2"
, attributes = XML.emptyAttributes
, content = [ XML.text (checkSet.name ++ " "), checkLink ]
}
, XML.element
{ name = "div"
, attributes = [ XML.attribute "class" "check-set-desc" ]
, content =
[ XML.rawText checkSet.desc.text
, RfcRef/links checkSet.desc
]
}
, XML.element
{ name = "table"
, attributes = XML.emptyAttributes
, content =
[ thead
, XML/wrapList
"tbody"
( Prelude.List.map
Types.Check
XML.Type
Check/tableRow
checkSet.checks
)
]
}
]
}

let outerTemplate
: Text -> List XML.Type -> XML.Type
Expand Down

0 comments on commit b02a7ae

Please sign in to comment.