Cerise1488303085 Posted April 16, 2011 Share Posted April 16, 2011 http://userscripts.org/scripts/show/101223This adds two buttons for the rich text editor (TinyMCE) on community.secondlife.com. pre blocks (like those from the insert code button) will be highlighted assuming LSL. There is also a button to remove the highlights, in case the formatting looks wrong, or the style tags make the post too large.Right now this is an all or nothing operation, all pre blocks in the post or none will be highlighted. That could improve in the future, if I can find a nicer way into the iframe. default { state_entry() { llSay(0, "Hello, Avatar!"); } touch_start(integer total_number) { llSay(0, "Touched."); } } 2 Link to comment Share on other sites More sharing options...
Innula Zenovka Posted April 16, 2011 Share Posted April 16, 2011 default{ state_entry(){ llSay(0,"Wow, thanks Cerise!"); } } Yay! So easy. Thank you so much. Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 16, 2011 Share Posted April 16, 2011 default { state_entry() { llSay(0,"Ooo! This is fun!"); } } Thanks, Cerise! :smileyvery-happy: Link to comment Share on other sites More sharing options...
Cerise1488303085 Posted April 16, 2011 Author Share Posted April 16, 2011 Hi, I do see the mess that happens when an already inserted pre is edited in TinyMCE, and am working on a fix. Link to comment Share on other sites More sharing options...
Void Singer Posted April 17, 2011 Share Posted April 17, 2011 one small typo, an extra "s" in 'link_message' I also tweaked a bit, moved "default" and "state" from the keywords list to the function list (since those are sections in the viewer highligher, and similarly colored to functions) nixed the 'event' keyword (was that a typo? or do we actaully have an "event" keyword and I didn't know?) and removed @ from the punctuation list, adding keyword: /^@[a-zA-Z_]\w*/ to lslTokens and matching coloring of other in lslColors to the keyword type: * could possibly add the "print" keyword.... it's in the LSO compiler... may not be in the mono one... but that's just geekiness =) ETA: * fixed mistake on my part Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted April 17, 2011 Share Posted April 17, 2011 Yes, event is a reserved word, it is declared in indra.y and indra.l but it has no corresponding function. It will cause a syntax error if it is used as a function or variable name. print is parsed as a generic expression in real LSL, I threw it on the states pile because it was defined in the middle of them. I will change event and print to use red "don't do that!" highlights like broken comments. Jump targets are not really parsed the same way the SL editor highlights them. @ is a reserved word on its own, it can be followed by arbitrary whitespace, new lines and comments before the label. The SL editor uses a hacky highlight, like /^@.*/, even if the syntax is bogus. The editor also has trouble with valid syntax like @ foo; llOwnerSay ("huh?"); To make this right, I will promote "@" to a keyword, and add highlights for words that follow "@" or "jump". I will probably do a similar thing for "state" and the special "default" case. There are a few more little things I want to check in there too. Link to comment Share on other sites More sharing options...
Void Singer Posted April 17, 2011 Share Posted April 17, 2011 Cerise Sorbet wrote: Yes, event is a reserved word, it is declared in indra.y and indra.l but it has no corresponding function. It will cause a syntax error if it is used as a function or variable name. print is parsed as a generic expression in real LSL, I threw it on the states pile because it was defined in the middle of them. I will change event and print to use red "don't do that!" highlights like broken comments. Jump targets are not really parsed the same way the SL editor highlights them. @ is a reserved word on its own, it can be followed by arbitrary whitespace, new lines and comments before the label. The SL editor uses a hacky highlight, like /^@.*/, even if the syntax is bogus. The editor also has trouble with valid syntax like @ foo; llOwnerSay ("huh?"); To make this right, I will promote "@" to a keyword, and add highlights for words that follow "@" or "jump" I will probably do a similiar thing for "state" and the special "default" case. cool, didn't know we had an event keyword in there... or that you could break @ apart like that. I guess properly the keyword and label are separate, but I didn't think about it (missed the print keyword in the events list, sry), good stuff though Link to comment Share on other sites More sharing options...
Cerise1488303085 Posted April 17, 2011 Author Share Posted April 17, 2011 Changes are uploaded today. 2011-04-17 special case reserved words print, event; special highlights for jump, @, default, state; typos 2011-04-16 move decimal ints to end of list, to capture floats w/trailing period Known problems: The highlighter is not prepared to handle text that has been modified in the rich editor, so don't do that. If you want to edit the contents of a code block that was already pasted in: In rich text mode, press the - LSL button to remove existing highlights. Switch to the HTML tab and edit the code there. Remember to escape less than, greater than, ampersand if you add them. Switch back to the rich text tab and press + LSL I will try to make this less painful in the future if the editor lets me. Link to comment Share on other sites More sharing options...
Talarus Luan Posted April 19, 2011 Share Posted April 19, 2011 OK, so you have to insert the code as a block first, then the highlighting is applied to all blocks. That wasn't clear in the instructions; might want to add that somewhere. Nifty, though. Thanks! Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted April 20, 2011 Share Posted April 20, 2011 Thanks. The "insert code" limitation will be a very temporary one if I can help it. Some real life work this week comes first. Link to comment Share on other sites More sharing options...
Cerise1488303085 Posted May 15, 2011 Author Share Posted May 15, 2011 Hi, there is a small update for this today. I have temporarily removed the white-space:pre hack because it does not get along with the new editor. This trouble really needs to be fixed on the site CSS. Copying and pasting the code should still be OK even if it wraps weirdly on the forum, and I will touch up Blue Goo in a few minutes to do the right thing. Hopefully LL can follow suit with the default style sheet. Link to comment Share on other sites More sharing options...
Cerise1488303085 Posted May 15, 2011 Author Share Posted May 15, 2011 OK, Blue Goo is updated to force no wrapping. On Firefox, go to http://userstyles.org/styles/44855/community-secondlife-com-blue-goo-theme and it will detect if you need an upadte, and you can press the install button to copmlete it. If you use Chrome's Stylish, the update procedure is different. Right-click on the Stylish icon in the browser toolbar, and pick Options, then press the Check for Update button. If you are newly installing the style sheet, use the same link as for Firefox above. stylish for Firefox is here, the Chrome version is here. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 15, 2011 Share Posted May 15, 2011 Sorry, I'm confused. I've updated Blue Goo in both Chrome and Firefox 4. Sample scripts produced in both LSLEditor and Notepad++ look OK when I copy paste them and press the +LSL button but when I click Preview it seems (both visually and from the HTML) to take out all the tabs and carriage returns/line feeds. And when I copy paste the results back to either editor, I just have one long line of code. Have I missed out a crucial step somewhere? Link to comment Share on other sites More sharing options...
Void Singer Posted May 15, 2011 Share Posted May 15, 2011 you also need to update the posting tool (it's a minor change from inserting the span that contains the whitspace style workaround to not inserting it) ETA: it does mean that others will see the code wrapped in the container... a poor decision on LL's or Lithiums part, I don't know which Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 15, 2011 Share Posted May 15, 2011 default{ state_entry() { llSay(0, "Thanks, Void and Cerise"); }} Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 15, 2011 Share Posted May 15, 2011 OK, so what's that trick? I updated both Stylish and the Blue Goo bit, but I still have no line feeds..... default { state_entry() { llSay(0,"I don't get it. What else do I do?"); } } Link to comment Share on other sites More sharing options...
Cerise1488303085 Posted May 15, 2011 Author Share Posted May 15, 2011 hi, it looks from the highlighting that you are using an early version of the posting script, that is the main thing you will want to update. It should be only a matter of picking the download button as userscripts.org again, greasmonkey should overwrite the old one for you Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 15, 2011 Share Posted May 15, 2011 Still confused. What posting script? There's a third script to update? Link to comment Share on other sites More sharing options...
Cerise1488303085 Posted May 15, 2011 Author Share Posted May 15, 2011 Yes, the posting script itself, http://userscripts.org/scripts/show/101223 -- that is the part that really needed the fix. The blue goo.Stylish stuff has a secondary workaround, to restore the wrap override we can't do any more at edit time. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 15, 2011 Share Posted May 15, 2011 integer ItWorks;default{ state_entry() { ItWorks = (integer)llFrand(1.0); if (ItWorks) { llSay(0,"Oh. I forgot that script was even there. Got it! Thanks, Cerise."); { else { llSay(0,"Nope. Still not quite there."); } }} ETA: WooHoo! :smileyvery-happy: Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now