Le Trésor de la Langue Française informatisé dans votre terminal - retour accueil
git clone git://bebou.netlib.re/TLFi-light
Log | Files | Refs |
commit a7e5cfdb14569fca53d50d76a692d36edddc3ec3 parent aee46afaaf3b274bde81b4419d1180f4c0ad0e66 Auterice: Arthur Pons <arthur.pons@unistra.fr> Date: Fri, 14 Jun 2024 18:55:02 +0200 + getword, modif parse word getword pour récupérer un mot parse word détecte des choses en plus et parse un peu mieux Diffstat:
A | getword | | | 3 | +++ |
M | parseword | | | 30 | ++++++++++++++++++++---------- |
2 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/getword b/getword @@ -0,0 +1,3 @@ +#! /bin/sh + +curl -Ls "https://www.cnrtl.fr/definition/${1:?'Renseigner un mot}" diff --git a/parseword b/parseword @@ -5,21 +5,31 @@ def="\x1b[93m" synt="\x1b[92m" cit="\x1b[94m" ital="\x1b[3m" +empl="\x1b[95m" +syn="\x1b[36m" +autre="\x1b[96m" norm="\x1b[0m" -cat html-pyramide | +cat | sed -n '/vtoolbar/,$ p' | sed -E "s,<span class=\"tlf_cdomaine\">,$dom,g; s,<span class=\"tlf_cdefinition\">,\n$def,g; s,<span class=\"tlf_cplan\">,\n\ - \n,g; - s,<span class=\"tlf_csyntagme\">,$synt,g; - s,<div class=\"tlf_(tabulation|parothers)\">,\n\ - \n ,g; +\n,g; + s,<span class=\"tlf_csyntagme\">,\n$synt,g; + s,<span class=\"tlf_cemploi\">,$empl,g; + s,<span class=\"tlf_cmot\">,\n$autre,g; + s,<span class=\"tlf_csynonime\">,\n$syn,g; + s,<span class=\"tlf_ccode\">,$norm,g; + s,<div class=\"tlf_parsynt\">,\n\ +\n$synt,g; + s,<div class=\"tlf_(tabulation|parothers)\">,$norm\n\ + \n ,g; s,<div class=\"tlf_paraputir\">,\n\ - \n,g; - s,<span class=\"tlf_cexemple\">,$ital,g;" | - #s,</span>,$norm,g" | - sed -E 's,<[^>]*>,,g' | - sed -E "s#\([^)]*p\. [0-9]+\)#$cit&$norm#g" | +\n,g; + s,<span class=\"tlf_cexemple\">,$norm$ital,g;" | + sed -E "s,<[^>]*>,,g;" | + sed -E "s#\([^)]*p\. [0-9]+\)#\n$cit&$norm#g" | + sed -zE "s,\n\n,\n$norm\n,g" | + sed -E 's,^ +, ,' | grep -v '^ **$'