Merge pull request #59 from chmduquesne/gh-pages

Ajout de genre et classe dans le html
This commit is contained in:
Christophe-Marie Duquesne
2015-12-08 10:14:54 +01:00
2 changed files with 35 additions and 8 deletions

View File

@@ -42,6 +42,29 @@ function sansAccents(mot) {
.replace("ü", "u"); .replace("ü", "u");
} }
function htmlifier(mot, langue){
var res = '<span class="mot-' + langue + '">' + mot[langue] + '</span>';
if (langue == "francais") {
if ("genre" in mot){
var genre = 'N' + mot["genre"].toUpperCase();
res += ' <span class="genre">' + genre + '</span>';
}
if ("classe" in mot){
var classe = "";
if (mot["classe"] == "groupe nominal") {
classe = "GN";
}
if (mot["classe"] == "proposition") {
classe = "Prop";
}
if (classe != ""){
res += ' <span class="classe">' + classe + '</span>';
}
}
}
return res;
}
function construitListe(traductions) { function construitListe(traductions) {
var langue = $( "#mots" ).attr("data-langue"); var langue = $( "#mots" ).attr("data-langue");
@@ -84,8 +107,6 @@ function construitListe(traductions) {
); );
} }
var langueSource = langue;
var langueDestination = reciproque[langue];
$( "#mots" ) $( "#mots" )
.children() .children()
.last() .last()
@@ -94,13 +115,9 @@ function construitListe(traductions) {
.attr("class", "definition") .attr("class", "definition")
.html( .html(
'· ' '· '
+ '<span class="mot-' + langueSource + '">' + htmlifier(mot, langue)
+ mot[langueSource]
+ '</span>'
+ ' : ' + ' : '
+ '<span class="mot-' + langueDestination + '">' + htmlifier(mot, reciproque[langue])
+ mot[langueDestination]
+ '</span>'
) )
); );
} }

View File

@@ -56,6 +56,16 @@ h3
color: #905050; color: #905050;
} }
.genre
{
display: None;
}
.classe
{
display: None;
}
#intro #intro
{ {
font-size: larger; font-size: larger;