gitea源码

svgcontainer.tmpl 1.5KB

12345678910111213141516171819202122232425
  1. <div id="rel-container">
  2. <svg viewbox="{{Eval .Graph.MinColumn "*" 5}} {{Eval .Graph.MinRow "*" 12}} {{Eval .Graph.Width "*" 5 "+" 5}} {{Eval .Graph.Height "*" 12}}" width="{{Eval .Graph.Width "*" 10 "+" 10}}px">
  3. {{range $flowid, $flow := .Graph.Flows}}
  4. <g id="flow-{{$flow.ID}}" class="flow-group flow-color-{{$flow.ColorNumber}} flow-color-16-{{$flow.Color16}}" data-flow="{{$flow.ID}}" data-color="{{$flow.ColorNumber}}">
  5. <path d="{{range $i, $glyph := $flow.Glyphs -}}
  6. {{- if or (eq $glyph.Glyph '*') (eq $glyph.Glyph '|') -}}
  7. M {{Eval $glyph.Column "*" 5 "+" 5}} {{Eval $glyph.Row "*" 12 "+" 0}} v 12 {{/* */ -}}
  8. {{- else if eq $glyph.Glyph '/' -}}
  9. M {{Eval $glyph.Column "*" 5 "+" 10}} {{Eval $glyph.Row "*" 12 "+" 0}} l -10 12 {{/* */ -}}
  10. {{- else if eq $glyph.Glyph '\\' -}}
  11. M {{Eval $glyph.Column "*" 5 "+" 0}} {{Eval $glyph.Row "*" 12 "+" 0}} l 10 12 {{/* */ -}}
  12. {{- else if or (eq $glyph.Glyph '-') (eq $glyph.Glyph '.') -}}
  13. M {{Eval $glyph.Column "*" 5 "+" 0}} {{Eval $glyph.Row "*" 12 "+" 12}} h 5 {{/* */ -}}
  14. {{- else if eq $glyph.Glyph '_' -}}
  15. M {{Eval $glyph.Column "*" 5 "+" 0}} {{Eval $glyph.Row "*" 12 "+" 12}} h 10 {{/* */ -}}
  16. {{- end -}}
  17. {{- end}}" stroke-width="1" fill="none" id="flow-{{$flow.ID}}-path" stroke-linecap="round"></path>
  18. {{range $flow.Commits}}
  19. <circle class="flow-commit" cx="{{Eval .Column "*" 5 "+" 5}}" cy="{{Eval .Row "*" 12 "+" 6}}" r="2.5" stroke="none" id="flow-commit-{{.Rev}}" data-rev="{{.Rev}}"></circle>
  20. {{end}}
  21. </g>
  22. {{end}}
  23. </svg>
  24. </div>