514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
|
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
|
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
|
n += self._replaceText(xElem, "(?<=[:alnum:])!", " !", True)
n += self._replaceText(xElem, "(?<=[]…)»}]):", " :", True)
n += self._replaceText(xElem, "(?<=[]…)»}]);", " ;", True)
n += self._replaceText(xElem, "(?<=[]…)»}])[?][ ]", " ? ", True)
n += self._replaceText(xElem, "(?<=[]…)»}])[?]$", " ?", True)
n += self._replaceText(xElem, "(?<=[]…)»}])!", " !", True)
n += self._replaceText(xElem, "[ ]+([:;?!])", " $1", True)
# réparations
n -= self._replaceText(xElem, "([[(])[ ]([!?:;])", "$1$2", True)
n -= self._replaceText(xElem, "(?<=http)[ ]://", "://", True)
n -= self._replaceText(xElem, "(?<=https)[ ]://", "://", True)
n -= self._replaceText(xElem, "(?<=ftp)[ ]://", "://", True)
n -= self._replaceText(xElem, "(?<=&)amp[ ];", "amp;", True) # ICU: & is $0 in replacement field
n -= self._replaceText(xElem, "(?<=&)nbsp[ ];", "nbsp;", True) # ICU: & is $0 in replacement field
n -= self._replaceText(xElem, "(?<=&)lt[ ];", "lt;", True) # ICU: & is $0 in replacement field
n -= self._replaceText(xElem, "(?<=&)gt[ ];", "gt;", True) # ICU: & is $0 in replacement field
n -= self._replaceText(xElem, "(?<=&)apos[ ];", "apos;", True) # ICU: & is $0 in replacement field
n -= self._replaceText(xElem, "(?<=&)quot[ ];", "quot;", True) # ICU: & is $0 in replacement field
n -= self._replaceText(xElem, "(?<=&)thinsp[ ];", "thinsp;", True) # ICU: & is $0 in replacement field
n -= self._replaceText(xElem, "(?<=&)amp[ ];", "amp;", True)
n -= self._replaceText(xElem, "(?<=&)nbsp[ ];", "nbsp;", True)
n -= self._replaceText(xElem, "(?<=&)lt[ ];", "lt;", True)
n -= self._replaceText(xElem, "(?<=&)gt[ ];", "gt;", True)
n -= self._replaceText(xElem, "(?<=&)apos[ ];", "apos;", True)
n -= self._replaceText(xElem, "(?<=&)quot[ ];", "quot;", True)
n -= self._replaceText(xElem, "(?<=&)thinsp[ ];", "thinsp;", True)
self.nbsp1_res.Label = str(n)
self.pbar.ProgressValue += 1
if self.nbsp2.State:
if self.nnbsp2.State:
# espaces insécables fines
n = self._replaceText(xElem, "«(?=[:alnum:])", "« ", True)
n += self._replaceText(xElem, "«[ ]+", "« ", True)
|
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
|
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
|
-
+
|
if False:
n = self._replaceText(xElem, "\\b(MM?\\.|Mlle|Mgr) ", "$1 ", True)
self.nbsp3_res.Label = str(n)
self.pbar.ProgressValue += 1
self.nbsp.State = False
self._switchCheckBox(self.nbsp)
self.pbar.ProgressValue = 15
# espaces manquants
# points médians
if self.typo.State:
if self.typo6.State:
n = self._replaceText(xElem, "\\bN\\.([ms])\\b", "N·$1", True, True) # N·m et N·m-1, N·s
n += self._replaceText(xElem, "\\bW\\.h\\b", "W·h", True, True)
n += self._replaceText(xElem, "\\bPa\\.s\\b", "Pa·s", True, True)
n += self._replaceText(xElem, "\\bA\\.h\\b", "A·h", True, True)
n += self._replaceText(xElem, "\\bΩ\\.m\\b", "Ω·m", True, True)
|
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
|
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
|
+
-
+
-
+
|
n += self._replaceText(xElem, "\\bm[3³]\\.s(?=-1)\\b", "m³·s", True, True)
#n += self._replaceText(xElem, "\\bJ.kg-1.K-1\\b", "J·kg-1·K-1", True, True)
#n += self._replaceText(xElem, "\\bW.m-1.K-1\\b", "W·m-1·K-1", True, True)
#n += self._replaceText(xElem, "\\bW.m-2.K-1\\b", "W·m-2·K-1", True, True)
n += self._replaceText(xElem, "\\b(Y|Z|E|P|T|G|M|k|h|da|d|c|m|µ|n|p|f|a|z|y)Ω\\b", "$1Ω", True, True)
self.typo6_res.Label = str(n)
self.pbar.ProgressValue += 1
# espaces manquants
if self.space.State:
if self.space1.State:
n = self._replaceText(xElem, ";(?=[:alnum:])", "; ", True)
n += self._replaceText(xElem, "\\?(?=[A-ZÉÈÊÂÀÎ])", "? ", True)
n += self._replaceText(xElem, "\\?(?=[A-ZÉÈÊÂÀÎ])", "? ", True, True)
n += self._replaceText(xElem, "!(?=[:alnum:])", "! ", True)
n += self._replaceText(xElem, "…(?=[:alnum:])", "… ", True)
n += self._replaceText(xElem, "\\.(?=[A-ZÉÈÎ][:alpha:])", ". ", True, True)
n += self._replaceText(xElem, "\\.(?=À)", ". ", True, True)
n += self._replaceText(xElem, ",(?=[:alpha:])", ", ", True)
n += self._replaceText(xElem, "([:alpha:]),([0-9])", "$1, $2", True)
n += self._replaceText(xElem, ":(?=[:alpha:])", ": ", True)
# exceptions:
# réparations
n -= self._replaceText(xElem, "(?<=DnT), w\\b", ",w", True, True)
n -= self._replaceText(xElem, "(?<=DnT), A\\b", ",A", True, True)
self.space1_res.Label = str(n)
self.pbar.ProgressValue += 1
if self.space2.State:
n = self._replaceText(xElem, " -(?=[:alpha:]|[\"«“'‘])", " - ", True)
n += self._replaceText(xElem, " –(?=[:alpha:]|[\"«“'‘])", " – ", True) # demi-cadratin
|