mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
for cross-referencing code/rfc, also linkify the errata
This commit is contained in:
parent
6a39f2cc54
commit
a87ac99038
2 changed files with 3 additions and 10 deletions
11
rfc/link.go
11
rfc/link.go
|
@ -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 = fmt.Sprintf("%-80s", line)
|
||||||
line = ""
|
|
||||||
} else {
|
|
||||||
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)
|
||||||
|
|
|
@ -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:], " ")
|
||||||
|
|
Loading…
Reference in a new issue