stringformat determines the correct formatting verb for the given BibTeX field value.
(v string)
| 248 | |
| 249 | // stringformat determines the correct formatting verb for the given BibTeX field value. |
| 250 | func stringformat(v string) string { |
| 251 | // Numbers may be represented unquoted. |
| 252 | if _, err := strconv.Atoi(v); err == nil { |
| 253 | return "%s" |
| 254 | } |
| 255 | |
| 256 | // Strings with certain characters must be brace quoted. |
| 257 | if strings.ContainsAny(v, "\"{}") { |
| 258 | return "{%s}" |
| 259 | } |
| 260 | |
| 261 | // Default to quoted string. |
| 262 | return "%q" |
| 263 | } |
| 264 | |
| 265 | // MakeKeyMap creates the KeyMap from CiteName to entry |
| 266 | func (bib *BibTex) MakeKeyMap() { |