Skip to content

WIP: Fix/unbreakable spaces#136

Open
agervail wants to merge 2 commits into
masterfrom
fix/unbreakable_spaces
Open

WIP: Fix/unbreakable spaces#136
agervail wants to merge 2 commits into
masterfrom
fix/unbreakable_spaces

Conversation

@agervail

@agervail agervail commented Jan 2, 2020

Copy link
Copy Markdown
Contributor

Closes #128

@agervail
agervail requested review from JulioJu and jibidus January 2, 2020 15:01
@agervail

agervail commented Jan 2, 2020

Copy link
Copy Markdown
Contributor Author

presque une journée pour écrire la regexp --' et valider que ça ne fout pas la merde :)

@agervail
agervail force-pushed the fix/unbreakable_spaces branch from 9c6f3dd to e923ea3 Compare January 2, 2020 15:11
@agervail

agervail commented Jan 2, 2020

Copy link
Copy Markdown
Contributor Author

Je viens de réaliser que ça le faisait aussi dans certains cas rares dans des bouts de code.. Je ne sais pas si ça peut poser problème si quelqu'un fait un copier/coller de ce bouts de script/example ?

@JulioJu

JulioJu commented Jan 2, 2020

Copy link
Copy Markdown
Contributor

Bien vu @agervail !

Oui ça peut poser problèmes. Du coup faut améliorer le script pour qu'il ne le fasse pas entre des balises <pre>. Je vois le script dans ma tête, mais je ne le ferai pas maintenant ni ces prochains jours ;-) .

Si tu peux corriger, ;-) .

@JulioJu JulioJu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be improve to not be triggered between <pre> tag :-)

@JulioJu JulioJu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention, c'est une espaces insécable fine qu'on veut !

Soyons un peu grammar-nazi ;-) https://librefan.eu.org/node/206

if [ $? -ne 0 ]; then
echo "$filename is not UTF-8 encoded"
else
sed -i -E "s/ (\!|\?|:|;|«|»)($|[[:space:]]|"$'\xC2\xA0'")/"$'\xC2\xA0'"\1\2/g" $filename

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Juste pour info, c'est toi qui a conçu cette commande ? Ou tu l'as trouvé quelque part ? Si c'est le cas, ce serait cool de sourcer, et ça m'intéresse :-) !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouais c'est bibi qui l'a écrite :) je ne vais pas dire que ça m'a pris 5' plutôt 3h au total pour le script :p

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trop cool, trop cool, elle me fait kiffer cette commande !!! :-) :-) 

@agervail

agervail commented Jan 3, 2020

Copy link
Copy Markdown
Contributor Author

C'est quoi le code hexadécimal de le truc insécable fine ?

@JulioJu

JulioJu commented Jan 3, 2020

Copy link
Copy Markdown
Contributor

C'est quoi le code hexadécimal de le truc insécable fine ?

Tu peux utiliser &#x202f; ;-)

@JulioJu

JulioJu commented Jan 3, 2020

Copy link
Copy Markdown
Contributor

Je penser à’l'algo suivant pour ne pas changer le texte qui contient du code :

for file in folder_post
do
   isCode="false"
   for lineNumber of $file
     if line contains `{{<[:space:]+highlight`
     then
       if  [[ ${isCode}="true" ]]
       then
          exit  2
       fi
       isCode="true"
     fi
     if line contains `{{<[:space:]+/highlight`
     then
       if  [[ ${isCode} == "false ]]
       then
          exit  2
       fi
       isCode="false"
     fi
     if [[ ${isCode} == "true" ]]
     then
       sed -i "$lineNumber}s/pattern/replace/g" ${file}
     fi
  done
done

Note: tout n'est pas batch compliant dans ce script lol. Ça reste un algo. Et je ne me rappelle pas exactement de la syntaxe.

Perso, je n'utilise jamais for, parce que parfois il plante.

@JulioJu
JulioJu force-pushed the master branch 3 times, most recently from 253ea37 to ef830c4 Compare January 25, 2020 13:16
@JulioJu JulioJu changed the title Fix/unbreakable spaces WIP: Fix/unbreakable spaces Jan 25, 2020
@JulioJu
JulioJu force-pushed the master branch 12 times, most recently from 1402362 to 616e827 Compare January 26, 2020 16:44
@JulioJu
JulioJu force-pushed the master branch 9 times, most recently from f99a012 to df9ba47 Compare February 2, 2020 10:11
@JulioJu
JulioJu force-pushed the master branch 15 times, most recently from 2686b07 to d82039b Compare February 9, 2020 11:05
@JulioJu
JulioJu force-pushed the master branch 4 times, most recently from f09fd26 to 95df4fd Compare May 10, 2020 18:17
@jibidus jibidus added the chore Side task label Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Side task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace spaces by unbreakable spaces before each ponctuations

3 participants