Skip to content

broken parsing if reading more rules #7

@gucio321

Description

@gucio321

Hi there!
I'm from giu

We found the following issue in AllenDang/giu#979:

package main

import (
	"fmt"

	"github.com/napsy/go-css"
)

func main() {
	ex1 := `
rule {
	style1: value1;
}

rule2 {
	style2: value2;
}`

	stylesheet, err := css.Unmarshal([]byte(ex1))
	if err != nil {
		panic(err)
	}

	fmt.Printf("Defined rules:\n")

	for k := range stylesheet {
		fmt.Printf("- rule %q\n", k)
		for v := range stylesheet[k] {
			fmt.Printf("  - property %q\n", v)
		}
	}
}

output:

Defined rules:
- rule "rule"
  - property "style1"
- rule "rule2"
  - property "style2"
  - property "style1"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions