Added hyphen replacement in cleaning advanced mode

This commit is contained in:
Georgy Litvinov 2021-02-01 10:30:08 +01:00
parent d9b458210a
commit af0c775dd2
7 changed files with 56 additions and 8 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark76
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark77
End Sub
@ -37,6 +37,7 @@ Private Sub makerUpMenu
dialog.getControl(&quot;configAnchors&quot;).Label = getTranslation(&quot;advancedMenuConfigAnchors&quot;)
dialog.getControl(&quot;fixMistakes&quot;).Label = getTranslation(&quot;advancedMenuFixMistakes&quot;)
dialog.getControl(&quot;fixDOI&quot;).Label = getTranslation(&quot;advancedMenuFixDOI&quot;)
dialog.getControl(&quot;replaceNumHyphen&quot;).Label = getTranslation(&quot;replaceNumHyphen&quot;)
dialog.getControl(&quot;removeInitPageBreak&quot;).Label = getTranslation(&quot;advancedMenuRemoveInitPageBreak&quot;)
dialog.getControl(&quot;removePageStyles&quot;).Label = getTranslation(&quot;advancedMenuRemovePageStyles&quot;)
dialog.getControl(&quot;loadStandardStyles&quot;).Label = getTranslation(&quot;advancedMenuLoadStandardStyles&quot;)
@ -118,6 +119,10 @@ Private Sub cleanAccordingTo(dialog As Object)
statusIndicator.Start(getTranslation(&quot;statusFixingDOI&quot;),100)
fixDOI
EndIf
If dialog.getControl(&quot;replaceNumHyphen&quot;).state = 1 Then
statusIndicator.Start(getTranslation(&quot;replaceNumHyphenStatus&quot;),100)
replaceNumHyphen
EndIf
If dialog.getControl(&quot;removeInitPageBreak&quot;).state = 1 Then
statusIndicator.Start(getTranslation(&quot;statusRemovePageBreakAtStart&quot;),100)
removeFirstElementPageBreak
@ -1952,4 +1957,16 @@ Sub resetChapterNumberingRules
Next i
End Sub
Private Sub replaceNumHyphen
StartTracking
replaceNumHyphenRegExp
StopTracking
showTrackedChanges
End Sub
Sub replaceNumHyphenRegExp
AskAndReplace(&quot;(?&lt;!DOI[0-9. /XVI:-‒–—−-]{1,50})(?&lt;=[:digit:])(?:[:space:])?[-‒–—−](?:[:space:])?(?=[:digit:])&quot;,&quot;&quot;)
End sub
</script:module>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="CleaningDialog" dlg:left="107" dlg:top="22" dlg:width="237" dlg:height="211" dlg:help-text="&amp;21.CleaningDialog.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&amp;22.CleaningDialog.Title">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="CleaningDialog" dlg:left="107" dlg:top="22" dlg:width="237" dlg:height="218" dlg:help-text="&amp;21.CleaningDialog.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&amp;22.CleaningDialog.Title">
<dlg:bulletinboard>
<dlg:button dlg:id="Cancel" dlg:tab-index="0" dlg:left="28" dlg:top="197" dlg:width="40" dlg:height="12" dlg:value="Отмена" dlg:button-type="cancel"/>
<dlg:button dlg:id="Cancel" dlg:tab-index="0" dlg:left="28" dlg:top="205" dlg:width="40" dlg:height="12" dlg:value="Отмена" dlg:button-type="cancel"/>
<dlg:button dlg:id="CommandButton1" dlg:tab-index="1" dlg:left="24" dlg:top="170" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
<dlg:button dlg:id="OK" dlg:tab-index="2" dlg:left="92" dlg:top="197" dlg:width="40" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/>
<dlg:button dlg:id="OK" dlg:tab-index="2" dlg:left="92" dlg:top="205" dlg:width="40" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/>
<dlg:checkbox dlg:id="fontsInStyles" dlg:tab-index="3" dlg:left="11" dlg:top="10" dlg:width="218" dlg:height="7" dlg:value="Заменить названия шрифтов в стилях" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeLinks" dlg:tab-index="6" dlg:left="11" dlg:top="50" dlg:width="218" dlg:height="7" dlg:value="Удалить гиперссылки" dlg:checked="false"/>
<dlg:checkbox dlg:id="cleanFormatting" dlg:tab-index="5" dlg:left="11" dlg:top="30" dlg:width="218" dlg:height="7" dlg:value="Очистить форматирование" dlg:checked="false"/>
@ -20,11 +20,12 @@
<dlg:checkbox dlg:id="removeManualPageBreaks" dlg:tab-index="15" dlg:left="11" dlg:top="150" dlg:width="218" dlg:height="7" dlg:value="Удалить все разрывы страниц" dlg:checked="false"/>
<dlg:checkbox dlg:id="replaceWhiteBackground" dlg:tab-index="16" dlg:left="11" dlg:top="40" dlg:width="218" dlg:height="7" dlg:value="Заменить белый фон символов на прозрачный" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeBasic" dlg:tab-index="17" dlg:left="11" dlg:top="160" dlg:width="218" dlg:height="7" dlg:value="Удалить макросы" dlg:checked="false"/>
<dlg:button dlg:id="buttonLoad" dlg:tab-index="18" dlg:left="158" dlg:top="197" dlg:width="52" dlg:height="12" dlg:value="loadTemplate">
<dlg:button dlg:id="buttonLoad" dlg:tab-index="18" dlg:left="158" dlg:top="205" dlg:width="52" dlg:height="12" dlg:value="loadTemplate">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Redaction.Configuration.setDeafultTemplate?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:checkbox dlg:id="removeAllFields" dlg:tab-index="19" dlg:left="11" dlg:top="170" dlg:width="218" dlg:height="7" dlg:value="Удалить все поля" dlg:checked="false"/>
<dlg:checkbox dlg:id="fixDOI" dlg:tab-index="20" dlg:left="11" dlg:top="100" dlg:width="218" dlg:height="7" dlg:value="Исправить DOI" dlg:checked="false"/>
<dlg:checkbox dlg:id="resetChapterNumberingRules" dlg:tab-index="21" dlg:left="11" dlg:top="180" dlg:width="218" dlg:height="7" dlg:value="Сбросить настройки нумерации глав" dlg:checked="false"/>
<dlg:checkbox dlg:id="replaceNumHyphen" dlg:tab-index="22" dlg:left="11" dlg:top="190" dlg:width="218" dlg:height="7" dlg:value="Исправить тире между цифрами" dlg:checked="false"/>
</dlg:bulletinboard>
</dlg:window>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Configuration" script:language="StarBasic" script:moduleType="normal">Public Const redactionExtensionName As String = &quot;cleanAndValidate&quot;
Public Const redactionExtensionVersion = &quot;0.9.24&quot;
Public Const redactionExtensionVersion = &quot;0.9.26&quot;
Function initRedactionConfiguration()
On Error Goto exceptionHandler
Dim regFactory As Object

View file

@ -278,6 +278,12 @@ Function getRussian(identifier As String) As String
Case &quot;dialogConfigMaxSubscript&quot;
getRussian = &quot;Макс. длина текста в нижнем индексе&quot;
Exit Function
Case &quot;replaceNumHyphen&quot;
getRussian = &quot;Заменить тире между цифрами на цифровые&quot;
Exit Function
Case &quot;replaceNumHyphenStatus&quot;
getRussian = &quot;Заменяются тире между цифрами на цифровые&quot;
Exit Function
Case Else
getRussian = &quot;Перевод не найден&quot;
End Select
@ -538,6 +544,12 @@ Function getEnglish(identifier As String) As String
Case &quot;dialogConfigMaxSubscript&quot;
getEnglish = &quot;Max line length in subscript&quot;
Exit Function
Case &quot;replaceNumHyphen&quot;
getEnglish = &quot;Replace dashes between numbers with numeric dashes&quot;
Exit Function
Case &quot;replaceNumHyphenStatus&quot;
getEnglish = &quot;Replacing dashes between numbers with numeric dashes&quot;
Exit Function
Case Else
getEnglish = &quot;No translation&quot;
End Select
@ -797,6 +809,12 @@ Function getCroatian(identifier As String) As String
Case &quot;dialogConfigMaxSubscript&quot;
getCroatian = &quot;Maksimalna duljina retka u indeksu&quot;
Exit Function
Case &quot;replaceNumHyphen&quot;
getCroatian = &quot;Zamijenite crtice između brojeva numeričkim crticama&quot;
Exit Function
Case &quot;replaceNumHyphenStatus&quot;
getCroatian = &quot;Zamjena crtica između brojeva numeričkim crticama&quot;
Exit Function
Case Else
getCroatian = &quot;No translation&quot;
End Select
@ -1056,6 +1074,12 @@ Function getSerbian(identifier As String) As String
Case &quot;dialogConfigMaxSubscript&quot;
getSerbian = &quot;Максимална дужина реда у индексу&quot;
Exit Function
Case &quot;replaceNumHyphen&quot;
getSerbian = &quot;Цртице између бројева замените нумеричким цртицама&quot;
Exit Function
Case &quot;replaceNumHyphenStatus&quot;
getSerbian = &quot;Замена цртица између бројева нумеричким цртицама&quot;
Exit Function
Case Else
getSerbian = &quot;No translation&quot;
End Select
@ -1315,6 +1339,12 @@ Function getBosnian(identifier As String) As String
Case &quot;dialogConfigMaxSubscript&quot;
getBosnian = &quot;Maksimalna dužina retka u indeksu&quot;
Exit Function
Case &quot;replaceNumHyphen&quot;
getBosnian = &quot;Zamijenite crtice između brojeva numeričkim crticama&quot;
Exit Function
Case &quot;replaceNumHyphenStatus&quot;
getBosnian = &quot;Zamjena crtica između brojeva numeričkim crticama&quot;
Exit Function
Case Else
getBosnian = &quot;No translation&quot;
End Select

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:dep="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="pro.litvinovg.Redaction"/>
<version value="0.9.24"/>
<version value="0.9.26"/>
<platform value="all"/>
<display-name>
<name lang="en">Cleaning and validation documents for publishing in html and epub with pagination</name>

View file

@ -1 +1 @@
version=0.9.24
version=0.9.26

Binary file not shown.