Migrate YaCy web page templates to moustache.js

Forum for developers

Migrate YaCy web page templates to moustache.js

Beitragvon Orbiter » Mi Jul 06, 2016 10:00 am

If you read http://mustache.github.io/ it looks like the creators of moustache.js had been inspired by our template system for web pages. Even the syntax is very similar.

http://mustache.github.io/#demo hat geschrieben:<h1>{{header}}</h1>
{{#bug}}
{{/bug}}

{{#items}}
{{#first}}
<li><strong>{{name}}</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
{{/link}}
{{/items}}

{{#empty}}
<p>The list is empty.</p>
{{/empty}}


To move the YaCy architecture to more common web design patterns it could be good to move all our servlets to moustache.js.

This could be done with two components:
- all servlets could render a JSON result using the YaCy patterns
- all html pages then use moustache.js and the json from the servlets to display it's content.

We could go there doing two steps:
- add a servlet which creates the JSON from all servlets automatically (should not be very difficult)
- create a translator which is able to translate all html pages from YaCy patterns to moustache.js patterns. That translator could then re-write all our html pages.

What do you think?
Orbiter
 
Beiträge: 5792
Registriert: Di Jun 26, 2007 10:58 pm
Wohnort: Frankfurt am Main

Re: Migrate YaCy web page templates to moustache.js

Beitragvon luc » Do Jul 07, 2016 12:55 pm

Hi, personally I also agree with the idea of using common and well known and documented libraries. On the other hand I think YaCy templating system is quite raw but do the job, and its entry-barrier is quite low.
Anyways, your plan sounds feasible. I only hope the generic JSON producing servlet will not add to much processing overhead.
luc
 
Beiträge: 288
Registriert: Mi Aug 26, 2015 1:04 am


Zurück zu YaCy Coding & Architecture

Wer ist online?

Mitglieder in diesem Forum: Google [Bot] und 1 Gast

cron