Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added script and style tags like similar to slim #17

Merged
merged 1 commit into from Apr 1, 2017
Merged

Added script and style tags like similar to slim #17

merged 1 commit into from Apr 1, 2017

Conversation

elorest
Copy link
Contributor

@elorest elorest commented Mar 31, 2017

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 elorest mentioned this pull request Mar 31, 2017
Copy link
Owner

@jeromegn jeromegn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is impressive!

There are a few formatting things that are weird and make it seem like there are more changes than there really are. I think those should be fixed before this is merged.

README.md Outdated
</span>
</span>
</span>
<span class="alongside" pid="#{Process.pid}">
<custom-tag id="with-id" pid="#{Process.pid}">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those were here to test interpolation. Is that not working anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I added some more things to the slang side and then copied over the result... Interpolation still works. I just didn't notice that it stayed in the html side since it said "Compiles to HTML". I assumed it was the output not ecr. Sorry. I'll fix that.

next_char
end
end
end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened here? haha. Is that crystal tool format?

next
end
else
if (close_char == '"' || close_char == '\'') && current_char == close_char && !escaped
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about formatting, this is confusing.

@@ -14,6 +14,7 @@ module Slang
def parse(io_name = Slang::DEFAULT_BUFFER_NAME)
String.build do |str|
loop do
# puts "hello you"
# puts token.inspect
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well remove those comments :)

@elorest
Copy link
Contributor Author

elorest commented Mar 31, 2017

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

@elorest
Copy link
Contributor Author

elorest commented Mar 31, 2017

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

README.md Outdated
title This is a title
style:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why suddenly we'd do the colon : thing here? Is it a limitation of the tokenizer / lexer?

I think css: and javascript: would be appropriate, but style and script are real HTML tags that may have attributes and such.

Would it be possible to make them normal tags (no colon)?

@elorest
Copy link
Contributor Author

elorest commented Mar 31, 2017

@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
Copy link
Contributor Author

elorest commented Mar 31, 2017

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
Copy link
Owner

@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
Copy link
Contributor Author

elorest commented Mar 31, 2017

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

Also fixed escaping in single line style and script tags
@crisward
Copy link
Contributor

crisward commented Apr 1, 2017

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 jeromegn merged commit 2215d96 into jeromegn:master Apr 1, 2017
@jeromegn
Copy link
Owner

jeromegn commented Apr 1, 2017

Well done!

@elorest
Copy link
Contributor Author

elorest commented Apr 1, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants