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

[Textile] refactor #4195

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

[Textile] refactor #4195

wants to merge 1 commit into from

Conversation

jrappen
Copy link
Contributor

@jrappen jrappen commented Mar 25, 2025

  • refactor syntax
    • bump version: 2
    • fix first_line_match
    • move pushed anonymous contexts to named contexts
    • move word-lists to syntax vars
    • remove capturing groups where not used
    • separate matches for:
      • extended blocks that pop before the next block
      • (regular) blocks that pop before next empty line
    • differentiate as described for the following blocks between extended and regular:
      • comments
      • code blocks
      • quotation blocks
      • notextile blocks
      • pre blocks
    • differentiate between bold and strong
    • differentiate between italic and emphasized
    • fix matching subword-superscript and subword-subscript
    • fix matching subword-insertion and subword-deletion
    • fix matching indentation of (extended) blocks when indented on both sides
    • fix strings, string escapes and invalid newline within strings
    • fix notextile inline and between HTML-tags
  • add metadata
    • add headings to symbol list
    • transform headings symbols
    • add tests for transformed symbols
  • add settings

@jrappen
Copy link
Contributor Author

jrappen commented Mar 26, 2025

image

With regards to the HTML option of notextile as described here:

https://textile-lang.com/doc/no-textile-processing

How should I fix that? Do I just put a match in the "html" context and after <notextile> tag push to plain text and pop before closing </notextile> tag?

@jrappen jrappen force-pushed the fix-textile branch 2 times, most recently from 9523b48 to 9f01d22 Compare March 28, 2025 11:46
@jrappen jrappen changed the title [Textile] re-write [Textile] refactor Mar 28, 2025
@jrappen jrappen force-pushed the fix-textile branch 3 times, most recently from d2b8350 to d61a08c Compare March 28, 2025 22:26
@michaelblyons
Copy link
Collaborator

For <notextile>, I am perhaps not the most qualified person to weigh in, but I expect embed of HTML is best to ensure escape at arbitrary locations. I think one question after that is whether you feel very strongly that you want to clear all scopes or whether text.html.textile ... text.html.plain is okay.

@jrappen
Copy link
Contributor Author

jrappen commented Mar 28, 2025

I understood that it should be plain text between the "notextile" HTML tags.

@jrappen jrappen force-pushed the fix-textile branch 2 times, most recently from 3d27158 to 686d2aa Compare March 29, 2025 19:31
@jrappen
Copy link
Contributor Author

jrappen commented Mar 29, 2025

⚠️ FYI: Current status of the syntax performance while testing with the updated test file.

OLD

Syntax "Packages/Textile/Textile.sublime-syntax" took an average of 1.3ms ±0.0ms over 10 runs
    minimum: 1.2ms, maximum: 1.3ms
[Finished]

NEW

Syntax "Packages/Textile/Textile.sublime-syntax" took an average of 1.7ms ±0.2ms over 10 runs
    minimum: 1.5ms, maximum: 2.0ms
[Finished]

@jrappen
Copy link
Contributor Author

jrappen commented Mar 31, 2025

Not sure why transforming symbols doesn't work as expected. Will check again later.

Scopes are fine.

Seems to add whitespace I prepend fine, also seems to extend the symbol region by the amount of characters added as whitespace towards EOF. Only does for globals (indexed symbols). Weird.

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

2 participants