senny / sablon

Ruby Document Template Processor based on docx templates and Mail Merge fields.
MIT License
446 stars 128 forks source link

Implement different error messages for unknown HTML tags and invalid tag placement #66

Closed stadelmanma closed 7 years ago

stadelmanma commented 7 years ago

This arises from #65 where it is not clear when the end user is using an unknown tag, a valid tag in an invalid way (i.e. <i></i> outside of a paragraph or div). A better route is to create a separate error message when the structure itself is invalid but the tag is supported.

Currently the code handles Runs and Paragraphs separately validating the structure as it loops through nodes. Depending on eventual refactors from #62 and/or #48 if we choose to implement inline HTML replacement that may not be the most effective and/or logical way. A separate method to check the final AST structure produced may be better in terms of future code flexibility.