19 lines
799 B
Plaintext
19 lines
799 B
Plaintext
{{- /* Note this file has CRLF line endings as required by the specs */ -}}
|
|
{{- /* replace does not support piping */ -}}
|
|
{{- $escaped := replace (replace (replace (replace . "\\" "\\\\") "\n" "\\n") "," "\\,") ";" "\\;" -}}
|
|
{{- $escapedLen := strings.RuneCount $escaped -}}
|
|
{{- $lineLen := 60 -}}
|
|
{{- $parts := (div $escapedLen $lineLen) -}}
|
|
{{- if (not (modBool $escapedLen $lineLen)) -}}
|
|
{{- $parts = (add $parts 1) -}}
|
|
{{- end -}}
|
|
|
|
{{- /* print the string by parts of at most 75 chars as required by the specs */ -}}
|
|
{{- range (seq (sub $parts 0)) -}}
|
|
{{- if (eq . 1) -}}
|
|
{{- substr $escaped (mul (sub . 1) $lineLen) $lineLen -}}
|
|
{{- else }}{{- /* the leading whitespace is important here */}}
|
|
{{ substr $escaped (mul (sub . 1) $lineLen) $lineLen -}}
|
|
{{- end -}}
|
|
{{- end -}}
|