<!DOCTYPE html>
<html>
    <head>
        <title id="titre"></title>
        <meta charset="UTF-8"/>
        <script src="https://code.jquery.com/jquery-latest.min.js"></script>
        <script src="../../dist/jsRealB.js"></script>
<!-- to ease debugging we load each file separately -/->
        <script src="../../data/lexicon-fr.js"></script>
        <script src="../../data/rule-fr.js"></script>
        <script src="../../data/lexicon-en.js"></script>
        <script src="../../data/rule-en.js"></script>
        <script src="../../build/Utils.js"></script>
        <script src="../../build/Constituent.js"></script>
        <script src="../../build/Phrase.js"></script>
        <script src="../../build/Terminal.js"></script>
        <script src="../../build/Date.js"></script>
        <script src="../../build/Number.js"></script>
        <script src="../../build/Warnings.js"></script>
<!-/- end of separate loading -->

        <script>
        var max=4;

        function kmsAPied(n){
            return NP(NO(n).dOpt({nat:true}),N('kilomètre'),
                      PP(P("à"),NP(N("pied"))));
        }

        function ligne(l){
            return $("<div/>").css("text-align","center").text(l.toString());
        }

        function refrain(){
            var s1=S(NP(D("le"),N("peinture"),
                        PP(P("à"),D("le"),N("huile"))).a(","), 
                     S(Pro("ce"), VP(V("être").t("p"),Adv("bien"),A("difficile"))));
            var s2=S('mais',
                     Pro("ce"),
                     VP(V("être").t("p"),
                        AP("bien plus",A("beau"),
                        SP(Pro("que"), 
                           NP(D("le"),N("peinture"), 
                           PP(P("à"),D("le"),N("eau")) ) ) )
                       )
                   );
            return $("<p/>").append(ligne(s1)).append(ligne(s2));
        }

        function generer() {
            loadFr();
            var $body=$("body");
            var m1=S(kmsAPied(1));
            $("#titre").text(m1);
            var h1=$("<h1/>").css("text-align","center").text(m1)
            $body.append(h1);
            var use=V("user").t("p");
            var s1=S(Pro("ça"),use);
            var s2=S(s1,NP(D("le"),N("soulier").n("p")));
            for(var i=1;i<=max;i++){
                var kmap=kmsAPied(i).a(",");
                var $lignes=$("<b/>").append("<p/>");
                $lignes.append(ligne(S(kmap,s1,s1))).append(ligne(S(kmap,s2)));
                $body.append($lignes);
                $body.append(refrain());
            };
            $body.append(ligne("..."));
        };
        
       $(document).ready(function() {
           generer();
       });
    </script>
    </head>
    <body>
        
    </body>
</html>