[zeromq-dev] 0MQ User Guide
Oliver Smith
oliver at kfs.org
Fri Aug 13 09:51:25 CEST 2010
On 8/12/2010 4:29 PM, Pieter Hintjens wrote:
> But I like the idea of
> showing the examples in as many languages as possible.
While it pains me to give kudos to Microsoft, I find that MSDN's "Language Selector" is one of the main reasons I often pull up MSDN ahead of typing "man<x>".
> Mostly I want to use C for real examples, because it's the reference.
> I'll translate the Python into C for the first examples, then.
>
> How about the following, then:
>
> * For every example (not the smaller fragments) I'll create a page
> * The text will link to that page
> * That page will hold space for translation of the example into each language
> * People can then translate the examples as they please
>
> This would become a really useful resource.
>
> Does this approach sound practical?
I honestly think it would be worth doing with CSS - as suggested - to hide/show various sections.
You'd do something like
<table class='code-examples'>
<tr>
<td class='code-example-cpp'>
...
</td>
<td class='code-example-lua'>
...
</td>
</table>
I'm guessing you are using Apache ... I'm an old-school Roxen user. For me it would be as simple as:
<table class='code-examples'>
<tr>
<emit source='dir' path='./examples/' glob='example4.*'>
<td class='code-example-&_.type;'><insert file='&_.path;'/></td>
</emit>
</tr>
</table>
Or...
<define tag='source-example'> <comment> Takes one argument: name='<prefix>'</comment>
<table class='code-examples'>
<tr>
<emit source='dir' path='./examples/' glob='&_.name;.*'>
<td class='code-example-&_.type;'><insert file='&_.path;'/></td>
</emit>
<if exists='./examples/&_.name;.default'>
<td class='code-example-default'><insert file='&_.default;'/></td>
</if>
</tr>
</table>
</define>
....
<source-example name="example1"/>
...
<source-example name="example4"/>
I'm not sure what the equivalent would be for Apache/JSP Tags.
You'd just need something to display a list of languages with something that sets the 'hidden' property for code-example-cpp, for example, to 'true' or 'false'. And voila, you have a document customized to the user's preferences.
[OT/FYI]
Roxen (http://www.roxen.cdom/) is a free/opensource WebServer (http://download.roxen.com/, originally called 'Spinner') which pre-dates Apache and had features like a web-based configuration interface and XML-based scripting language ("RXML") since day 1 (circa 1995).
They also provide a commercial CMS that competes with Vignette (I saved Granada Media ~EUR300,000 by introducing them to Roxen).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100813/d1aa269e/attachment.htm>
More information about the zeromq-dev
mailing list