- Add EachSeq[T](iter.Seq[T], fn) for iterator-based template rendering - Use slices.Collect(maps.Keys()) + slices.Sort for deterministic attr output - Use strings.SplitSeq in codegen TagToClassName and path parsing - Use range over int in layout and pipeline loops - Refresh go.sum Co-Authored-By: Gemini <noreply@google.com> Co-Authored-By: Virgil <virgil@lethean.io>
23 lines
466 B
Go
23 lines
466 B
Go
package html
|
|
|
|
import "strings"
|
|
|
|
// ParseBlockID extracts the slot sequence from a data-block ID.
|
|
// "L-0-C-0" → ['L', 'C']
|
|
func ParseBlockID(id string) []byte {
|
|
if id == "" {
|
|
return nil
|
|
}
|
|
|
|
// Split on "-" and take every other element (the slot letters).
|
|
// Format: "X-0" or "X-0-Y-0-Z-0"
|
|
var slots []byte
|
|
i := 0
|
|
for part := range strings.SplitSeq(id, "-") {
|
|
if i%2 == 0 && len(part) == 1 {
|
|
slots = append(slots, part[0])
|
|
}
|
|
i++
|
|
}
|
|
return slots
|
|
}
|