R, 5050 46 bytes
split(r<-readLinesfunction(r)split(r,substr(r,1,regexpr("\\]""]",r)))
Outputs as a list
with each element name
d with the [tag]
. Each list element maintains order within its tag. Returns an empty named list named list()
for empty input.
-2 bytes each thanks to Robin Ryder and Dominic van Essen!