init
This commit is contained in:
105
livejournal/doc/raw/ljp.book/styles/compare.xml
Executable file
105
livejournal/doc/raw/ljp.book/styles/compare.xml
Executable file
@@ -0,0 +1,105 @@
|
||||
<chapter id="ljp.styles.compare">
|
||||
<title>Comparing Style Systems</title>
|
||||
<para>When we designed S2, there were specific features that we had in mind
|
||||
that would fix certain design flaws inherit with S1. The table belows
|
||||
explains some of the reasoning behind these changes.</para>
|
||||
<informaltable frame='none'>
|
||||
<tgroup cols="3">
|
||||
<thead>
|
||||
<row >
|
||||
<entry>Feature</entry>
|
||||
<entry>S1</entry>
|
||||
<entry>S2</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row valign="top">
|
||||
<entry>Flexible & Extensible</entry>
|
||||
<entry><simpara>S1 forces users to define a template for each new type
|
||||
of view: recent entries, friends page, day view, calendar, etc. If
|
||||
we want to add a new view type, users have to basically write their
|
||||
style again.
|
||||
</simpara></entry>
|
||||
<entry><simpara>In S2 you describe the formatting of objects, not the
|
||||
formatting of views. Thus, we can easily add new views in the future,
|
||||
and making a <quote>recent</quote> view pretty much makes all your
|
||||
other views automatically.
|
||||
</simpara></entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>Safety</entry>
|
||||
<entry><simpara>S1 is completely safe. It's so brain-dead that it
|
||||
can't be anything but but safe. You have to have some intelligence
|
||||
to be harmful.
|
||||
</simpara></entry>
|
||||
<entry><simpara>The new style system is its own language that gets
|
||||
compiled into another language, and run on the webserver. Letting
|
||||
users run code on the server is inherently dangerous... it obviously
|
||||
has to be free of things like
|
||||
<command>rm</command> <option>-rf /</option>, but also, it has to be
|
||||
free from infinite loops, and anything that could consume large
|
||||
amounts of resources.</simpara>
|
||||
<simpara>The S2 language does not have while loops, gotos, or any
|
||||
other control construct that would permit an infinite loops. It only
|
||||
has if/else blocks and foreach over finite lists.</simpara>
|
||||
<simpara>There is also a limit on execution time of a resulting style,
|
||||
to avoid situations we can't easily trap such as functions calling
|
||||
each other in cycle, or badly-written recursion.</simpara>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>Speed</entry>
|
||||
<entry><simpara>S1 is a CPU hog, doing tons of parsing, text munging
|
||||
and substitutions and run-time.
|
||||
</simpara></entry>
|
||||
<entry><simpara>In the new system, S2 code will be parsed, checked, and
|
||||
compiled before the page is loaded. When a page is loaded in the
|
||||
future, the code will just be run, which will already be in the
|
||||
language that the LiveJournal server runs on. At the moment
|
||||
this is Perl but in the future we could write a PHP or Java servlet
|
||||
backend to the S2 compiler.
|
||||
</simpara></entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>Internationalizablilty</entry>
|
||||
<entry><simpara>S1 can support non-English languages and locales, but
|
||||
hardly:</simpara>
|
||||
<itemizedlist>
|
||||
<listitem><simpara>The server injects a lot of English into S1
|
||||
variables, especially in dates.</simpara></listitem>
|
||||
<listitem><simpara>The calendar always begins weeks on
|
||||
Sunday.</simpara></listitem>
|
||||
<listitem><simpara>The system to make nouns plural (2 Comments, 3
|
||||
Replies) is very English-specific.</simpara></listitem>
|
||||
<listitem><simpara>Porting a style to a new language involves
|
||||
forking the style and modifying away, losing all future changes
|
||||
to the original style. S1 forces users to define a template for
|
||||
each new type.</simpara></listitem>
|
||||
</itemizedlist>
|
||||
</entry>
|
||||
<entry><simpara>The new style system has been designed for
|
||||
internationalization. One of the S2 layers is an
|
||||
<quote>i18n layer</quote>, which overrides English method definitions
|
||||
from the core and sets properties, like the day weeks start on.
|
||||
</simpara></entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>Ease of Use</entry>
|
||||
<entry><simpara>S1 was never designed to be easy. It was designed for a
|
||||
few administrators to make styles, which would then be made public.
|
||||
</simpara></entry>
|
||||
<entry><simpara>Wizards and tools generate S2 behind the scenes for
|
||||
most users. The hard-core users can write their own layouts and overlay
|
||||
other layers in the raw S2 language.
|
||||
</simpara></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</chapter>
|
||||
<!--
|
||||
Local Variables:
|
||||
mode:sgml
|
||||
sgml-parent-document: ("index.xml" "part" "chapter")
|
||||
End:
|
||||
-->
|
||||
25
livejournal/doc/raw/ljp.book/styles/index.xml
Executable file
25
livejournal/doc/raw/ljp.book/styles/index.xml
Executable file
@@ -0,0 +1,25 @@
|
||||
<part id="ljp.styles.index" status="prelim">
|
||||
<title>Making Journal Styles</title>
|
||||
<partintro>
|
||||
<para>
|
||||
Styles are the part of LiveJournal that allows users to customize the look
|
||||
of their accounts.
|
||||
</para>
|
||||
<para>
|
||||
Currently there are two types of style interfaces available to use,
|
||||
the older <quote>S1</quote> which is very linear and dumb, and the newer
|
||||
<quote>S2</quote> which features its own sort of programming language.
|
||||
Read on for more information on S1, or visit <ulink url="/doc/s2/">The S2
|
||||
Manual</ulink> for more information on S2.
|
||||
</para>
|
||||
</partintro>
|
||||
&ljp.styles.compare;
|
||||
&ljp.styles.s1;
|
||||
&ljp.styles.s1.ref.gen;
|
||||
</part>
|
||||
<!--
|
||||
Local Variables:
|
||||
mode:sgml
|
||||
sgml-parent-document: ("../index.xml" "book" "part")
|
||||
End:
|
||||
-->
|
||||
10
livejournal/doc/raw/ljp.book/styles/s1/design.xml
Executable file
10
livejournal/doc/raw/ljp.book/styles/s1/design.xml
Executable file
@@ -0,0 +1,10 @@
|
||||
<section id="ljp.styles.s1.design">
|
||||
<title>Design Overview</title>
|
||||
<remark>STUB</remark>
|
||||
</section>
|
||||
<!--
|
||||
Local Variables:
|
||||
mode:sgml
|
||||
sgml-parent-document: ("index.xml" "chapter" "section")
|
||||
End:
|
||||
-->
|
||||
10
livejournal/doc/raw/ljp.book/styles/s1/history.xml
Executable file
10
livejournal/doc/raw/ljp.book/styles/s1/history.xml
Executable file
@@ -0,0 +1,10 @@
|
||||
<section id="ljp.styles.s1.history">
|
||||
<title>History & Motivations</title>
|
||||
<remark>STUB</remark>
|
||||
</section>
|
||||
<!--
|
||||
Local Variables:
|
||||
mode:sgml
|
||||
sgml-parent-document: ("index.xml" "chapter" "section")
|
||||
End:
|
||||
-->
|
||||
15
livejournal/doc/raw/ljp.book/styles/s1/index.xml
Executable file
15
livejournal/doc/raw/ljp.book/styles/s1/index.xml
Executable file
@@ -0,0 +1,15 @@
|
||||
<chapter id="ljp.styles.s1">
|
||||
<chapterinfo>
|
||||
<title>Style System 1 (<acronym>S1</acronym>)</title>
|
||||
</chapterinfo>
|
||||
<title>Style System 1 (<acronym>S1</acronym>)</title>
|
||||
<remark>Finish S1 docs, build reference from views.dat + vars.dat</remark>
|
||||
&ljp.styles.s1.history;
|
||||
&ljp.styles.s1.design;
|
||||
</chapter>
|
||||
<!--
|
||||
Local Variables:
|
||||
mode:sgml
|
||||
sgml-parent-document: ("../index.xml" "part" "chapter")
|
||||
End:
|
||||
-->
|
||||
10
livejournal/doc/raw/ljp.book/styles/s2/design.xml
Executable file
10
livejournal/doc/raw/ljp.book/styles/s2/design.xml
Executable file
@@ -0,0 +1,10 @@
|
||||
<section id="ljp.styles.s2.design">
|
||||
<title>Design Overview</title>
|
||||
<remark>STUB</remark>
|
||||
</section>
|
||||
<!--
|
||||
Local Variables:
|
||||
mode:sgml
|
||||
sgml-parent-document: ("index.xml" "chapter" "section")
|
||||
End:
|
||||
-->
|
||||
10
livejournal/doc/raw/ljp.book/styles/s2/history.xml
Executable file
10
livejournal/doc/raw/ljp.book/styles/s2/history.xml
Executable file
@@ -0,0 +1,10 @@
|
||||
<section id="ljp.styles.s2.history">
|
||||
<title>History & Motivations</title>
|
||||
<remark>STUB</remark>
|
||||
</section>
|
||||
<!--
|
||||
Local Variables:
|
||||
mode:sgml
|
||||
sgml-parent-document: ("index.xml" "chapter" "section")
|
||||
End:
|
||||
-->
|
||||
15
livejournal/doc/raw/ljp.book/styles/s2/index.xml
Executable file
15
livejournal/doc/raw/ljp.book/styles/s2/index.xml
Executable file
@@ -0,0 +1,15 @@
|
||||
<chapter id="ljp.styles.s2">
|
||||
<chapterinfo>
|
||||
<title>Style System 2 (<acronym>S2</acronym>)</title>
|
||||
</chapterinfo>
|
||||
<title>Style System 2 (<acronym>S2</acronym>)</title>
|
||||
<remark>Language Reference</remark>
|
||||
&ljp.styles.s2.history;
|
||||
&ljp.styles.s2.design;
|
||||
</chapter>
|
||||
<!--
|
||||
Local Variables:
|
||||
mode:sgml
|
||||
sgml-parent-document: ("../index.xml" "part" "chapter")
|
||||
End:
|
||||
-->
|
||||
Reference in New Issue
Block a user