TinyButStrong - the PHP Template Engine
Categories > OpenTBS general >

Nested subs in LibreOffice text

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: fred
Date: 2017-02-23
Time: 10:46

Nested subs in LibreOffice text

Hello,
I'm trying to make nested in subs in LibreOffice text, in order to use different levels of titles.
1 DomA
1.1 Project A
   - AE1
   - AE2
1.2 Project B
   - AE3
   - AE4
2 DomB
2.1 Project C
... and so on

Here's my template
[myBlock;block=begin;sub1=(projet)]
1 [myBlock.domaine;strconv=no;enlarge=text:p]
[myBlock_sub1;block=begin;sub1=(ae)]
1.1 [myBlock_sub1.nom]
- [myBlock_sub1_sub1.nom]
[myBlock_sub1_sub1.desc]
[myBlock_sub1_sub1.ae;block=end;]
[myBlock_sub1.projet;block=end;]
[myBlock;block=end;]

and here's my data:
global $data;
$data = array(
    array('domaine'=>'Dom A', 'projet'=>[
                           0=>array( 'nom'=>'Project I', 'ae'=>[
                        0=>array( 'nom'=>'AE 1','desc'=>'titi'),
                        1=>array( 'nom'=>'AE 2.3','desc'=>'tur lu tutu')
                  ])           
                 ,1=>array( 'nom'=>'Project II', 'ae'=>[
                        0=>array( 'nom'=>'AE  4.5','desc'=>'titi'),
                        1=>array( 'nom'=>'AE  4.9','desc'=>'tur lu tutu')
                  ])
         ]),
        array('domaine'=>'Dom B',  'projet'=>[
                       0=>array( 'nom'=>'Project III', 'ae'=>[
                        0=>array( 'nom'=>'AE tric','desc'=>'titi'),
                        1=>array( 'nom'=>'AE troc','desc'=>'tur lu tutu')
                ])
       ]),
);
I use MergeBlock
$TBS->MergeBlock('myBlock', $data);
And the error message:
TinyButStrong Error in block's definition [myBlock_sub1_sub1.ae...]: at least one tag corresponding to end is not found. Check opening tags, closing tags and embedding levels.

Without the sub1_sub1 level the template works fine.

I don't understand how to define the second level.
Please help.
By: Skrol29
Date: 2017-02-23
Time: 13:01

Re: Nested subs in LibreOffice text

Hi,

In your snippet, there is no "block=begin" for block "myBlock_sub1_sub1".

Bythe way, for LibreOffice and Ms Office, it is better to use the relative syntax for fields (block=tbs:p) instead of the absolute syntax (block=begin, block=end).
By: fred
Date: 2017-02-23
Time: 22:02

Re: Nested subs in LibreOffice text

Hello,

Thanks for the help. It works!
I'll consider the relative syntax (block=tbs:p). Tomorow I'll try something like this:
1 [myBlock.domaine;strconv=no;enlarge=text:p;block=tbs:p;sub1=(projet)]
1.1 [myBlock_sub1.nom;block=tbs:p;sub1=(ae)]
- [myBlock_sub1_sub1.nom]
[myBlock_sub1_sub1.desc]