Skip to content

Instantly share code, notes, and snippets.

@nicholasf
Created October 8, 2009 07:25
Show Gist options
  • Save nicholasf/204842 to your computer and use it in GitHub Desktop.
Save nicholasf/204842 to your computer and use it in GitHub Desktop.
So hacking on Renshi to reduce typing needed for Ruby insertion led me to change the functionality of $ . It now acts more like a toggle switch and the $ symbol is finally inappropriate.
So here I think perhaps the pipe symbol would be a better fit. I'm seeking opinion on the following symbol use.
Take a quick glance at the bottom of this file, for the updated symbology.
Proprosed symbols:
| reserves the rest of the line (up until \n or the end of the element) for ruby, unless another | toggles back into HTML.
e.g.
<p>Welcome back |current_user.name| long time no see!</p>
is the same as
<p>Welcome back |current_user.name
long time no see! </p>
|| is used for a single phrase, so no toggle back is necessary
<p>Welcome back ||current_user.name long time no see!</p>
|{..} or |{..}| is used for some characters which can't be contained by the | symbol, for example in case you had to use '||'.
Alternatively, it might just be {..}, and to actually output a '{' in HTML you'd double it - {{.
<p>Welcome back |{ current_user.name + "\n" + current_user}| It might be possible that |{..} is no longer needed ...
|[..] or |[..]| would be used for ruby src code insertion (stuff that won't be to stringed)
|[if foo]
hello
|[end]
Again, it might just be
[if foo]
hello
[end]
[[ would output '['.
There'd have to be an escape character for | - it might be \| or something.
The only flaw of the | symbol, so far, is that it might be mistaken for a lowercase L in some fonts; but that's easily solvable (and the default font on Textmate is Monaco, anyhow).
In addition, the attribute expression stuff would drop the r prefix.
Instead of
<p r:if="user.authorized?">secret info.</p>
it would be
<p :if="user.authorized?">secret info. </p>
----- Summation
| - toggles in and out
|| - switches in for unbroken phrase. ||Time.now this is html now
{..} - for the defined open and end, which can handle the '|' char
[..] for src.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment