On Tue, Mar 7, 2017 at 12:59 PM, 'Terry Brown' via leo-editor < leo-editor@googlegroups.com> wrote:
> I would resist removing @setting <https://github.com/setting> expansion > from stylesheets. > On second thought, I agree with you. But I am convinced that we need, *right now*, a better approach. I plan to do the following before 5.5b1: We must make stylesheets self contained. They should not depend on settings. Instead, let's *compose* style sheets from *local definitions*, using, say, @button make-style-sheet. This would be similar to @button make-theme in themes.leo. This button will replace StyleSheetManager.expand_css_constants and helpers. I improved this code today, but it is doomed ;-) The iterative replacements of constants has lots of problems. In particular, comments within comments *ruin* stylesheets in hard-to-see ways. We still need the @stylesheet tree, organizing all the various parts of the stylesheet. *One-level* substitution will be allowed within that tree. The only really new feature will be an @constants node. This will contain arbitrarily many lines of the form: name = substitution An easy rule *eliminates iterative replacement*: the substitution must either be a constant or an already-defined name. So the following lines are legal: solarized-base03 = #002b36 tree-bg = colarized-base03 text-font = Verdana body-font = text-font Within the @stylesheet tree, the @button script will replace @tree-bg by #002b36. The @button script will *never *insert comments, so @-replacement *within* comments in the @stylesheet tree will be safe, unlike at present. Comments will be allowed in the @constants node only on separate lines. Like this: solarized-base03 = #002b36 # solarized dark If the @setting <https://github.com/setting> expansion is hard to > understand, let's blame docs., comments, and code layout, not the > underlying mechanism. > No. The present mechanism sucks. let's not throw the baby out with the bathwater. > We are agreed on this one. Let me summarize the benefits: - The @settings tree will have no effect on the generated style sheet. (@data qt-gui-plugin-style-sheet). This is surprisingly important. No more wondering what happens in case of duplicate definitions. - The @constants node shows all potential @-substitutions at a glance. - The user need only move/clone the generated stylesheet inside the @settings tree. @theme trees never need to move. - The generated stylesheet explicitly shows the results of all substitutions. In case of mystery, the @stylesheet and @constants nodes are immediately to hand to clarify matters. - The StyleSheetManager class is still needed, but it will never create mysteries. 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 leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.