Skip to content

Commit

Permalink
Merge pull request #333 from Mbodin/clippath
Browse files Browse the repository at this point in the history
Adding support for the clip-path presentation attribute.
  • Loading branch information
Drup authored Jan 19, 2024
2 parents d291653 + 2bd65e6 commit 06b5c2a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
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

0 comments on commit 06b5c2a

Please sign in to comment.