summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2005-04-03 11:49:01 (UTC)
committer Michael Krelin <hacker@klever.net>2005-04-03 11:49:01 (UTC)
commitd3e8a3f68b62668af9bc992e94dfb3c822d270dc (patch) (side-by-side diff)
tree87a5f43f5075dcfc0c0033a4ca50eb990d498e70
parent85471d7c2c74035399ba7047f409fe6248e1d6f0 (diff)
downloadsitecing-d3e8a3f68b62668af9bc992e94dfb3c822d270dc.zip
sitecing-d3e8a3f68b62668af9bc992e94dfb3c822d270dc.tar.gz
sitecing-d3e8a3f68b62668af9bc992e94dfb3c822d270dc.tar.bz2
made use of pragma main
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--htdocs/ancestry/layout.chtml4
-rw-r--r--htdocs/exceptions/compile.chtml3
-rw-r--r--htdocs/exceptions/index.chtml3
-rw-r--r--htdocs/exceptions/preprocess.chtml3
-rw-r--r--htdocs/exceptions/runtime.chtml3
-rw-r--r--htdocs/index.chtml4
-rw-r--r--htdocs/quickref/index.chtml3
-rw-r--r--htdocs/quickref/metasyntax.chtml3
-rw-r--r--htdocs/simple.chtml3
-rw-r--r--htdocs/sources.chtml3
-rw-r--r--htdocs/view.chtml3
11 files changed, 22 insertions, 13 deletions
diff --git a/htdocs/ancestry/layout.chtml b/htdocs/ancestry/layout.chtml
index 4551d04..64d1cd2 100644
--- a/htdocs/ancestry/layout.chtml
+++ b/htdocs/ancestry/layout.chtml
@@ -1,69 +1,69 @@
-% html(); return; /* vim:set ft=sitecing: */
-%%derive page = "/ancestry/page.chtml";
+%%derive page = "/ancestry/page.chtml"; /* vim:set ft=sitecing: */
+%%pragma main=page
<%decl>
#define PN_PREV(h,d,t) urlPrev=h; descPrev=d; titlePrev=t;
#define PN_NEXT(h,d,t) urlNext=h; descNext=d; titleNext=t;
</%decl>
%%impl #include <sitecing/util.h>
%%impl #include "acconfig.h"
%%var bool b_svn = false;
%%var std::string urlPrev;
%%var std::string descPrev;
%%var std::string titlePrev;
%%var std::string urlNext;
%%var std::string descNext;
%%var std::string titleNext;
<%constructor>
if(strstr(PACKAGE_STRING,"svn"))
b_svn = true;
</%constructor>
<%method void prevnext() %>
% if(urlPrev.empty() && urlNext.empty()) return;
% if(descPrev.empty() && descNext.empty()) return;
<div class="prevnext">
% if(!(urlPrev.empty() || descPrev.empty())) {
<a class="prevnext-prev" href="<% urlPrev %>" title="<% sitecing::html_escape(titlePrev.empty()?descPrev:titlePrev) %>">&#9668;&nbsp;&nbsp;<% sitecing::html_escape(descPrev) %></a>
% }
% if(!(urlNext.empty() || descNext.empty())) {
<a class="prevnext-next" href="<% urlNext %>" title="<% sitecing::html_escape(titleNext.empty()?descNext:titleNext) %>"><% sitecing::html_escape(descNext) %>&nbsp;&nbsp;&#9658;</a>
% }
</div>
</%method>
<%method void body() %>
<div id="content">
<%code>
if(!access(WEB_RUN_ROOT "/conf/banner_top",R_OK)) {
pass_file_through(WEB_RUN_ROOT "/conf/banner_top");
}
prevnext();
content();
if(b_strict && !access(WEB_RUN_ROOT "/conf/banner_bottom",R_OK)) {
pass_file_through(WEB_RUN_ROOT "/conf/banner_bottom");
}
</%code>
</div>
<div id="sidepanel">
% sidepanel();
</div>
</%method>
<%method void content() %>
</%method>
<%method void sidepanel() %>
<h1><% PACKAGE_STRING %></h1>
% if(b_svn) {
<h2>The site is running source from the source repository which may differ
from the one available for download. You can check it out from the <a
href="http://kin.klever.net/sitecing/repository">source repository</a>.</h2>
% }
% /* thank MSIE for this awful formatting */
<ul><li><a href="/" title="introduction to site-C-ing">overview</a><ul><li><a href="/simple" title="building a really simple page">simple page</a></li></ul></li><li><a href="/exceptions/" title="exceptions handling">exceptions</a><ul><li><a href="/exceptions/preprocess" title="preprocessor errors">preprocess</a></li><li><a href="/exceptions/compile" title="compiler errors">compile-time</a></li><li><a href="/exceptions/runtime" title="runtime exceptions">runtime</a></li></ul></li><li><a href="/quickref/" title="quick reference">reference</a><ul><li><a href="/quickref/metasyntax" title="meta syntax">syntax</a></li></ul></li><li><a href="/sources" title="browse this site source files">sources</a></li></ul>
<%code>
if(!access(WEB_RUN_ROOT "/conf/banner_side",R_OK)) {
pass_file_through(WEB_RUN_ROOT "/conf/banner_side");
}
</%code>
<ul><li><a href="http://kin.klever.net/sitecing/" title="main site-C-ing page">site-C-ing</a></li><li><a href="http://kin.klever.net/sitecing/sources" title="site-C-ing download page">downloads</a></li></ul>
<div class="copyright">
&copy; <a href="http://www.klever.net/">Klever Group</a>
</div>
</%method>
diff --git a/htdocs/exceptions/compile.chtml b/htdocs/exceptions/compile.chtml
index 68dd034..94bd2e1 100644
--- a/htdocs/exceptions/compile.chtml
+++ b/htdocs/exceptions/compile.chtml
@@ -1,52 +1,53 @@
-% html(); return; /* vim:set ft=sitecing: */
+% /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
+%%pragma main=page
<%constructor>
b_strict = false;
PN_PREV("/exceptions/preprocess","preprocess","preprocessing errors");
PN_NEXT("/exceptions/runtime","runtime","runtime exceptions");
</%constructor>
<%codemethod string title() %>
return "compile-time exceptions handling";
</%codemethod>
<%method void content() %>
<h1>site-C-ing compile-time exception handling</h1>
<p>
Similar to <a href="/exceptions/preprocess">preprocessing exceptions</a>
there is a wide range of errors you may put into your code which will pass
through preprocessor and will be caught later at the compile-time.
</p>
<p>
Once you complete writing your <a
href="/view/htdocs/exceptions/development/compile.chtml" target="insert"
title="the link opens in the frame below">erroneous code</a> and
<em>site-C-ing</em> is done preprocessing it, it will feed the preprocessed
code into c++ compiler which will refuse to compile the code like this. This
is where <a href="/view/htdocs/handlers/exception_dev" target="insert"
title="the link opens in the frame below">the exception handler</a>,
specified in <a href="/view/htdocs/exceptions/development/.scrc"
target="insert" title="the link opens in the frame below">the configuration
file</a>, takes over the process and gives you <a
href="/exceptions/development/compile" target="insert" title="the link opens
in the frame below">the report</a>. Like with any handler, you may wish to
set some <a href="/view/htdocs/handlers/exception_prod" target="insert"
title="the link opens in the frame below">different handler</a> in your <a
href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
link opens in the frame below">production configuration</a>, which just gives
user <a href="/exceptions/production/preprocess" target="insert" title="the
link opens in the frame below">a friendly yet lame excuse</a>.
</p>
<p class="note">
Note, that these output pages are fakes -- I do not want to spawn the
compiler each time you want to see the output and put this unnecessary load
on cpu. These static pages are in fact saved output of the real exception
handlers.
</p>
<div class="insert">
<iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
<p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
support it. That is okay, it still will open links somehow.</p>
</iframe>
</div>
</%method>
diff --git a/htdocs/exceptions/index.chtml b/htdocs/exceptions/index.chtml
index 6bb2a3c..c700e42 100644
--- a/htdocs/exceptions/index.chtml
+++ b/htdocs/exceptions/index.chtml
@@ -1,56 +1,57 @@
-% html(); return; /* vim:set ft=sitecing: */
+% /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
+%%pragma main=page
<%constructor>
PN_PREV("/simple","simple page","building a really simple page");
PN_NEXT("/exceptions/preprocess","preprocess","preprocessing errors");
</%constructor>
<%codemethod string title() %>
return "exceptions handling";
</%codemethod>
<%method void content() %>
<h1>site-C-ing exception handling</h1>
<p>
The purpose of this section is to give an overview of the <em>site-C-ing</em>
exception handling mechanism. Before the web visitor can see the page each
site-C-ing component goes through a few stages, namely, preprocessing,
compiling and execution. Having three stages to go through also means three
stages one can fail to go through and three exciting opportunities to handle
different errors.
</p>
<p>
First each component is preprocessed so that you can feed the valid c++ code
to the compiler. Here is where the preprocessor can choke at your broken
source code. Once preprocessor failes to parse your code it will throw an
exception which <em>site-C-ing</em> will catch and pass to <a
href="/sources/htdocs/handlers/exception_dev" title="development mode
exception handler source">the exception handler component</a>. Want to <a
href="/exceptions/preprocess">read more</a> about preprocessor exception
handling?
</p>
<p>
After the preprocessing stage is over we have a great opportunity to catch
the compile-time errors. After <em>site-C-ing</em> fails to compile the
component it throws another exception and passes it to the same handler which
may show you some information on what's gone wrong with your source code from
the compiler's perspective. If you've gone this far you definitely want to <a
href="/exceptions/compile">read more</a> about the compiler error handling.
</p>
<p class="note">
Note, that it is likely that you will want to disable the steps above for the
production environment to save time on unnecessary checking whether the
component is up to date.
</p>
<p>
Finally, we need to execute the component and present its output to the web
site visitor. This is also where things may go wrong and here is where your
component may throw an exception for the engine to catch and pass to the
handler. Feel free to <a href="/exceptions/runtime">learn more</a> about it
as well.
</p>
<p class="note">
One more thing you will likely want to have differently in production
environment is <a href="/sources/htdocs/handlers/exception_prod"
title="production mode exception handler source">an exception handler</a>
which will not give out that much unnecessary information to the user.
</p>
</%method>
diff --git a/htdocs/exceptions/preprocess.chtml b/htdocs/exceptions/preprocess.chtml
index 88b8741..e42b102 100644
--- a/htdocs/exceptions/preprocess.chtml
+++ b/htdocs/exceptions/preprocess.chtml
@@ -1,48 +1,49 @@
-% html(); return; /* vim:set ft=sitecing: */
+% /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
+%%pragma main=page
<%constructor>
b_strict = false;
PN_PREV("/exceptions","exceptions","exception handling overview");
PN_NEXT("/exceptions/compile","compile-time","compile-time errors");
</%constructor>
<%codemethod string title() %>
return "preprocessor exceptions handling";
</%codemethod>
<%method void content() %>
<h1>site-C-ing preprocessor exception handling</h1>
<p>
It was one of those days when you just can't type right and can't think of
what you're typing. It is not unusual that, under such circumstances, you end
up with a code like <a
href="/view/htdocs/exceptions/development/preprocess.chtml" target="insert"
title="the link opens in the frame below">this</a> -- by the time you were
about to close your <code>&lt;%code&gt;</code> block you were thinking about
some constructor in some component elsewhere in the universe.
</p>
<p>
<em>site-C-ing</em> parser will see the inconsistency and throw an exception
which will be caught and passed to <a
href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
opens in the frame below">the handler</a>, specified in <a
href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
link opens in the frame below">the configuration file</a>, which will produce
some nice, human-readable <a href="/exceptions/development/preprocess"
target="insert" title="the link opens in the frame below">output</a>. Well,
you may not wish to give out all this information in the production
environment, so you just put in your <a
href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
link opens in the frame below">configuration file</a> some <a
href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
opens in the frame below">different handler</a>, which just gives user <a
href="/exceptions/production/preprocess" target="insert" title="the link
opens in the frame below">a friendly yet lame excuse</a>.
</p>
<div class="insert">
<iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
<p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
support it. That is okay, it still will open links somehow.</p>
</iframe>
</div>
</%method>
diff --git a/htdocs/exceptions/runtime.chtml b/htdocs/exceptions/runtime.chtml
index 1fcd80f..989e89f 100644
--- a/htdocs/exceptions/runtime.chtml
+++ b/htdocs/exceptions/runtime.chtml
@@ -1,49 +1,50 @@
-% html(); return; /* vim:set ft=sitecing: */
+% /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
+%%pragma main=page
<%constructor>
b_strict = false;
PN_PREV("/exceptions/compile","compile-time","compile-time errors");
PN_NEXT("/quickref/","quick reference","quick reference");
</%constructor>
<%codemethod string title() %>
return "runtime exceptions handling";
</%codemethod>
<%method void content() %>
<h1>site-C-ing runtime exception handling</h1>
<p>
The component may throw an exception while executing and the
<em>site-C-ing</em> will gladly pass it to the handler component which will
give the user appropriate output (unless it throws an exception itself, of
course). Here you will see an example output provided by the handler bundled
with the <em>site-C-ing</em>.
</p>
<p>
Suppose you have <a href="/view/htdocs/exceptions/development/runtime.chtml"
target="insert" title="the link opens in the frame below">a component</a>,
which at some point throws an exception. Of course, <em>site-C-ing</em> will
catch the exception and pass it to <a
href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
opens in the frame below">the handler</a>, specified in <a
href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
link opens in the frame below">the configuration file</a>, which will produce
some nice, human-readable <a href="/exceptions/development/runtime"
target="insert" title="the link opens in the frame below">output</a>. Well,
you may not wish to give out all this information in the production
environment, so you just put in your <a
href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
link opens in the frame below">configuration file</a> some <a
href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
opens in the frame below">different handler</a>, which just gives user <a
href="/exceptions/production/runtime" target="insert" title="the link opens
in the frame below">a friendly yet lame excuse</a>.
</p>
<div class="insert">
<iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
<p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
support it. That is okay, it still will open links somehow.</p>
</iframe>
</div>
</%method>
diff --git a/htdocs/index.chtml b/htdocs/index.chtml
index 20d34c2..76d6d7e 100644
--- a/htdocs/index.chtml
+++ b/htdocs/index.chtml
@@ -1,51 +1,51 @@
-% html(); return; /* vim:set ft=sitecing: */
-%%derive layout = "/ancestry/layout.chtml";
+%%derive layout = "/ancestry/layout.chtml"; /* vim:set ft=sitecing: */
+%%pragma main=page
<%constructor>
PN_NEXT("/simple","simple page","building a really simple page");
</%constructor>
<%codemethod string title() %>
return "introduction";
</%codemethod>
<%method void content() %>
<h1>introduction to site-C-ing</h1>
<p>
This is a sample site, which is supposed to demonstrate <em>site-C-ing</em>
features. Since the <em>site-C-ing</em> is still at the early stages of
development or rather proof of concept, this site is also far from being
complete. I am planning to add more pages as the time permits, though.
</p>
<p>
Once you download and install <a
href="http://kin.klever.net/sitecing/">site-C-ing</a> you may wish to try
this sample site for yourself. The source is available from <a
href="http://kin.klever.net/sitecing/sources">the site-C-ing download
page</a>. After you download the source code, you should configure it using
the ever so popular <code>configure</code> script. It is likely that you will
want to pass the <code>--with-vhostname</code> option to configure to name
the apache virtual host.
</p>
<p>
The configure script will generate the apache vhost configuration for you,
which you can <code>Include</code> in the main apache configuration file.
</p>
<p class="note">
Note, that the configuration is tailored for apache 2.x. It is no problem to
get it working with apache 1.3.x, although I haven't tried and so I am not
sure if it will run out of the box (your patches are <a
href="mailto:sitecing-patches@klever.net">welcome</a>). Also note that you
may need <a href="http://fastcgi.com/">mod_fastcgi</a> apache module,
although now that fastcgi is not the only supported interface you may get the
thing running with 'plain' CGI with a bit of tweaking. Again, if you got it
working without breaking the fastcgi part your patches are <a
href="mailto:sitecing-patches@klever.net">welcome</a>.
</p>
<p>
Once you get it all done you will want to restart your apache and start the
<em>site-C-ing</em> fastcgi server by issuing the <code>make restart</code>
command.
</p>
<p>
Before you download it, you may wish to <a href="/sources" title="source
browser">examine the sources</a> to learn more about how it is done.
</p>
</%method>
diff --git a/htdocs/quickref/index.chtml b/htdocs/quickref/index.chtml
index d139190..5119723 100644
--- a/htdocs/quickref/index.chtml
+++ b/htdocs/quickref/index.chtml
@@ -1,17 +1,18 @@
-% html(); return; /* vim:set ft=sitecing: */
+% /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
+%%pragma main=page
<%constructor>
PN_PREV("/exceptions/runtime","runtime","runtime exceptions");
PN_NEXT("/quickref/metasyntax","syntax","meta syntax");
</%constructor>
<%codemethod string title() %>
return "quick reference";
</%codemethod>
<%method void content() %>
<h1>site-C-ing quick reference</h1>
<p>
I am hoping to put together some quick reference documentation here. For now,
I am adding the <a href="/quickref/metasyntax">component meta-syntax quick
reference</a>.
</p>
</%method>
diff --git a/htdocs/quickref/metasyntax.chtml b/htdocs/quickref/metasyntax.chtml
index 4efc37c..67186f9 100644
--- a/htdocs/quickref/metasyntax.chtml
+++ b/htdocs/quickref/metasyntax.chtml
@@ -1,258 +1,259 @@
-% html(); return; /* vim:set ft=sitecing: */
+% /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
+%%pragma main=page
<%constructor>
PN_PREV("/quickref/","quick reference","quick reference");
PN_NEXT("/sources","sources","source browser");
</%constructor>
<%codemethod string title() %>
return "meta syntax quick reference";
</%codemethod>
<%method void content() %>
<h1>site-C-ing meta syntax quick reference</h1>
<h2>Table of Contents</h2>
<ul class="quickref toc">
<li><a href="#qr__line">% ...</a></li>
<li><a href="#qr__inline">&lt;% ... %&gt;</a></li>
<li><a href="#qr__code">&lt;%code&gt;</a></li>
<li><a href="#qr__codemethod">&lt;%codemethod ... &gt;</a></li>
<li><a href="#qr__constructor">&lt;%constructor&gt;</a></li>
<li><a href="#qr__decl">&lt;%decl&gt;</a></li>
<li><a href="#qr___decl">%%decl</a></li>
<li><a href="#qr___derive">%%derive</a></li>
<li><a href="#qr__destructor">&lt;%destructor&gt;</a></li>
<li><a href="#qr__impl">&lt;%impl&gt;</a></li>
<li><a href="#qr___impl">%%impl</a></li>
<li><a href="#qr__method">&lt;%method ... &gt;</a></li>
<li><a href="#qr__output">&lt;%output&gt;</a></li>
<li><a href="#qr___pragma">%%pragma</a></li>
<li><a href="#qr___var">%%var</a></li>
</ul>
<dl class="metasyntax quickref">
% /* % */
<dt>
<a id="qr__line" name="qr__line" title="line of code">
<code>% <kbd>line of code</kbd></code>
</a>
</dt>
<dd>
<p>
Break out into the code mode for just one line.
</p>
<blockquote class="qr_sample">
<div>
&nbsp;&lt;body&gt;<br/>
&nbsp;&nbsp;Here is the way we count.&lt;br/&gt;<br/>
<em><a href="#qr__line" title="% description">%</a> for(int t=0;t&lt;10;t++) {<br/></em>
&nbsp;&nbsp;&nbsp;Just saying out loud: <a href="#qr__inline" title="&lt;% ... %&gt; description">&lt;%</a> t <a href="#qr__inline" title="&lt;% ... %&gt; description">%&gt;</a>&lt;br/&gt;<br/>
<em><a href="#qr__line" title="% description">%</a> }<br/></em>
&nbsp;&lt;/body&gt;
</div>
</blockquote>
</dd>
% /* <% %> */
<dt>
<a id="qr__inline" name="qr__inline" title="output expression">
<code>&lt;% <kbd>expression</kbd> %&gt;</code>
</a>
</dt>
<dd>
<p>
&lt;&lt; <kbd>expression</kbd> into output stream (think c++).
</p>
<blockquote class="qr_sample">
<div>
&nbsp;&nbsp;Here is the way we count.&lt;br/&gt;<br/>
<a href="#qr__line" title="% description">%</a> for(int t=0;t&lt;10;t++) {<br/>
<em>&nbsp;&nbsp;&nbsp;Just saying out loud: <a href="#qr__inline" title="&lt;% ... %&gt; description">&lt;%</a> t <a href="#qr__inline" title="&lt;% ... %&gt; description">%&gt;</a>&lt;br/&gt;<br/></em>
<a href="#qr__line" title="% description">%</a> }
</div>
</blockquote>
</dd>
% /* %code */
<dt>
<a id="qr__code" name="qr__code" title="switching to code mode">
<code>
&lt;%code&gt; <kbd>...</kbd> &lt;/%code&gt;
</code>
</a>
</dt>
<dd>
<p>
Escape from the output mode to code mode. Opposite to <code><a href="#qr__output" title="&lt;%output&gt; description">&lt;%output&gt;</a></code>. Roughly the same as <code><a href="#qr__output" title="&lt;%output&gt; description">&lt;/%output&gt;</a> <kbd>...</kbd> <a href="#qr__output" title="&lt;%output&gt; description">&lt;%output&gt;</a></code> (note the reverse order), but more self-explanatory and applies to more cases.
</p>
<blockquote class="qr_sample">
<div>
&lt;body&gt;<br/>
<em>&nbsp;<a href="#qr__code" title="&lt;%code&gt; descrption">&lt;%code&gt;</a><br/></em>
&nbsp;&nbsp;for(int t=0;t&lt;10;t++) {<br/>
&nbsp;&nbsp;&nbsp;<a href="#qr__output" title="&lt;%output&gt; descrption">&lt;%output&gt;</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;Here is the way we count.&lt;br/&gt;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;Just saying out loud: <a href="#qr__inline" title="&lt;% ... %&gt; description">&lt;%</a> t <a href="#qr__inline" title="&lt;% ... %&gt; description">%&gt;</a>&lt;br/&gt;<br/>
&nbsp;&nbsp;&nbsp;<a href="#qr__output" title="&lt;%output&gt; descrption">&lt;/%output&gt;</a><br/>
<em>&nbsp;<a href="#qr__code" title="&lt;%code&gt; descrption">&lt;/%code&gt;</a><br/></em>
&lt;/body&gt;
</div>
</blockquote>
</dd>
% /* %codemethod */
<dt>
<a id="qr__codemethod" name="qr__codemethod" title="member function definition">
<code>
&lt;%codemethod <kbd>return_type_t</kbd> <kbd>member_name</kbd>(<kbd>args,...</kbd>) %&gt;<br/>
&nbsp;<kbd>code</kbd><br/>
&lt;/%codemethod&gt;
</code>
</a>
</dt>
<dd>
<p>
Define the member function. Essentially equivalent to <code><a href="#qr__method" title="&lt;%method ... %&gt; description" class="internal">&lt;%method</a> <kbd>...</kbd> <a href="#qr__method" title="&lt;%method ... %&gt; description" class="internal">%&gt;</a><a href="#qr__code" title="&lt;%code&gt; description" class="internal">&lt;%code&gt;</a> <kbd>...</kbd> <a href="#qr__code" title="&lt;%code&gt; description" class="internal">&lt;/%code&gt;</a><a href="#qr__method" title="&lt;%method ... %&gt; description" class="internal">&lt;/%method&gt;</a></code>.
</p>
<blockquote class="qr_sample">
<div>
<em><a href="#qr__codemethod" title="&lt;%codemethod ... %&gt; description">&lt;%codemethod</a> std::string ua() <a href="#qr__codemethod" title="&lt;%codemethod ... %&gt; description">%&gt;</a><br/>
&nbsp;return __CGI-&gt;get_meta("USER_AGENT");<br/>
<a href="#qr__codemethod" title="&lt;%codemethod ... %&gt; description">&lt;/%codemethod&gt;</a><br/></em>
The user agent is: <a href="#qr__inline" title="&lt;% ... %&gt; description">&lt;%</a> ua() <a href="#qr__inline" title="&lt;% ... %&gt; description">%&gt;</a><br/>
</div>
</blockquote>
</dd>
% /* %constructor */
<dt>
<a id="qr__constructor" name="qr__constructor" title="constructor code">
<code>
&lt;%constructor&gt;<br/>
&nbsp;<kbd>code</kbd><br/>
&lt;/%constructor&gt;
</code>
</a>
</dt>
<dd>
<p>
Provide the code for constructor.
</p>
<blockquote class="qr_sample">
<div>
<a href="#qr___var" title="%%var description">%%var</a> bool is_msie;<br/>
<em><a href="#qr__constructor" title="&lt;%constructor&gt; description">&lt;%constructor&gt;</a><br/>
&nbsp;is_msie = (__CGI-&gt;get_meta("USER_AGENT").find("MSIE")!=string::npos);<br/>
<a href="#qr__constructor" title="&lt;%constructor&gt; description">&lt;/%constructor&gt;</a><br/></em>
</div>
</blockquote>
</dd>
% /* %decl / %%decl */
<dt>
<a id="qr___decl" name="qr___decl" title="verbatim declaration">
<code>%%decl <kbd>line of code</kbd></code>
</a>
</dt>
<dt>
<a id="qr__decl" name="qr__decl" title="verbatim declaration">
<code>
&lt;%decl&gt;<br/>
&nbsp;<kbd>lines of code</kbd><br/>
&lt;/%decl&gt;
</code>
</a>
</dt>
<dd>
<p>
Put the line(s) of code into the resulting <em>.h</em> file before the
class declaration.
</p>
<blockquote class="qr_sample">
<div>
<em><a href="#qr___decl" title="%%decl description">%%decl</a> #include &lt;string&gt;<br/></em>
<a href="#qr___var" title="%%var description">%%var</a> std::string str = "default"<br/>
<em><a href="#qr__decl" title="&lt;%decl&gt; description">&lt;%decl&gt;</a><br/>
&nbsp;typedef int integer_t;<br/>
<a href="#qr__decl" title="&lt;%decl&gt; description">&lt;/%decl&gt;</a><br/></em>
<a href="#qr__method" title="&lt;%method ... %&gt; description">&lt;%method</a> void do_nothing(integer_t input) <a href="#qr__method" title="&lt;%method ... %&gt; description">%&gt;</a><br/>
&nbsp;nothing is done<br/>
<a href="#qr__method" title="&lt;%method ... %&gt; description">&lt;/%method&gt;</a>
</div>
</blockquote>
</dd>
% /* %%derive */
<dt>
<a id="qr___derive" name="qr___derive" title="base class(es) specification">
<code>%%derive <kbd>name</kbd> = "<kbd>base-component</kbd>";</code>
</a>
</dt>
<dd>
<p>
Inherit what is there to be inherited from the base component specified.
</p>
<blockquote class="qr_sample">
<div>
<em><a href="#qr___derive" title="%%derive description">%%derive</a> pagelayout = "/ancestry/page_layout.chtml";<br/></em>
<a href="#qr__line" title="% description">%</a> pagelayout::member_function();
</div>
</blockquote>
</dd>
% /* %destructor */
<dt>
<a id="qr__destructor" name="qr__destructor" title="destructor code">
<code>
&lt;%destructor&gt;<br/>
&nbsp;<kbd>code</kbd><br/>
&lt;/%destructor&gt;
</code>
</a>
</dt>
<dd>
<p>
Provide the code for destructor.
</p>
<blockquote class="qr_sample">
<div>
<a href="#qr___var" title="%%var description">%%var</a> type_t *tmp = 0;<br/>
<a href="#qr__constructor" title="&lt;%constructor&gt; description">&lt;%constructor&gt;</a><br/>
&nbsp;tmp = new type_t(type_t::option_1);<br/>
<a href="#qr__constructor" title="&lt;%constructor&gt; description">&lt;/%constructor&gt;</a><br/>
<em><a href="#qr__destructor" title="&lt;%destructor&gt; description">&lt;%destructor&gt;</a><br/>
&nbsp;delete tmp;<br/>
<a href="#qr__destructor" title="&lt;%destructor&gt; description">&lt;/%destructor&gt;</a><br/></em>
</div>
</blockquote>
</dd>
% /* %impl / %%impl */
<dt>
<a id="qr___impl" name="qr__impl" title="verbatim definition">
<code>%%impl <kbd>line of code</kbd></code>
</a>
</dt>
<dt>
<a id="qr__impl" name="qr__impl" title="verbatim definition">
<code>
&lt;%impl&gt;<br/>
&nbsp;<kbd>lines of code</kbd><br/>
&lt;/%impl&gt;
</code>
</a>
</dt>
<dd>
<p>
Put the line(s) of code into the resulting <em>.cc</em> implementation file
before any members definitions.
</p>
<blockquote class="qr_sample">
<div>
<em><a href="#qr___impl" title="%%impl description">%%impl</a> #include &lt;string.h&gt;<br/></em>
<a href="#qr__method" title="&lt;%method ... %gt; description">&lt;%method</a> void output_if_contains(const char *haystack,const char *needle) <a href="#qr__method" title="&lt;%method ... %gt; description">%&gt;</a><br/>
<a href="#qr__line" title="% description">%</a> if(strstr(haystack,needle)) {<br/>
&nbsp;&nbsp;&nbsp;<a href="#qr__inline" title="&lt;% ... %&gt; description">&lt;%</a> haystack <a href="#qr__inline" title="&lt;% ... %&gt; description">%&gt;</a><br/>
<a href="#qr__line" title="% description">%</a> }<br/>
<a href="#qr__method" title="&lt;%method ... %&gt; description">&lt;/%method&gt;</a><br/>
diff --git a/htdocs/simple.chtml b/htdocs/simple.chtml
index 845b840..d538b01 100644
--- a/htdocs/simple.chtml
+++ b/htdocs/simple.chtml
@@ -1,33 +1,34 @@
-% html(); return; /* vim:set ft=sitecing: */
+% /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
+%%pragma main=page
<%constructor>
b_strict = false;
PN_PREV("/","overview","introduction to site-C-ing");
PN_NEXT("/exceptions","exceptions","exception handling overview");
</%constructor>
<%codemethod string title() %>
return "simple page";
</%codemethod>
<%method void content() %>
<h1>building a really simple page</h1>
<p>
Building a really simple page is really simple. I will not go into much detail
here. The example provided should speak for itself.
</p>
<p>
The component being written doesn't do much but show you the calendar for the
current month. First, take a look at <a
href="/view/htdocs/examples/calendar.chtml" title="the link opens in the frame
below" target="insert">the code</a> and, after you examined it, feel free to check out
<a href="/examples/calendar" title="the link opens in the frame below"
target="insert">the output</a>.
</p>
<div class="insert">
<iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
<p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
support it. That is okay, it still will open links somehow.</p>
</iframe>
</div>
</%method>
diff --git a/htdocs/sources.chtml b/htdocs/sources.chtml
index 8c0c701..268b0e0 100644
--- a/htdocs/sources.chtml
+++ b/htdocs/sources.chtml
@@ -1,48 +1,49 @@
-% html(); return; /* vim:set ft=sitecing: */
+% /* vim:set ft=sitecing: */
%%derive layout = "/ancestry/layout.chtml";
%%derive sources = "/ancestry/sources.chtml";
+%%pragma main=page
<%impl>
#include <sitecing/sitecing_util.h>
</%impl>
<%constructor>
b_strict = false;
PN_PREV("/quickref/metasyntax","syntax","meta syntax");
</%constructor>
<%codemethod string title() %>
return "runtime exceptions handling";
</%codemethod>
<%method void content() %>
<h1>browse this site sources</h1>
<ul class="sourcebrowser">
% for(int n=0;n<source_files_count;n++) {
% sourcefile_t& sf = source_files[n];
% if(!sf.name) { /* the beginning or the end of the directory */
% if(sf.dir) { /* the beginning */
<li class="dir"><% sf.dir %>/<ul class="dir">
% }else{ /* the end */
</ul></li>
% }
% }else{
<li class="file"><a href="/view/<% sf.dir %>/<% sf.name %>" title="<% sf.desc %>" target="insert"><% sf.name %></a></li>
% }
% }
</ul>
<%code>
string rfile = sitecing::normalize_path(
sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/sources.chtml"),
sitecing::restrict_dotdot|sitecing::strip_leading_slash );
if(rfile.empty())
rfile = "about:blank";
else
rfile = "/view/"+rfile;
</%code>
<div class="insert">
<iframe id="insert" name="insert" src="<% rfile %>" width="95%" height="300">
<p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
support it. That is okay, it still will open links somehow.</p>
</iframe>
</div>
</%method>
diff --git a/htdocs/view.chtml b/htdocs/view.chtml
index d885330..f729465 100644
--- a/htdocs/view.chtml
+++ b/htdocs/view.chtml
@@ -1,54 +1,55 @@
-% html(); return; /* vim:set ft=sitecing: */
+% /* vim:set ft=sitecing: */
%%derive page = "/ancestry/page.chtml";
%%derive sources = "/ancestry/sources.chtml";
+%%pragma main=page
<%impl>
#include <iostream>
#include <fstream>
using namespace std;
#include <sitecing/util.h>
#include <sitecing/sitecing_util.h>
#include <konforka/exception.h>
#include "acconfig.h"
</%impl>
<%codemethod string title() %>
return "introduction";
</%codemethod>
<%method void body() %>
<%code>
string rfile = sitecing::normalize_path(
sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"),
sitecing::restrict_dotdot|sitecing::strip_leading_slash );
sourcefile_t *sof = 0;
for(int n=0;n<source_files_count;n++) {
sof = &source_files[n];
if(sof->name && sof->dir) {
if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile)
break;
}
sof = 0;
}
if(!sof)
throw konforka::exception(CODEPOINT,"no access to the file allowed");
string afile = sitecing::combine_path(WEB_ROOT,rfile,0);
</%code>
<div class="source">
<h1><% rfile %></h1>
<ul>
<%code>
ifstream sf(afile.c_str());
if(!sf.good())
throw konforka::exception(CODEPOINT,"could not open source file");
while(!sf.eof()) {
string sfl;
getline(sf,sfl);
for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) {
sfl.replace(t,1,8-(t%8),' ');
}
<%output>
<li><% sfl.empty()?"&nbsp;":sitecing::html_escape(sfl,sitecing::html_escape_nbsp) %></li>
</%output>
}
</%code>
</ul>
</div>
</%method>