libreccm-legacy/ccm-sci-bundle/web/themes/foundry/doc/static-texts/devel/coding-style.html

61 lines
2.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Foundry Coding Style</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
</head>
<body>
<h1>Foundry Coding Style</h1>
<main>
<p>
This document describes the coding conventions for the Foundry theming engine.
</p>
<h2>Naming</h2>
<p>
The naming rules described here apply to all names: Names of layout elements,
XSL template names, EXSLT functions, files, ids and classes (in the
<code>class</code> attribute).
</p>
<p>
Use the dash &quot;-&quot; to separate parts of a name instead of camel case or the
underscore. For example: <code>get-setting</code> instead of <code>getSetting</code> or
<code>set_setting</code>.
</p>
<p>
Names should be lowercase.
</p>
<h2>Namespace declarations</h2>
<p>
In the XSL files, XML namespaces are only defined at the
<code>&lt;xsl:stylesheet&gt;</code> element. The XSL namespace is the first one is
declared first. The other namespace follow in alphabetic order (ordered by their
prefix).
</p>
<h2>Indention, line length and formating</h2>
<p>
Indention is done using spaces. Indention depth is four (4) spaces per level.
</p>
<p>
Try to keep the line length below 100 characters per line. Because of some restrictions
of XML this will be possible in every case.
</p>
<p>
Insert a line break after each attribute of an XML element. The first attribute
is on the same line as the element. For example write
</p>
<pre>
&lt;xsl:param name=example-param"
select="'example'"/&gt;
</pre>
<p>
instead of
</p>
<pre>
&lt;xsl:param name=example-param" select="'example'"/&gt;
</pre>
</main>
</body>
</html>