ninuzzo / hyde

A monstrous static website generator
9 stars 4 forks source link

Nice!! #1

Open arademaker opened 12 years ago

arademaker commented 12 years ago

About 3 months ago I wrote a comment in another repo that I was dreaming about rewriting Jekyll in Lisp:

https://github.com/kanru/alienpress/issues/1

You have stolen my dream!! ;-)

Nice to see this project! For sure I will try to use it in my website (http://arademaker.github.com) and in the website of our department (http://emap.fgv.br). Both websites use Jekyll now.

In the comment (link above) I mention a list of Jekyll's limitations that I am facing and also some suggested features for a lisp implementation. Of course, the best thing about your project is the fact that one can use lisp to code any dynamic HTML generation. Write a plugin in Ruby is not an option! After I have started to code in Lisp I don't have motivation to learn Ruby.

I haven't tried to use your code but I have a question and a comment:

Why you choose to implement an HTML generator instead of use one already available, like CL-WHO or any other listed in http://www.cliki.net/HTML%20generator?

What about doing your code an ADSF system. After that you could ask Zach to include it in http://www.quicklisp.org? BTW, you should not include cl-ppcre and usocket inside your code but make your project depend on those project. Quicklisp could solve this dependency and install those systems before your hyde system.

I am very impressed about your project and ideas! Congratulations! Hope to share more thoughts with you soon...

Best, Alexandre http://arademaker.github.com

ninuzzo commented 12 years ago

On 26 June 2012 04:38, Alexandre Rademaker < reply@reply.github.com

wrote:

About 3 months ago I wrote a comment in another repo that I was dreaming about rewriting Jekyll in Lisp:

Hi Alessandro, thank you for your appreciation.

Hyde walks through a directory when you request it with the browser: it recursively makes all the Lisp file inside the directory and its subdirectories, rather than giving you a fancy directory listing. I think the latter is not a very useful feature, you can rather get it with your file manager. I wanted the user to be able to control Hyde with a browser, without the need to open a command line, that most people find annoying :-)

Jekyll watches files and rebuilds them on every change, while Hyde does not watch anything, it rebuilds a changed file on every browser view (that is on every test) or when you build the whole directory. I am used to use my editor save function very often to prevent data loss if I am using a desktop computer and a blackout happens. So I do not want the HTML file to be regenerated on every save, like Jekyll does.

Hyde has dynamically scoped template variables introduced with a let-like form called "tvar". They are locals, not globals, that is only seen by inc-luded code inside the tvar form. IMO this makes them safer to use than Jekyll global YAML's variable. Giving a variable a scope helps to prevent clashes and frees that name when it goes out of scope.

Unfortunately I have have many implementation difficulties. E.g. I needed a lightweight Lisp with good Windows support because my intention was to target down-to-earth webmasters, neither Linux nor Lisp geeks. E.g. I have just begun to create screencasts that show how to use Hyde and introduce any Lisp concept through a real-world example, when and where it is used. The very first one is here:

http://ninuzzo.github.com/hyde/movies.html

Well, AFAIK the only option to generate small standalone executables for Windows is ECL (Embeddable Common Lisp). But I wasn't able to make hunchentoot run under ECL. So I had to develop my own toy HTTP server and that is still hand-wavy.

I am a Lisp beginner, this is my first project and my code would really need to be reviewed by other more expert Common Lisp programmers. There is also a lot of work to do to implement new features on the TODO list - and I even have thoughts about other interesting functionalities not on that list. I still have to think how they can fit in the overall system.

You or any other who wants to help is very welcomed! Let's bring the power Lisp to the web! We're already late. It should have been done before. They should have used Lisp instead of JavaScript and HTML :-P There are a lot of advantages to work at the DOM level and only Lisp makes that both feasible and easy.

What about doing your code an ADSF system. After that you could ask Zach to include it in http://www.quicklisp.org? BTW, you should not include cl-ppcre and usocket inside your code but make your project depend on those project. Quicklisp could solve this dependency and install those systems before your hyde system

I have great respect for Zach and all the other great Lisp hackers and I only learn from them. If only one of them will join this project, Hyde will easily take all the world down :-)

But yes, it would be possible to use Quicklisp instead of ASDF, but the latter comes with ECL. Anyway, as long as I can get a standalone executable I do not worry. But I warn you. I want it to be small and fast as well :-)

There is a good reason for that: I encourage users to keep a copy of Hyde bundled-in with each of their projects, so that I am free to change things in an incompatible way in the future, without worrying too much about existing users. I believe the need for back-compatibility is exactly what often hampers the evolution of a piece of software. Every time a user develops a new site, he can use the latest Hyde version. For old sites, they can continue to use the old embedded version, without breaking anything. I also want Hyde easy to install and self-contained, no separate runtime environment or such.

BTW I am planning to phase out the dependencies from those two external modules, which I used just because I was in a rush: e.g. I do not need all the stuff in cl-ppcre, just a simple custom string translation function that can probably be implemented even faster (since ECL compiles to C). Well, Common Lisp limitations are annoying. Standards that cannot be changed and do not evolve cannot survive!

Rather than using usocket, it would be better to use ECL's BSD-like sockets directly - my code is not portable for other reasons so usocket adds nothing.

I also have an unsolved issue in Internet Explorer: connection hangs and I do not know why. Either usocket or my code (and my ignorance) are to blame. I must try without usocket to see what happens.

But again, I am just a Lisp newbie. I really hope some Common Lisp hackers would join this open-source project and help me to make it grow.

Why you choose to implement an HTML generator instead of use one already available, like CL-WHO or any other listed in http://www.cliki.net/HTML%20generator?

About CL-WHO, I haven't used it because I wanted to return directly strings from tag-functions, not code. These strings are then concatenated so the final HTML code is assembled from strings.

This approach has both advantages and disadvantages, like almost everything in life. I have a feeling that it could be faster, although I have not taken any benchmarks yet. The main downside is that complicates HTML transformations, but do webmasters need that? XSLT has never been integrated with HTML, that is HTML itself has no transformation feature. Well, you can do that in JavaScript if you like to write a lot of code... The only need for something like XSLT I came across so far is the problem of generating a TOCs. But even in this problem, I had luck with a SAX-like approach rather than an XSLT-like implementation.

Anyway if I want to transform some code I can still do it, even if my tag-calls return strings and not code. It suffices to take the code literally (quote it or pass it to a macro so that it is not evaluated to strings). E.g. I would do exactly that to implement an on-demand link-check feature. This is why I have thought the CL-WHO approach to be overkill. I may be wrong, but this is my humble opinion.

And yes, I have used TCL before, a language where strings rather than lists are ubiquitous and that influenced me. But I think Lisp is still the best and can accommodate any point of view :-)

Antonio Bonifati Student and Italian teacher

http://ninuzzo.github.com/

There are no hard distinctions between what is real and what is unreal, nor between what is true and what is false. A thing is not necessarily either true or false; it can be both true and false. Harold Pinter

Non vi sono distinzioni nette tra ciò che è reale e ciò che è irreale, né tra quello che è vero e quello che è falso. Una cosa non è necessariamente vera o falsa, può essere sia vera che falsa allo stesso tempo