Closed xiaohanyu closed 11 years ago
I've do some exploring work on page-header, see
I think mustache is much more self-evident, thus can avoid many comments about template tags(%c, %g, etc). The shortage of https://github.com/Wilfred/mustache.el is that mustache.el and its dependencies is not quite mature, maybe, since many of them(ht.el, loop.el, with-namespace.el, all from Wilfred) has a short history. But I've seen some of Wilfred's code, I think it quite good.
Ah, I've found a quote in code:
"Remove whitespace at the beginning and STR. The function is copied from https://github.com/magnars/s.el, because I do not want to make org-page depend on other libraries, so I copied the function here, so do
trim-string-left
andtrim-string-right
."
I thinks it's unwise to worry about dependencies, modern tools from emacs(such as el-get, packages.el) has good solution for dependencies now). So I think if a library is good, just use it.
IMHO, string/regexp manipulation from elisp is not as good as string/regexp library from other languages such as Python, string/regexp matching use lots of global variable(similar to Ruby), which makes code not so straight forward. And org-page do use lots of string/regexp functions, So I think import extra good library such as s.el has more goodies than not importing it.
Waiting for your advice.
hi, kelvin, how do you think about this idea?
I need your feedback to do further refinement work.
Hi hanyu, sorry for late response that these two days I was busy on my company's work. I did some research on mustache
you introduced, it is really a good template system, and use {{ page-title }}
is really much better than %t
, so, please go ahead of your refinement, thanks for your hard work to org-page~ :-)
And, I want to do some explanation that why I did not import the dependency of s.el
:
As you see, org-page imported three utility functions of s.el
(in fact it is only one, the other two are not directly used by org-page), it is NOT heavily depended on s.el
, so, import a new library but only uses its one interface conflicts with the simplicity principle. So I justed copied the utility function org-page needed.
And, as an editor, or course emacs is good at string/regexp manipulation, but I do admit that its string/regexp manipulation is not so directviewing and handy, but it is enough for org-page. And as you see, s.el
is based on emacs' built-in string/regexp manipulation function, what it does, is just make it more handy to use.
But mustache
is not the same, I think if we use this template system than the original simple format-spec
, it will be heavily depended by org-page, and also, mustache
is not like s.el
, the latter is just a utility function library. So, import the dependency of mustache.el
is welcome. :-D
And, I will be on my holiday in next three days, if you have any pull requests, issues or comments, just leave them there, I will handle them after I am back, thank very much.
Unfortunately, mustache.el
depends on extra library, including ht.el
, s.el
, dash.el
and with-namespace.el
. So I think a more detailed discussion is needed, and maybe we can provide an extra bundled version of org-page with depedent library included?
I'll try my best to do more exploring work in the next three days, maybe including some TDD practice with emacs ert. You're right that import extra dependencies break the simplicity, but we should consider whether or not it worth it.
What I want is a static blog generator based on emacs org-mode, something like https://github.com/getpelican/pelican or http://ruhoh.com/. To tell the truth, I was totally rocked by emacs org-mode, expecially org-publish and org-babel, that's why I want to stick on org-mode, and then found org-page, then try to make some coding work.
And finally, good luck with you and enjoy your holidays!
Sorry I did not notice the latest reply, github did not email a notification to me about your reply.
After I did some research on emacs' package system, I find it is quite easy to install packages, previously why I am concern about 3rd party dependency is because I do manual package management so I do not like a lot dependencies.
Now I have introduced mustache.el
into org-page, it is much more readable than format-spec
.
hi, kelvin:
I've found template with elisp format-spec is not flexible enough, and it is not user-friendly for template designers(for example, %d, %a is not as clearly understandable as {{date}}, {{author}}).
How do you think that we turn the simple format-spec based template to mustache-based template strategy? There're already some simple elisp library that support mustache, see:
I know this new strategy will put on some new dependencies on org-page, but I think it worth it in the long run. I've also found some good elisp libraries which may be useful:
I think these library should make org-page's code simpler and shorter, with the cost of importing extra dependencies.
Wait for you advice.