The Polyglot Programmer / Items
Markuper: The Opera Unite Service template library - Opera Developer Community
Get Feed- Description
-
Introduction
Markuper is a template library that provides an easy way to develop Opera Unite Services.
Usually, when developing an Opera Unite Service, you need to output all content through the WebServerResponse.write* functions. That can easily be turned into a cumbersome task when there’s a need to change the document produced—for instance, when the designer wants to revamp the layout of the page. It also violates abstraction layers, between logic and separation, unless you create your own functions to separate them.
The Markuper template library tries to solve these problems by using a specific syntax that developers can use to create bindings between JavaScript code and HTML documents. In this article I’ll show you how to use the most important features of this library.
The contents of this article are as follows:
How to include the library in the service
Using JavaScript variables in the Template
How to control presentation of HTML elements
Binding HTML elements to JavaScript functions
Listing and highlighting source code
Adding and removing HTML elements
data-list — Iterating through arrays/objects
data-remove/keep-if — Removing unwanted elements
data-import — Importing other templates
My first template
The easiest way to show the template library in action is to output a simple HTML file, something that can already be easily achieved by calling WebServerResponse.writeFile , but nevertheless a task that will demonstrate the library perfectly.
How to include the library in the service
Before going into coding, you first need to include the template library in your service — to do so, you must create a script tag in the base index.html file (or the file specified on the widgetfile tag of config.xml ), pointing to ...
- Original URL
Comments
Report ThisTwine is about discovering, collecting and sharing the content that interests you. Learn More
Stats
- 6 Twines
- 6 Comments
Tags
Source Tags
Community Tags
Who's Interested In This?
-
added to Software, JavaScript Development, AJAX, The Polyglot Programmer, Web Development, Aasemoon'z Twine, 9 months ago
Public Comments
-
9 months ago
-
9 months ago
-
9 months ago
-
9 months ago
-
9 months ago
-
9 months ago
Add a Comment- Some HTML is allowed.
- Reply
- Cancel
- Submit
Aasemoon'z Twine- Some HTML is allowed.
- Reply
- Cancel
- Submit
JavaScript Development- Some HTML is allowed.
- Reply
- Cancel
- Submit
AJAX- Some HTML is allowed.
- Reply
- Cancel
- Submit
Web Development- Some HTML is allowed.
- Reply
- Cancel
- Submit
Software- Some HTML is allowed.
- Reply
- Cancel
- Submit
The Polyglot Programmer