Coder Social home page Coder Social logo

lsp's People

Contributors

mikaelstaldal avatar mst-appear avatar nowaker avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nowaker

lsp's Issues

portable and easy to build project

I wasn't able to build LSP from sources. It's too complicated and does not include all compile dependencies in repo. I could download JARs but I don't even know which versions you compiled it against last time.

Another thing is putting addons for external libraries (Struts, Maverick) in core library. This should be done as a separate project/module.

I would recommend switching to Maven so that all dependencies are explicit (including version) and downloaded on demand during build. Maven project can consist of modules - ideally there would be lsp-core and other modules dependent on lsp-core (struts, maverick). Building lsp-core would not build Struts which is good.

I don't say you should do this in your repo - just help me to build the project, then I just fork the project and lead it my way. :) It would be great if you told me direct link to each JAR with good version.

JFlex=JFlex.jar
Ant=ant.jar
BCEL=bcel.jar
JUnit=junit.jar
Servlet=servlet.jar
Struts=struts.jar
Maverick=maverick.jar
JDOM=jdom.jar

define enclosing page directly in page content and chain enclosing pages

Currently, enclosing pages are defined during compilation:
lspc -enclose enclose.lsp subpage.lsp

Currently, I am adapting LSPX to compile pages during runtime. (Can you image recompiling and redeploying application every little change to template?) Everything works like a charm now including lsp:import and lsp:include/part.

However, I would really enjoy it if I could define enclosing page directly in subpage content.

<lsp:root extend="ENCLOSE.LSP" xmlns:lsp="http://staldal.nu/LSP/core" xmlns="http://www.w3.org/1999/xhtml" >
    <lsp:part name="head">
    <meta name="foo" content="bar"/>
</lsp:part>
...

Next step would be chaining enclosing pages.

base.lsp

<html>
  <body>
    <lsp:include part="menu" />
    <lsp:include part="content" />
  </body>
</html>

menu.lsp

<lsp:root extend="base.lsp">
  <lsp:part name="menu">
    <lsp:include part="top" />
    <lsp:include part="bottom" />
  </lsp:part>
</lsp:root>

actual-page.lsp

<lsp:root extend="menu.lsp">
  <lsp:part name="top">
    ...
  </lsp:part>

  <lsp:part name="bottom">
    ...
  </lsp:part>
  <lsp:part name="content">
    ......
  </lsp:part>
</lsp:root>

I would be really happy if you implemented that.
Thanks for LSPX.

BTW - You may take a look at Open Power Template 2 - a PHP template engine that looks like LSPX... but is way better and used quite often.

access all object methods within LSP expression

Consider classes:

class Profile:
    org.joda.time.DateTime getRegisterDate()

class DateTime:
    org.joda.time.DateTime.Property era()

And an LSP code:

<lsp:value-of select="$profile.registerDate.era"/>

This won't work because Joda Time does not follow JavaBean specification. Many libraries don't follow JavaBeans convention because of readability. Even Bob Martin is against get prefix, I don't like it either. But this is not important if JavaBeans spec sucks or not. LSP needs to be flexible and allow to call any method within LSP expression.

$profile.registerDate.era would evaluate this way:

  1. Is there profile.getRegisterDate()? Yes, there is, execute
  2. Is there registerDate.getEra()? No, there isn't.
  3. Is there registerDate.era()? yes, there is, execute.
  4. Render.

Pull changes from each other

I suggest pulling changes from each other instead of creating own commits that are based on each other's repos. This will make merging trivial. Tell me if it is OK for you. I can resign from my own "branding". ;-)

check for null maps in Frame<K,V> constructor and fall back to empty map

java.lang.NullPointerException
at nu.staldal.util.Environment$Frame.containsKey(Environment.java:229)
at nu.staldal.util.Environment.containsKey(Environment.java:98)
at _LSP_home_lsp271162734295519419._execute(home_lsp271162734295519419.lsp:14003)
at nu.staldal.lsp.LSPPageBase.execute(LSPPageBase.java:155)
at nu.staldal.lsp.LSPHelper.executePage(LSPHelper.java:542)
at nu.staldal.lsp.LSPHelper.executePage(LSPHelper.java:565)
at nu.staldal.lsp.servlet.LSPManager.executePage(LSPManager.java:235)

NPE is thrown when map is null.

boolean contains = map.containsKey(key);

I know I call for problems if I don't provide a map of values... but Spring Web MVC's <mvc:view-controller path="/home.html" view-name="home.lsp"/> does not provide one (actually it provides null instead of empty map). It would be reasonable to check in static class Frame<K,V>'s constructor for null maps and fall back to Collections.emptyMap() when null is passed.

Would it be OK if I just changed it myself and sent a pull request?

Hot compilation

Possibility to compile LSP pages on-the-fly in runtime after deployment.

This should be a configurable option, and it should still be possible to compile before deployment too.

attribute values should be expressions

<img>
    <lsp:attribute name="alt" value="$user.name" />
    <lsp:attribute name="src" value="$user.profile.avatar" />
</img>

I'm quite surprised to see <img alt="$user.name" src="$user.profile.avatar" /> in output.

I see no point in writing <img><lsp:attribute name="alt" value="something"/></img>. lsp:attribute make sens when expressions are allowed in value attribute.

I consider it critical.

code completion for LSP files with XML Schema

Code completion for LSP files is trivial to achieve thanks to XML Schema.

<html xmlns:lsp="http://staldal.nu/LSP/core" xmlns="http://www.w3.org/1999/xhtml">

IntelliJ IDEA can download XML Schema from http://staldal.nu/LSP/core and start completing the code.
Could you please tell me if you control staldal.nu domain so that we can upload a file to http://staldal.nu/LSP/core? If not, we can switch to my domain (nowaker.net).

Now I'm starting with writing the XML Schema.

LSP fails on XHTML entities

LSP file:

&copy; <a href="http://www.nowaker.net/">Damian Nowak</a>

Stacktrace:

java.lang.RuntimeException: /home/nwkr/projekty/java/openrepublik/openrepublik-web/src/main/webapp/WEB-INF/views/layouts/basic/layout.lsp:49:11: The entity "copy" was referenced, but not declared.
    nu.staldal.lsp.spring.webmvc.LspHotCompilerHelper.doCompile(LspHotCompilerHelper.java:203)
    nu.staldal.lsp.spring.webmvc.LspView.compileLspPage(LspView.java:64)
    nu.staldal.lsp.spring.webmvc.LspView.compileOrReuseLspPageClass(LspView.java:54)
    nu.staldal.lsp.spring.webmvc.LspView.render(LspView.java:39)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)```

Convert to string not implemented for type *

nu.staldal.lsp.LSPException: Convert to string not implemented for type java.sql.Timestamp
at nu.staldal.lsp.LSPPageBase.convertToString(LSPPageBase.java:336)
at _LSP_show_lsp573682768221718806._execute(show_lsp573682768221718806.lsp:26)
at nu.staldal.lsp.LSPPageBase.execute(LSPPageBase.java:155)
at nu.staldal.lsp.LSPHelper.executePage(LSPHelper.java:542)

Is there any reason why <lsp:value-of select="$someObject" /> throws an exception instead of calling someObject.toString()? I think LSP should automatically use toString()'s result.

LSPPageBase.java line 298 should be return value.toString().

I was trying to work-around this with <lsp:value-of select="$someObject.toString()" /> but this didn't work (actually user guide did not mention calling methods so I knew it won't work).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.