Closed distelli-1 closed 10 years ago
@distelli can you try to associate your scala templates with the "razor" engine
@distelli see engine association on http://web-mode.org
@fxbois Indent seems not work properly
indent with case statement not work properly
@a match {
case a => {
<span>xxx</span>
}
case a => {
<span>yyy</span>
}
}
indent with argument declaration followed by layout declaration not work properly
@(seq: Seq[String])
@admin(title="bar") {
<span>
@for(a <- b) {
@a match => {
case A => {
<span></span>}
case B => {
<td></td>}
}
}
</span>
}
@jilen Parsing razor (/play) is very complicated (compared with all the other engines I ve played with)
Do you know where i can find some info about how to parse such templates (even parser source code)
What is very strange to me is how it knows inside a block that the line is a html line (only because the first char is <
?)
Moreover,
} else {
is a valid razor line. But it is also a valid js line. So we inevitably have conflicts.
It would be great for me to find some help.
Btw, I ve updated web-mode.el yesterday with patches for razor
@fxbois http://www.playframework.com/documentation/2.2.0/ScalaTemplates , there are some rules described in play framework documentation.
It is really complicated, because it can embed almost any scala code into play 2.0 template, with the @
character
+1 razor association didn't help. Would be nice at least basic html features in play templates.
Could you get the last version of web-mode on github and send me the debug info displayed when you execute the command web-mode-debug
--- WEB-MODE DEBUG BEG ---
versions: emacs(24.3) web-mode("7.0.50")
vars: engine("razor") content-type("html") file("/home/peter/work/pet/scala/hewi/app/views/config.scala.html")
system: window(x) config("x86_64-pc-linux-gnu")
colors: fg("#e4e4ef") bg("#181818")
modes: whitespace-mode(nil) rainbow-mode(nil) idle-highlight-mode(nil)
(transient-mark-mode line-number-mode auto-compression-mode auto-encryption-mode auto-composition-mode font-lock-mode global-font-lock-mode file-name-shadow-mode menu-bar-mode mouse-wheel-mode tooltip-mode yas/global-mode recentf-mode show-paren-mode icomplete-mode linum-mode global-linum-mode global-auto-complete-mode delete-selection-mode undo-tree-mode global-undo-tree-mode rainbow-delimiters-mode global-rainbow-delimiters-mode smartparens-mode smartparens-global-mode)
--- WEB-MODE DEBUG END ---
@petro-rudenko could you put on gist an example that does not work please
@distelli @jilen @petro-rudenko I ve pushed a new version. Could you test it please ?
@for(acc <- accounts) {
<tr>
<td>@acc.id</td>
<td>@acc.email</td>
<td>
@acc.accountType match {
case Account.VIP => {<span class="label label-danger">VIP</span>}
case Account.NORMAL => {<span class="label label-info">}
}</td>
<td>@acc.parent</td>
</tr>
Pattern match with multi case statement seems not parsed correctly.
@distelli @jilen @petro-rudenko the last version committed should work better
I have tried, it works for me!!! Thanks @fxbois
Some html tag not recognized when file is firstly opened. And will be recognized after edit.
Look at the button element
Firstly open:
After edit
@jilen could you post this example on gist please.
Could you also update to the last version available on github et post the output of web-mode-debug
Thank you in advance
I am using the latest web-mode from elpa I post the html file and web-mode-debug output here! https://gist.github.com/jilen/8295906
@jilen Hope the last commit fixes your issue
(for other issues, could you open new issues please)
@jilen is it ok ... can I close the issue ?
Ok.
Here is a simple PlayFramework Template:
https://gist.github.com/distelli/7175009
Web Mode is confusing the scala bits with the JS and HTML. If you can make webmode correctly parse HTML that contains Scala Code and JS then you'll make a lot of Play Framework Devs like me happy!
Thanks for building this. Web is super cool!