Always nice to be able to brag in a report ;-)
On Friday, November 22, 2024 at 10:26:38 AM UTC Edward K. Ream wrote: > This Engineering Notebook post brags about progress in improving Leo's > syntax coloring. This > <https://groups.google.com/g/leo-editor/c/flHyJjO2YIA/m/m7MSpYp_CgAJ>thread > discussed my first thoughts. > > > PR #4204 <https://github.com/leo-editor/leo-editor/pull/4203> contains > the code. It: > > > - Generalizes the syntax (code pattern) established by @language jupytext. > > - Adds two semantics methods to the jedit class. > > - Adds new rules (functions) for html elements in three *mode files*: > > html.py, css.py, and javascript.py. > > > This excellent strategy appeared after many happy hours of experimentation. > > > *Semantics* > > > The PR adds two new semantic methods: jedit.*push_delegate* and jedit. > *pop_delegate* and modifies an existing semantic method, jedit. > *match_at_language*. > > > These methods are tricky because they must alter the (complex!) state of > the jedit class. > > > These methods hide all such complexity from the rule functions in the mode > files. > > > *Rule functions* > > > The PR adds new rules for *html *elements to the three mode files. Rules > for: > > > <script>, </script>, <style>, </style> > > > *replace* the corresponding *delegated rule sets* in each mode file! In > other words, the PR greatly reduces the scale of delegation. > > > These new rules follow a straightforward pattern: > > > - Rules for <style> and <script> color the element and call push_delegate. > > - Rules for </style> and </script> color the element and call > pop_delegate. > > - Rules for @language color the directive and call match_at_language. > > > This is how it is written in The Book. > > > *Summary* > > > New html *rules* replace entire rule *sets* in html.py, css.py, and > javascript.py. These mode files now use the "delegate" kwarg *only* to > colorize single html elements! > > > The semantics methods hide all the heavy lifting from the rule methods. > > > The PR must still fix all semantic edge cases. In the end, everything will > look effortless. > > > Edward > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/leo-editor/d49f27ae-8e79-4ca8-bdb9-00744bf28b3dn%40googlegroups.com.
