MCPcopy Index your code
hub / github.com/github/git-sizer / CreateCitation

Method CreateCitation

sizes/footnotes.go:25–37  ·  view source on GitHub ↗

CreateCitation adds a footnote with the specified text and returns the string that should be used to refer to it (e.g., "[2]"). If there is already a footnote with the exact same text, reuse its number.

(footnote string)

Source from the content-addressed store, hash-verified

23// there is already a footnote with the exact same text, reuse its
24// number.
25func (f *Footnotes) CreateCitation(footnote string) string {
26 if footnote == "" {
27 return ""
28 }
29
30 index, ok := f.indexes[footnote]
31 if !ok {
32 index = len(f.indexes) + 1
33 f.footnotes = append(f.footnotes, footnote)
34 f.indexes[footnote] = index
35 }
36 return fmt.Sprintf("[%d]", index)
37}
38
39// String returns a string representation of the footnote, including a
40// trailing LF.

Callers 1

EmitMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected