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

Use bufio.Scanner to find line numbers in templates. #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wttw
Copy link

@wttw wttw commented Jan 17, 2024

Summary

tmpl/extractLineInfo() uses text/scanner to generate a mapping between position and line number.

text/scanner is intended for text that looks something like Go source code, and gets confused when used on other sorts of text, such as HTML. It probably gets the right answer, but spews a lot of error messages to stdout.

This PR replaces extractLineInfo() with an implementation that uses bufio.Scanner() to break input into lines instead.

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

Successfully merging this pull request may close these issues.

None yet

1 participant