Search code examples
twitter-bootstrapopa

Opa bootstrap samples


I'm trying to make Twitter's Bootstrap API (http://bootstrap.opalang.org/) work in Opa by trying some features, and there is one that refuse to work : the WB.grid system. More precisely, the parser report a syntax error when I try to do that :

    grid_basic = (WBootstrap.Grid.row([
        {span=8 offset=none content=<>foo</>},
        {span=8 offset=none content=<>bar</>}
        ]))

(that is, a simple row with two cells)

Here's the error string :

            grid_basic = (WBootstrap.Grid.row([
                    {-->span=8 offset=none content=<>foo</>},
                    {span=8 offset=none content=<>bar</>}
                    ]))

            Hint: File "test1.opa", line 9, characters 4-10, (9:4-9:10 | 158-164),
            found a binding as condition. Did you mean `==' rather than `=' ?

After a while I just copy pasted the whole code of a sample page (http://bootstrap.opalang.org/html/src/container_app.opa.html), and it failed on the "grid" line too. I tried both the new and old parser. Is there something I'm doing wrong ?


Solution

  • http://bootstrap.opalang.org is written with and for the old syntax.

    Moreover, it uses Bootstrap 1.4.0 widgets, wich are outdated (stdlib.widgets.deprecated.bootstrap).

    So you can use opa --parser classic, or transform the code into js-like syntax : {name1:value1, name2:value2, ...etc...} (see manual)