MCPcopy Create free account
hub / github.com/PerroEngine/Perro / svg_lines

Function svg_lines

perro_website/src/main.rs:237–257  ·  view source on GitHub ↗
(text: &str, max_chars: usize, max_lines: usize)

Source from the content-addressed store, hash-verified

235#[cfg(feature = "ssr")]
236fn social_svg(title: &str, label: &str, summary: &str) -> String {
237 let title_lines = svg_lines(title, 24, 3);
238 let summary_lines = svg_lines(summary, 54, 2);
239 let title_text = svg_text_lines(&title_lines, 86, 226, 68, 78, "title");
240 let summary_text = svg_text_lines(&summary_lines, 90, 458, 30, 42, "summary");
241 format!(
242 r##"<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="630" viewBox="0 0 1200 630">
243 <defs>
244 <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
245 <stop offset="0" stop-color="#10151b"/>
246 <stop offset="0.54" stop-color="#18232b"/>
247 <stop offset="1" stop-color="#27313a"/>
248 </linearGradient>
249 </defs>
250 <rect width="1200" height="630" fill="url(#bg)"/>
251 <rect x="48" y="48" width="1104" height="534" rx="34" fill="none" stroke="#d2ff72" stroke-width="2" opacity="0.74"/>
252 <circle cx="1042" cy="138" r="70" fill="#d2ff72"/>
253 <text x="1042" y="159" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="58" font-weight="800" fill="#10151b">P</text>
254 <text x="86" y="126" font-family="Arial, Helvetica, sans-serif" font-size="30" font-weight="800" fill="#d2ff72">PERRO ENGINE</text>
255 <text x="86" y="170" font-family="Arial, Helvetica, sans-serif" font-size="24" font-weight="700" fill="#c7d3df">{}</text>
256 {}
257 {}
258 <text x="86" y="560" font-family="Arial, Helvetica, sans-serif" font-size="24" font-weight="700" fill="#d2ff72">perroengine.com</text>
259</svg>"##,
260 xml_escape(label),

Callers 1

social_svgFunction · 0.85

Calls 3

is_emptyMethod · 0.45
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected