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

getRemark() does not function as expected #53

Open
hak33m16 opened this issue Jun 1, 2020 · 0 comments
Open

getRemark() does not function as expected #53

hak33m16 opened this issue Jun 1, 2020 · 0 comments

Comments

@hak33m16
Copy link

hak33m16 commented Jun 1, 2020

let str = `
# leading comment
value1: # inline comment
  sub: 1 # sub inline comment
# trailing comment`;

let yawn = new YAWN(str);

console.log("value1 remark:", yawn.getRemark('value1'));
console.log("value1.sub remark:", yawn.getRemark('value1.sub'));

yawn.setRemark('value1', "value1 new remark");
console.log("value1 remark:", yawn.getRemark('value1'));
console.log("value1.sub remark:", yawn.getRemark('value1.sub'));

Output:

value1 remark: sub inline comment
value1.sub remark: sub inline comment

value1 remark: value1 new remark
value1.sub remark: value1 new remark

The expected behavior would be that the returned value for value1's remark is inline comment, however, we get the remark of its child. This same issue means that any modifications to value1's remark modify its child, which you can see with the second set of print statements

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

No branches or pull requests

2 participants