jeromegn / slang

Slim-inspired templating language for Crystal
MIT License
236 stars 30 forks source link

Added script and style tags like similar to slim #17

Closed elorest closed 7 years ago

elorest commented 7 years ago

Took me a while to figure out how this was setup but I made script: and style: tags work similar to how css: and javascript: tags work in slim. I also added tests and updated the Readme.

elorest commented 7 years ago

Should be good now. Sorry about that formatting. Apparently the vim-crystal plugin lost it's mind.

elorest commented 7 years ago

Also changed the html output in the readme back to ecr. Sorry I didn't realize it wasn't pure html.

elorest commented 7 years ago

@jeromegn I used the colon so that script and style could still be treated like a normal tag for things like script src="/javascripts/application.js". script: and style: can be treated differently from script and style but it makes sense because they use the same tag in the end. javascript: and css: would work but then i'd need a named_tuple to map them to the right elements.

elorest commented 7 years ago

This maintains the same functionality as slim with the difference in naming. I was hesitant to use javascript: and css: because slim has built in interpreters for multiple things, ruby:, coffee:, css:, json:. I didn't want to have to build all of those so it made sense to me just to name them by the element but still leave the :. One issue though is that normal script and style still end up escaped. I'll fix that too.

jeromegn commented 7 years ago

@elorest I think we'd all be fine if only css: and javascript: were implemented :) The rest can come later. A named Tuple to match them seems easy enough!

Sorry if this is a lot to ask. You're doing great!

elorest commented 7 years ago

Done. I also fixed the inline style and script tags to not escape.

crisward commented 7 years ago

The nice thing about css: / javascript: is they work with slim syntax highlighter, which means no one has to maintain ide plugin for slang. Looking forward to seeing this merged.

jeromegn commented 7 years ago

Well done!

elorest commented 7 years ago

That's a good point. The slang vim plugin is maintained by me.

On Apr 1, 2017 5:22 AM, "Cris Ward" notifications@github.com wrote:

The nice thing about css: / javascript: is they work with slim syntax highlighter, which means no one has to maintain browser plugin for slang. Looking forward to seeing this merged.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jeromegn/slang/pull/17#issuecomment-290914049, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHmpLiDEydlTi6RMmgnDtvDK1iKK8hEks5rrjOKgaJpZM4MwFae .