Hard to figure out, but looks like a BUG?

3 views
Skip to first unread message

Igor

unread,
Jun 21, 2011, 4:45:06 PM6/21/11
to shpaml
First of all i want to say shpaml is a nice piece of code :)

The name shpaml one the beginning was hard to write or spell but now
its fun to shpaml, shpaml, shpaml ... no more typos :)

I was looking for template to use with shpaml but couldn't find any
simple as shpaml so i did one in 2010.12 (shpamlto.py) i will put it
online in about 2 months. Today i did a small clean up of shpamlto.py
and found one interesting thing about shpaml.py

This is my shpaml template `cat template.shpaml`.

.section
h5 | Engine Table
.data
table border="1"
tr
th | Engine name
th | Serial no.
th | Speed
th | Power
th | Weight
tr
td | $Name
td | $Serial
td | $Speed
td | $Power
td | $Weight
h5 | Info about engine $Name with Serial no. $Serial.
.list_exampl
ol
li | $List1
ol
li | $List2
h5 | Silniki: $Silniki
h5 | Lista zaworów:
ol
li | $Zawory

and after `cat template.shpaml | python shpaml.py` i got this:

<div class="section">
<h5>Engine Table</h5>
<div class="data">
<table border="1">
<tr>
<th>Engine name</th>
<th>Serial no.</th>
<th>Speed</th>
<th>Power</th>
<th>Weight</th>
</tr>
<tr>
<td>$Name</td>
<td>$Serial</td>
<td>$Speed</td>
<td>$Power</td>
<td>$Weight</td>
</tr>
</table>
</div>
<h5 | Info about engine $Name with Serial no. $Serial.>
<-- here ?
<div class="list_exampl">
<ol>
<li>$List1</li>
</ol>
<ol>
<li>$List2</li>
</ol>
</div>
</h5>

<h5>Silniki: $Silniki</h5>
<h5 | Lista zaworów:> <-- here ?
<ol>
<li>$Zawory</li>
</ol>
</h5>
</div>

Could someone explain what im doing wrong or admit it's a bug?
Hey.

Steve Howell

unread,
Jun 21, 2011, 7:20:01 PM6/21/11
to shp...@googlegroups.com
----- Original Message ----

> From: Igor <igoru...@gmail.com>
> First of all i want to say shpaml is a nice piece of code :)
>
> The name shpaml one the beginning was hard to write or spell but now
> its fun to shpaml, shpaml, shpaml ... no more typos :)

Thanks!

This...

> h5 | Info about engine $Name with Serial no. $Serial.
> .list_exampl
> ol
> li | $List1
> ol
> li | $List2
>

...converts to...



> <h5 | Info about engine $Name with Serial no. $Serial.>
> <-- here ?
> <div class="list_exampl">
> <ol>
> <li>$List1</li>
> </ol>
> <ol>
> <li>$List2</li>
> </ol>
> </div>
> </h5>

> Could someone explain what im doing wrong or admit it's a bug?

Just dedent .list_exampl

Indentation takes precedence over the pipe. If there is an indented block, it
assume the h5 tag is to enclose everything.

Igor

unread,
Jun 22, 2011, 6:21:05 PM6/22/11
to shp...@googlegroups.com


Just dedent .list_exampl


Can't dedent it. Will have to figure something out, like force just one line. With this specific layout,  because for me it's important to have one block:


>        h5 | Info about engine $Name  with Serial no. $Serial. \
>         .list_exampl                                                                    \
>              ol                                                                                 \ ___ 1 block
>                  li | $List1                                                                 /
>              ol                                                                               /
>                 li |  $List2                                                              /

and when dedent i will get two blocks:

>        h5 | Info about engine $Name  with Serial no. $Serial. >---- 1 block
>        .list_exampl                                                                   \
>              ol                                                                               \___ 2 block
>                  li | $List1                                                                /
>              ol                                                                               /
>                 li |  $List2                                                              /
 
Indentation takes precedence over the pipe.  If there is an indented block, it
assume the h5 tag is to enclose everything.

Ah right, thanks for clearing it out. I think i will handle it somehow :)
Reply all
Reply to author
Forward
0 new messages