Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not finding all the knot tags I expected #249

Closed
paulloz opened this issue Jan 8, 2017 · 4 comments
Closed

Not finding all the knot tags I expected #249

paulloz opened this issue Jan 8, 2017 · 4 comments

Comments

@paulloz
Copy link
Contributor

paulloz commented Jan 8, 2017

Hello there!
It seems whether I misunderstood my reading on #122 or I'm experiencing some unwanted behavior with knot tags.

I'm using 0.6.4 (outside of Unity).
Here's my test .ink file:

Here we go
-> knot

== knot ==
# knot tag
Knot content
And some content with a line tag # line tag
-> DONE

Which compiles to:

{"inkVersion":15,"root":["^Here we go","\n",{"->":"knot"},"done",{"knot":[{"#":"knot tag"},"^Knot content","\n","^And some content with a line tag ",{"#":"line tag"},"\n","done",{"#f":3}],"#f":3}]}

I'm logging on each line the text, how many tags there is in .currentTags and the tags themselves. Here's what I'm seeing in my logs:

"Here we go", 0, []
"Knot content", 1, ["knot tag"]
"And some content with a line tag",  1, ["line tag"]

On the third line of text, am I not supposed to find both "knot tag" and "line tag" in .currentTags?

@paulloz paulloz changed the title Issue with knot tags Not finding all the knot tags I exepected Jan 8, 2017
@paulloz paulloz changed the title Not finding all the knot tags I exepected Not finding all the knot tags I expected Jan 8, 2017
@joethephish
Copy link
Member

Nope, this is working as expected. Even when the tag is on the line above, it is still attached to just one particular line.

The only other thing is that any tags at the top of a knot are also accessible through the TagsForContentAtPath method, e.g. story.TagsForContentAtPath("knot") ==> knot tag, which is useful for adding metadata to the knot itself.

@paulloz
Copy link
Contributor Author

paulloz commented Jan 10, 2017

Ok, I was asking because in this comment you were saying this which seemed to state another behavior:

then story.currentTags will give you a list that contains the initial "a knot tag" and "another knot tag" since it's associated with the line that was just generated.

Anyway, thanks for the answer!

@joethephish
Copy link
Member

Right, so to give another example:

== knot ==
# one
# two
This line has tags one, two, three and four. # three # four
# five
This line has tags five and six. # six
This line has no tags at all.
# seven       // this tag isn't associated with any line

Meanwhile...

story.TagsForContentAtPath("knot") will yield ["one", "two"].

Clear? :)

@paulloz
Copy link
Contributor Author

paulloz commented Jan 10, 2017

Yep ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants