Grammalecte  Check-in [2ef57e5809]

Overview
Comment:[fr] lexicographe: analyse des sous-parties des locutions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fr | Lexicographe
Files: files | file ages | folders
SHA3-256: 2ef57e580955a487e8f8feaf06f4ef800c367595ff449d5a802ba0125311ae11
User & Date: olr on 2017-10-30 20:50:17
Other Links: branch diff | manifest | tags
Context
2017-10-30
21:08
[fr] lexicographe: màj du CSS check-in: b08a87e4bf user: olr tags: Lexicographe, fr
20:50
[fr] lexicographe: analyse des sous-parties des locutions check-in: 2ef57e5809 user: olr tags: Lexicographe, fr
16:44
[fr] lexicographe: minor changes check-in: 4e84b8a6cf user: olr tags: Lexicographe, fr
Changes

Modified gc_lang/fr/modules-js/lexicographe.js from [f3882fd6a0] to [56a7e98a7a].

   345    345                   } else if (oToken.sType !== "SPACE") {
   346    346                       aElem.push(oToken);
   347    347                   }
   348    348               }
   349    349           }
   350    350           return aElem;
   351    351       }
          352  +
          353  +    generateInfoForTokenList (lToken) {
          354  +        let aElem = [];
          355  +        for (let oToken of lToken) {
          356  +            let aRes = this.getInfoForToken(oToken);
          357  +            if (aRes) {
          358  +                aElem.push(aRes);
          359  +            }
          360  +        }
          361  +        return aElem;
          362  +    }
   352    363   
   353    364       getListOfTokensReduc (sText, bInfo=true) {
   354    365           let aTokenList = this.getListOfTokens(sText.replace("'", "’").trim(), false);
   355    366           let iKey = 0;
   356    367           let aElem = [];
   357    368           do {
   358    369               let oToken = aTokenList[iKey];
................................................................................
   373    384                       } else {
   374    385                           break;
   375    386                       }
   376    387                   }
   377    388               }
   378    389   
   379    390               if (sMorphLoc) {
   380         -                let sWord = '';
          391  +                let sValue = '';
   381    392                   for (let oTokenWord of aTokenTempList) {
   382         -                    sWord += oTokenWord.sValue+' ';
          393  +                    sValue += oTokenWord.sValue+' ';
   383    394                   }
   384    395                   let oTokenLocution = {
   385    396                       'nStart': aTokenTempList[0].nStart,
   386    397                       'nEnd': aTokenTempList[aTokenTempList.length-1].nEnd,
   387    398                       'sType': "LOC",
   388         -                    'sValue': sWord.replace('’ ','’').trim()
          399  +                    'sValue': sValue.replace('’ ','’').trim(),
          400  +                    'aSubToken': aTokenTempList
   389    401                   };
   390    402                   if (bInfo) {
   391    403                       let aFormatedTag = [];
   392         -                    for (let sTagMulti of sMorphLoc.split('|') ){
   393         -                        aFormatedTag.push( this._formatTags(sTagMulti).replace(/( \(él.\))/g,'') );
          404  +                    for (let sTagLoc of sMorphLoc.split('|') ){
          405  +                        aFormatedTag.push( this._formatTags(sTagLoc).replace(/( \(él.\))/g,'') );
   394    406                       }
   395    407                       aElem.push({
   396    408                           sType: oTokenLocution.sType,
   397    409                           sValue: oTokenLocution.sValue,
   398         -                        aLabel: aFormatedTag
          410  +                        aLabel: aFormatedTag,
          411  +                        aSubElem: this.generateInfoForTokenList(aTokenTempList)
   399    412                       });
   400    413                   } else {
   401    414                       aElem.push(oTokenLocution);
   402    415                   }
   403    416                   iKey = iKey + aTokenTempList.length;
   404    417               } else {
   405    418                   if (bInfo) {

Modified gc_lang/fr/webext/content_scripts/panel_lxg.css from [ccbb028287] to [c6d538bdb2].

    31     31       border-radius: 5px;
    32     32       text-align: center;
    33     33       font-size: 20px;
    34     34   }
    35     35   
    36     36   .grammalecte_lxg_token_block  {
    37     37       margin: 4px 0;
           38  +}
           39  +.grammalecte_lxg_token_subblock {
           40  +    margin: 2px 0 2px 20px;
           41  +    padding: 5px;
           42  +    border-left: 4px solid hsl(210, 50%, 50%);
           43  +    background-color: hsl(210, 10%, 90%);
           44  +}
           45  +.grammalecte_lxg_token_descr {
           46  +    padding: 2px;
    38     47   }
    39     48   .grammalecte_lxg_token {
    40     49       display: inline-block;
    41     50       background-color: hsl(150, 0%, 50%);
    42     51       color: hsl(0, 0%, 96%);
    43     52       padding: 2px 5px;
    44     53       border-radius: 2px;

Modified gc_lang/fr/webext/content_scripts/panel_lxg.js from [d3537b8dce] to [524fe4ff4b].

    25     25       }
    26     26   
    27     27       addMessage (sMessage) {
    28     28           let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_message", textContent: sMessage});
    29     29           this._xContentNode.appendChild(xNode);
    30     30       }
    31     31   
    32         -    addListOfTokens (lTokens) {
           32  +    addListOfTokens (lToken) {
    33     33           try {
    34         -            if (lTokens) {
           34  +            if (lToken) {
    35     35                   this._nCount += 1;
    36         -                let xNodeDiv = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});
    37         -                xNodeDiv.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_num", textContent: this._nCount}));
    38         -                for (let oToken of lTokens) {
    39         -                    xNodeDiv.appendChild(this._createTokenNode(oToken));
           36  +                let xTokenList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});
           37  +                xTokenList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_num", textContent: this._nCount}));
           38  +                for (let oToken of lToken) {
           39  +                    xTokenList.appendChild(this._createTokenBlock(oToken));
           40  +                }
           41  +                this._xContentNode.appendChild(xTokenList);
           42  +            }
           43  +        }
           44  +        catch (e) {
           45  +            showError(e);
           46  +        }
           47  +    }
           48  +
           49  +    _createTokenBlock (oToken) {
           50  +        let xTokenBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_block"});
           51  +        xTokenBlock.appendChild(this._createTokenDescr(oToken));
           52  +        if (oToken.aSubElem) {
           53  +            let xSubBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_subblock"});
           54  +            for (let oSubElem of oToken.aSubElem) {
           55  +                xSubBlock.appendChild(this._createTokenDescr(oSubElem));
           56  +            }
           57  +            xTokenBlock.appendChild(xSubBlock);
           58  +        }
           59  +        return xTokenBlock;
           60  +    }
           61  +
           62  +    _createTokenDescr (oToken) {
           63  +        try {
           64  +            let xTokenDescr = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_descr"});
           65  +            xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token grammalecte_lxg_token_" + oToken.sType, textContent: oToken.sValue}));
           66  +            xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_colon", textContent: ":"}));
           67  +            if (oToken.aLabel.length === 1) {
           68  +                xTokenDescr.appendChild(document.createTextNode(oToken.aLabel[0]));
           69  +            } else {
           70  +                let xMorphList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_list"});
           71  +                for (let sLabel of oToken.aLabel) {
           72  +                    xMorphList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem", textContent: "• " + sLabel}));
    40     73                   }
    41         -                this._xContentNode.appendChild(xNodeDiv);
           74  +                xTokenDescr.appendChild(xMorphList);
    42     75               }
           76  +            return xTokenDescr;
    43     77           }
    44     78           catch (e) {
    45     79               showError(e);
    46     80           }
    47     81       }
    48     82   
    49         -    _createTokenNode (oToken) {
    50         -        let xTokenNode = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_block"});
    51         -        xTokenNode.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token grammalecte_lxg_token_" + oToken.sType, textContent: oToken.sValue}));
    52         -        xTokenNode.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_colon", textContent: ":"}));
    53         -        if (oToken.aLabel.length === 1) {
    54         -            xTokenNode.appendChild(document.createTextNode(oToken.aLabel[0]));
    55         -        } else {
    56         -            let xTokenList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_list"});
    57         -            for (let sLabel of oToken.aLabel) {
    58         -                xTokenList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem", textContent: "• " + sLabel}));
    59         -            }
    60         -            xTokenNode.appendChild(xTokenList);
    61         -        }
    62         -        return xTokenNode;
    63         -    }
    64         -
    65     83       setHidden (sClass, bHidden) {
    66     84           for (let xNode of document.getElementsByClassName(sClass)) {
    67     85               xNode.hidden = bHidden;
    68     86           }
    69     87       }
    70     88   }