{"id":23815248,"url":"https://github.com/rasviitanen/svgmacro","last_synced_at":"2025-10-12T06:18:39.118Z","repository":{"id":57669032,"uuid":"124372373","full_name":"rasviitanen/svgmacro","owner":"rasviitanen","description":"A Rust library (macro) for writing any SVG efficiently.","archived":false,"fork":false,"pushed_at":"2018-04-27T16:32:57.000Z","size":11454,"stargazers_count":7,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T08:52:54.652Z","etag":null,"topics":["macro","rust","svg","template-engine","xml"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/svgmacro","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rasviitanen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-08T09:59:45.000Z","updated_at":"2025-04-21T10:19:17.000Z","dependencies_parsed_at":"2022-08-27T03:51:38.318Z","dependency_job_id":null,"html_url":"https://github.com/rasviitanen/svgmacro","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rasviitanen/svgmacro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasviitanen%2Fsvgmacro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasviitanen%2Fsvgmacro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasviitanen%2Fsvgmacro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasviitanen%2Fsvgmacro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rasviitanen","download_url":"https://codeload.github.com/rasviitanen/svgmacro/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasviitanen%2Fsvgmacro/sbom","scorecard":{"id":762538,"data":{"date":"2025-08-11","repo":{"name":"github.com/rasviitanen/svgmacro","commit":"76dd591f44e692e05dec30a04dc45bd8a93e0646"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T23:49:18.556Z","repository_id":57669032,"created_at":"2025-08-22T23:49:18.556Z","updated_at":"2025-08-22T23:49:18.556Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010479,"owners_count":26084757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["macro","rust","svg","template-engine","xml"],"created_at":"2025-01-02T04:15:31.133Z","updated_at":"2025-10-12T06:18:39.069Z","avatar_url":"https://github.com/rasviitanen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svgmacro\n[![Cargo](https://img.shields.io/crates/v/svgmacro.svg)](https://crates.io/crates/svgmacro) \n[![Documentation](https://docs.rs/svgmacro/badge.svg)](https://docs.rs/svgmacro/)\n\u003cbr\u003e\nA Rust library for writing SVGs. Can write any SVG-element.\nFunction calls and variables defined in Rust can be used in the SVG without trouble.\n\nQuestions or requests can be emailed to\nrasviitanen@gmail.com.\n\nAdd the following to your Cargo.toml\n```\nsvgmacro = \"0.2.2\"\n```\n\nTo use the crate in your module, simply add:\n```\n#[macro_use]\nextern crate svgmacro;\n```\n\n## Examples\nTo use the macro, create a new String to store the result, and add \"use std::fmt:Write\"\nto be able to successfully write to it. Other types are also supported.\n```\nuse std::fmt::Write;\nlet mut out = String::new();\n```\nBelow is a quick example on how to use the macro. SVG elements and attributes are defined by their regular names found in the SVG reference.\n```\nuse std::fmt::Write;\nlet mut out = String::new();\n\nSVG!(\u0026mut out,\n    svg (width=\"100\" height=\"100\") [\n        circle (cx=\"50\" cy=\"50\" r=\"30\")\n    ]\n);\n```\nResult written to out:\n```\n\u003csvg width=\"100\" height=\"100\"\u003e\n    \u003ccircle cx=\"50\" cy=\"50\" r=\"30\"/\u003e\n\u003c/svg\u003e\n```\n### Elements, parantheses and brackets\nDefine elements in plain text by their element tag, their attributes in a parenthesis, (), and their children in a bracket, [].\nThese are all valid syntax (note that you do not have to use both brackets and parantheses).\n```\ng (fill=\"red\") [circle (cx=\"10\" cy=\"10\" r=\"10\")]\ng () [circle (cx=\"10\" cy=\"10\" r=\"10\")]\ng (fill=\"red\") []\ncircle (cx=\"10\" cy=\"10\" r=\"10\")\ntext [\"Test\"]\n```\n### Nested elements and multiple attributes\nNest elements by putting new elements inside the []-brackets of their parent.\nAdd multiple attributes by delmimiting them with a space.\n\n```\nSVG!(\u0026mut out,\n    svg [\n        g(size=\"12\" color=\"red\") [\n            circle(cx=\"10\" cy=\"10\" r=\"10\")\n            circle(cx=\"20\" cy=\"20\" r=\"10\")\n        ]\n        g(color=\"red\") [\n            circle(cx=\"20\" cy=\"20\" r=\"10\")\n        ]\n    ]\n);\n```\n### Rust expressions, functions and variables in SVG\nHandle variables and returning function calls by wrapping them in a {} closure, \nexpressions such as void functions, for loops and if expressions (any Rust code is ok) with a @-symbol and terminate with a \";\".\n```\nuse std::fmt::Write;\nlet mut out = String::new()\n\n// Define your variables\nlet width = \"200\";\nlet height = \"100\";\n\nSVG!(\u0026mut out,\n    svg (width={width} height={height}) [\n        g(fill={get_color()}) [\n            @ create_cool_shape(\u0026mut out); \n        ]\n        g [\n            @ for i in 1..3 {\n                let radius = 15*i;\n                // It is important to call the macro again, when using it from inside and expression.\n                SVG!(\u0026mut out, circle(cx={10*i} cy=\"10\" r={radius}));\n            }; \n        ]\n    ]\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasviitanen%2Fsvgmacro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frasviitanen%2Fsvgmacro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasviitanen%2Fsvgmacro/lists"}