исправлены находки ревью проектной стороны

- манифест читается так, как записан: решётка внутри строки не открывает
  комментарий, скобка внутри комментария не закрывает массив, имя внутри
  комментария не становится подпиской; новый ключ встаёт после массива,
  а не внутрь него
- всё записываемое проходит через manifest.Quote — обратный слэш в пути
  делал файл, который инструмент сам не читает
- маркер локальной части переехал в doc и пропускает огороженные блоки:
  процитированный в примере маркер больше не считается границей, а копия
  без маркера не перезаписывается молча
- лишний позиционный аргумент отсекается: flag прекращал разбор и прятал
  флаги после себя, из-за чего pull, list и check игнорировали --for
- заведены тесты проверок копий, включая молчание на исправной копии
This commit is contained in:
av
2026-07-27 21:16:29 +03:00
parent 23d88c4048
commit b6b0976c19
19 changed files with 904 additions and 197 deletions
+43
View File
@@ -378,3 +378,46 @@ func StripInline(line string) string {
// Len returns the number of lines in the file.
func (d *Document) Len() int { return len(d.lines) }
// LocalMarker is the boundary inside a copy between what the suite wrote and
// what the consuming repository wrote. It is the one piece of markup inside a
// convention that means something to the tool, and it is single and nameless,
// so there is no name to be orphaned by a rename.
//
// It lives here, next to the parsing, because both halves of the tool need it
// and need it read the same way: the assembler to know what to keep, the check
// to know what answers to which rules. Two constants would drift in silence.
const LocalMarker = "<!-- conv:local -->"
// Marker returns the line the local marker stands on, or zero.
//
// A marker inside a fenced block is a quotation of the markup rather than the
// markup itself — a convention about keeping copies would carry one — and
// taking it for the boundary would hand the whole document to the repository.
func (d *Document) Marker() int {
for n := 1; n <= d.Len(); n++ {
if !d.fence[n-1] && strings.TrimSpace(d.lines[n-1]) == LocalMarker {
return n
}
}
return 0
}
// Markers counts the local markers outside fenced blocks.
func (d *Document) Markers() []int {
var out []int
for n := 1; n <= d.Len(); n++ {
if !d.fence[n-1] && strings.TrimSpace(d.lines[n-1]) == LocalMarker {
out = append(out, n)
}
}
return out
}
// Below returns the lines from n to the end, joined.
func (d *Document) Below(n int) string {
if n < 1 || n > d.Len() {
return ""
}
return strings.Join(d.lines[n-1:], "\n")
}