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

Adding support for the clip-path presentation attribute. #333

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# NEXT

* Add support for the clip-path presentation attribute
(#333 by Martin @MBodin Bodin)

# 4.6.0

* Update for OCaml 5.0 and drop support for OCaml 4.2.0
Expand Down
3 changes: 3 additions & 0 deletions lib/svg_f.ml
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ struct
let a_patternTransform x =
user_attrib C.string_of_transforms "patternTransform" x

let a_clip_path =
string_attrib "clip-path"

let a_clipPathUnits x =
user_attrib C.string_of_big_variant "clipPathUnits" x

Expand Down
2 changes: 2 additions & 0 deletions lib/svg_sigs.mli
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ module type T = sig

val a_patternTransform : transforms wrap -> [> | `PatternTransform ] attrib

val a_clip_path : iri wrap -> [> | `Clip_Path ] attrib

val a_clipPathUnits :
[< `UserSpaceOnUse | `ObjectBoundingBox ] wrap ->
[> | `ClipPathUnits ] attrib
Expand Down
11 changes: 10 additions & 1 deletion test/test_svg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ let svg_filters = "svg filters", tyxml_tests Svg.[

]

let svg_clip_path = "svg clip-path", tyxml_tests Svg.[

"use with clip-path",
use ~a:[ a_clip_path "url(#test-clip)"; a_href "#test-object"] [],
{|<use clip-path="url(#test-clip)" href="#test-object"></use>|}

]

let tests = [
svg_attributes ;
svg_filters
svg_filters ;
svg_clip_path
]

let () = Alcotest.run "tyxml-svg" tests