From e849641e007307138af49fa2fcaaf7bfbdde3086 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Tue, 4 Feb 2020 07:55:33 +0100 Subject: [PATCH] Improved conversion for diacritic marks --- IPHRedaction/Clean.xba | 68 ++++++++++++++++++++++++++---------------- description.xml | 2 +- releasenotes.txt | 1 + 3 files changed, 44 insertions(+), 27 deletions(-) diff --git a/IPHRedaction/Clean.xba b/IPHRedaction/Clean.xba index 155ccb0..ee46650 100644 --- a/IPHRedaction/Clean.xba +++ b/IPHRedaction/Clean.xba @@ -1,6 +1,6 @@ -Sub mark6 +Sub mark7 End Sub @@ -330,10 +330,10 @@ End Function Private Sub removeHyperlinks() - Dim statusIndicator as Object + Dim aNote As Object - statusIndicator = ThisComponent.getCurrentController.StatusIndicator - statusIndicator.Start("Удаление гиперссылок, подождите",10) + + removeHLInText(ThisComponent.Text) For x = 0 to ThisComponent.FootNotes.Count -1 aNote = ThisComponent.FootNotes.getByIndex(x) @@ -343,7 +343,7 @@ Private Sub removeHyperlinks() aNote = ThisComponent.EndNotes.getByIndex(x) removeHLInText(aNote.Text) Next - statusIndicator.end() + End Sub Private Sub removeHLInText(textElement) @@ -967,34 +967,50 @@ End Sub Private Sub convertWLLatin2IPHAstra Dim newFontName As String - newFontName = "IPH Astra Serif" + 'newFontName = "IPH Astra Serif" Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue Dim ReplAttributes(0) as new com.sun.star.beans.PropertyValue SrchAttributes(0).Name = "CharFontName" - SrchAttributes(0).Value = "WL LatinAllIn1Goth" + 'SrchAttributes(0).Value = "WL LatinAllIn1Goth" ReplAttributes(0).Name = "CharFontName" - ReplAttributes(0).Value = newFontName + 'ReplAttributes(0).Value = newFontName - SearchString = "\uF0D4" - oReplaceString = "̱" - ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, false) - ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, true) + SrchAttributes(0).Value = Empty + ReplAttributes(0).Value = Empty +'Replace macron below + oSearchString = "(.)\uF0D4" + oReplaceString = "$1̱" + 'from WL + ReplaceFormatting(oSearchString,oReplaceString,SrchAttributes,ReplAttributes, false) + oSearchString = "(.)\u0331" + 'from unicode to remove direct formatting + searchAndRemoveDirectFormatting(oSearchString) - SearchString = "\uF0D6" - oReplaceString = "̣" - ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, false) - ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, true) + 'Replace dot below + oSearchString = "(.)\uF0D6" + oReplaceString = "$1̣" + 'from WL + ReplaceFormatting(oSearchString,oReplaceString,SrchAttributes,ReplAttributes, false) + 'from unicode to remove direct formatting + oSearchString = "(.)\u0323" + searchAndRemoveDirectFormatting(oSearchString) + + 'replace macron + oSearchString = "(.)\uF0F4" + oReplaceString = "$1̄" + 'from WL + ReplaceFormatting(oSearchString,oReplaceString,SrchAttributes,ReplAttributes, false) + 'from unicode to remove direct formatting + oSearchString = "(.)\u0304" + searchAndRemoveDirectFormatting(oSearchString) - SearchString = "\uF0F4" - oReplaceString = "̄" - ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, false) - ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, true) - - ReplAttributes(0).Value = newFontName - SearchString = "\uF0F1" - oReplaceString = "́" - ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, false) - ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, true) + 'replace accent + oSearchString = "(.)\uF0F1" + oReplaceString = "$1́" + ReplaceFormatting(oSearchString,oReplaceString,SrchAttributes,ReplAttributes, false) + 'from unicode to remove direct formatting + oSearchString = "(.)\u0341" + searchAndRemoveDirectFormatting(oSearchString) replaceFontsInStyles( "WL LatinAllIn1Goth", newFontName) End Sub diff --git a/description.xml b/description.xml index d6a8c1e..6043cd1 100644 --- a/description.xml +++ b/description.xml @@ -3,7 +3,7 @@ xmlns:dep="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> - + Cleaning and validation documents for publishing in html and epub with pagination diff --git a/releasenotes.txt b/releasenotes.txt index 8f1bd1e..971556e 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -1,3 +1,4 @@ +0.4.1 Improved conversion for diacritic marks 0.4.0 Added fonts in styles conversion, also added conversion for WL Latin symbols 0.3.7 Added greek extended conversion to Tinos, extended latin and letter-like symbols to base font 0.3.6 Added check for null EmbeededObject (13.01.2019)