S2 Guide: Background

From Dreamwidth Notes
Jump to: navigation, search

S2 is a programming language designed to be a generic style system for web applications, which can give users a lot of control over their own style. It has properties in common with Perl, Python, and Java.

Originally made (and still used by) LiveJournal, Dreamwidth uses it as a the base for all journal layouts.

It was created to be:

  • Easy and flexible for beginners: by giving a layout properties, end users who don't know any HTML, CSS, or hex color codes would be able to change their layout using a customization wizard.
  • Powerful for layout makers: because S2 is a programming language, a layout maker has a lot of control over what happens. Additionally, layout makers can override what needs to change, instead of having to duplicate lots of code.
  • Secure for the service: S2 code can't get access to anything on the host machine, do anything malicious to the server, or waste host machine resources. Untrusted S2 code can't print Javascript, which prevents people from making styles containing exploits.
  • Translatable for other languages and cultures: S2 makes it possible for the system and layouts to override all the text appearing in the final output, as well as property names and descriptions, so that a layout doesn't have to be in English.