for cross-referencing code/rfc, also linkify the errata

This commit is contained in:
Mechiel Lukkien 2023-11-12 12:20:40 +01:00
parent 6a39f2cc54
commit a87ac99038
No known key found for this signature in database
2 changed files with 3 additions and 10 deletions

View file

@ -149,16 +149,12 @@ func main() {
lines = lines[:len(lines)-1] lines = lines[:len(lines)-1]
} }
for i, line := range lines { for i, line := range lines {
if !iserrata && len(line) > 80 { if !(iserrata && i > 0) && len(line) > 80 {
line = strings.TrimRight(line[:80], " ") line = strings.TrimRight(line[:80], " ")
} }
refs := lineRefs[i+1] refs := lineRefs[i+1]
if len(refs) > 0 { if len(refs) > 0 {
if iserrata {
line = ""
} else {
line = fmt.Sprintf("%-80s", line) line = fmt.Sprintf("%-80s", line)
}
// Lookup source files for rfc:line, so we can cross-link the rfcs. // Lookup source files for rfc:line, so we can cross-link the rfcs.
done := map[string]bool{} done := map[string]bool{}
@ -181,9 +177,6 @@ func main() {
} }
line += fmt.Sprintf(" %s%s:%d", comment, r.dstpath, r.dstlineno) line += fmt.Sprintf(" %s%s:%d", comment, r.dstpath, r.dstlineno)
} }
if iserrata {
line = line[1:]
}
} }
line += "\n" line += "\n"
b.WriteString(line) b.WriteString(line)

View file

@ -217,7 +217,7 @@ body { font-family: 'ubuntu mono', monospace; }
for i, line := range strings.Split(string(buf), "\n") { for i, line := range strings.Split(string(buf), "\n") {
if line == "" { if line == "" {
line = "\n" line = "\n"
} else if len(line) < 80 || strings.Contains(rfc.File, "-") { } else if len(line) < 80 || strings.Contains(rfc.File, "-") && i > 0 {
line = htmltemplate.HTMLEscapeString(line) line = htmltemplate.HTMLEscapeString(line)
} else { } else {
t := strings.Split(line[80:], " ") t := strings.Split(line[80:], " ")