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

ReadText should linearize text to preserve indexes #1

Open
jlewi opened this issue Jun 16, 2022 · 0 comments
Open

ReadText should linearize text to preserve indexes #1

jlewi opened this issue Jun 16, 2022 · 0 comments

Comments

@jlewi
Copy link
Owner

jlewi commented Jun 16, 2022

Right now ReadText linearizes the text just by concatenating strings as it reads through elements.

func ReadText(doc *docs.Document) (string, error) {

As a result, the order in which elements are processed will affect the position of the text in the resulting string. The indexes may therefore not match the indexes used in the Google Document
https://developers.google.com/docs/api/reference/rest/v1/documents#ParagraphElement

This will make it impossible to map any annotations on the text back to google doc elements.

We should linearize text in order to align with Google Documents indexing. This should be straightforward. As we read elements we can populate a string using the indexes specified in the Google Doc element.

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

1 participant