Ajout des macros ApresZotero avec license

This commit is contained in:
Bastien Dumont 2021-02-19 23:53:23 +01:00
parent 0ca4726f51
commit e12664e881
7 changed files with 767 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,40 @@
<?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="ApZotGlobalOptions" script:language="StarBasic" script:moduleType="normal">REM ***** BASIC *****
'************************************************************************
'* Copyright 2021 by Bastien Dumont (bastien.dumont@posteo.net)
'*
'* This file is part of the ApresZotero library.
'*
'* ApresZotero is free software: you can redistribute it and/or modify
'* it under the terms of the GNU General Public License as published by
'* the Free Software Foundation, either version 3 of the License, or
'* (at your option) any later version.
'*
'* ApresZotero is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'* GNU General Public License for more details.
'*
'* You should have received a copy of the GNU General Public License
'* along with ApresZotero. If not, see &lt;https://www.gnu.org/licenses/&gt;.
'*
'************************************************************************
Public Const nExponentCharSizePercentage As Integer = 33
Public Const nExponentCharHeightPercentage As Integer = 58
Public Const nBigZoomFactor As Integer = 350
Public Const nMaxArray As Integer = 1002
Public Const sSeparatorForListOfAbbreviations As String = &quot;|&quot;
Public Const sReplacementSeparatorForListOfAbbreviations As String = &quot; : &quot;
Public Const sAbbrevRefSeparator As String = &quot; : &quot;
Public Const sAbbrevRefSuffix As String = &quot;.&quot;
Public Const sFirstCitationPrefix As String = &quot;, cité n. &quot;
Public Const nDefaultCharHeight As Integer = 12
Public Const sGreekTextRegex As String = &quot;[ΑΖΕΡΤΨΥΙΟΠΘΣΔΦΓΗϞΚΛΜΩΞΧϐΒΝαζερτψυιοπθσδφγηϟκλμωξχϐβνϡϠ]*[αζερτψυιοπθσδφγηϟκλμωξχϐβνϡϠ] ?[,;:!.·]?&quot;
Public Const GreekFont As String = &quot;IFAO-Grec Unicode&quot;
Public Const sBibliographyStyleName As String = &quot;Bibliography 1&quot;
Public Const sRectoVersoRegex As String = &quot;[0-9]+[rv](-v)?&quot;
Public Const sNumberOrIssueRegex As String = &quot; nos? &quot; &apos; last character is a non-breakable space
</script:module>

View File

@ -0,0 +1,85 @@
<?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="ApZotRevues" script:language="StarBasic" script:moduleType="normal">REM ***** BASIC *****
'************************************************************************
'* Copyright 2021 by Bastien Dumont (bastien.dumont@posteo.net)
'*
'* This file is part of the ApresZotero library.
'*
'* ApresZotero is free software: you can redistribute it and/or modify
'* it under the terms of the GNU General Public License as published by
'* the Free Software Foundation, either version 3 of the License, or
'* (at your option) any later version.
'*
'* ApresZotero is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'* GNU General Public License for more details.
'*
'* You should have received a copy of the GNU General Public License
'* along with ApresZotero. If not, see &lt;https://www.gnu.org/licenses/&gt;.
'*
'************************************************************************
Option Compatible
Option Explicit
Sub REB
Const mJournal As String = &quot;REB&quot;
Const sCitedPrefix As String = &quot;, cité n. &quot;
Dim mTitreLong() As String
mTitreLong = Array(&quot;Acta Sanctorum&quot;, &quot;Acta Conciliorum Oecumenicorum&quot;, &quot;Analecta Bollandiana&quot;, &quot;Archives de l&apos;Orient chrétien&quot;, &quot;Byzantinische Forschungen&quot;, &quot;Bibliotheca Hagiographica Graeca&quot;, &quot;Byzantine and Modern Greek Studies&quot;, &quot;Byzantinisch-Neugriechische Jahrbücher&quot;, &quot;Byzantinoslavica&quot;, &quot;Byzantion&quot;, &quot;Byzantinische Zeitschrift&quot;, &quot;Cahiers Archéologiques&quot;, &quot;Corpus Christianorum, Series Graeca&quot;, &quot;Corpus Fontium Historiae Byzantinae&quot;, &quot;Clavis Patrum Graecorum&quot;, &quot;Corpus Scriptorum Christianorum Orientalium&quot;, &quot;Corpus Scriptorum Historiae Byzantinae&quot;, &quot;Dictionnaire d&apos;Archéologie Chrétienne et de Liturgie&quot;, &quot;Δελτίον τῆς Χριστιανικῆς καὶ Ἀρχαιολογικῆς Ἑταιρείας&quot;, &quot;Dictionnaire dHistoire et de Géographie Ecclésiastiques&quot;, &quot;Dumbarton Oaks Papers&quot;, &quot;Dictionnaire de Théologie Catholique&quot;, &quot;Ἐπετηρὶς Ἑταιρείας Βυζαντινῶν Σπουδῶν&quot;, &quot;Échos d&apos;Orient&quot;, &quot;Greek, Roman and Byzantine Studies&quot;, &quot;Известия Русскаго Археолгическаго Института в Константинополие&quot;, &quot;Jahrbuch der Österreichischen Byzantinistik&quot;, &quot;Lexikon zur byzantinischen Gräzität&quot;, &quot;Lexikon für Theologie und Kirche&quot;, &quot;Μεσαιωνικὴ Βιβλιοθήκη&quot;, &quot;Medioevo Greco&quot;, &quot;Monumenta Germaniae Historica&quot;, &quot;F. Miklosich, J. Müller (éd.), Acta et diplomata&quot;, &quot;Νέος Ἑλληνομνήμων&quot;, &quot;Orientalia Christiana Analecta&quot;, &quot;Orientalia Christiana Periodica&quot;, &quot;The Oxford Dictionary of Byzantium, I-III, New York Oxford 1991&quot;, &quot;Prosopography of the Byzantine Empire I (641-867)&quot;, &quot;Prosopography of the Byzantine World&quot;, &quot;Patrologia Graeca&quot;, &quot;Patrologie grecque&quot;, &quot;Patrologia Latina&quot;, &quot;Patrologie latine&quot;, &quot;Prosopographisches Lexikon der Palaiologenzeit&quot;, &quot;Prosopographie der mittelbyzantinischen Zeit (641-1025)&quot;, &quot;Patrologia Orientalis&quot;, &quot;Patrologie orientale&quot;, &quot;Patristische Texte und Studien&quot;, &quot;Revue des Études Byzantines&quot;, &quot;Revue des Études Grecques&quot;, &quot;Revue des Études Sud-Est Européennes&quot;, &quot;Repertorium der griechischen Kopisten&quot;, &quot;Rivista di Studi Bizantini e Neoellenici&quot;, &quot;Rivista di Studi Bizantini e Slavi&quot;, &quot;Studies in Byzantine Sigillography&quot;, &quot;Sources Chrétiennes&quot;, &quot;Synaxarium Ecclesiae Constantinopolitanae&quot;, &quot;Θρησκευτικὴ καὶ Ἠθικὴ Ἐγκυκλοπαιδεία&quot;, &quot;Tabula Imperii Byzantini&quot;, &quot;Travaux et Mémoires&quot;, &quot;Византийский Временник&quot;)
Dim mAbrev() As String
mAbrev= Array(&quot;AASS&quot;, &quot;ACO&quot;, &quot;An. Boll.&quot;, &quot;AOC&quot;, &quot;BF&quot;, &quot;BHG&quot;, &quot;BMGS&quot;, &quot;BNJ&quot;, &quot;BS&quot;, &quot;Byz.&quot;, &quot;BZ&quot;, &quot;CA&quot;, &quot;CCSG&quot;, &quot;CFHB&quot;, &quot;CPG&quot;, &quot;CSCO&quot;, &quot;CSHB&quot;, &quot;DACL&quot;, &quot;DChAE&quot;, &quot;DHGE&quot;, &quot;DOP&quot;, &quot;DTC&quot;, &quot;EEBS&quot;, &quot;EO&quot;, &quot;GRBS&quot;, &quot;IRAIK&quot;, &quot;JÖB&quot;, &quot;LBG&quot;, &quot;LTK&quot;, &quot;MB&quot;, &quot;MEG&quot;, &quot;MGH&quot;, &quot;MM&quot;, &quot;NE&quot;, &quot;OCA&quot;, &quot;OCP&quot;, &quot;ODB&quot;, &quot;PBE&quot;, &quot;PBW&quot;, &quot;PG&quot;, &quot;PG&quot;, &quot;PL&quot;, &quot;PL&quot;, &quot;PLP&quot;, &quot;PMBZ&quot;, &quot;PO&quot;, &quot;PO&quot;, &quot;PTS&quot;, &quot;REB&quot;, &quot;REG&quot;, &quot;RESEE&quot;, &quot;RGK&quot;, &quot;RSBN&quot;, &quot;RSBS&quot;, &quot;SBS&quot;, &quot;SC&quot;, &quot;Syn. CP&quot;, &quot;ThEE&quot;, &quot;TIB&quot;, &quot;TM&quot;, &quot;VV&quot;)
Const sLineRefRegex As String = &quot;, l\.[  ]([A-D0-9-]+)&quot;
Dim oDocument As Object
Dim oSearch As Object, oReplace As Object, oResult As Object
Dim oFound As Object, oFoundCursor As Object
Dim n As Integer
Dim iReturnCode As Integer
&apos; Initialisation des objets utilisés dans plusieurs blocs de code
oDocument = ThisComponent
oSearch = oDocument.createSearchDescriptor
oReplace = oDocument.createReplaceDescriptor
&apos; Vérifier que le document n&apos;a plus à être modifié.
If Check(mJournal) = 7 Then
Exit Sub
End If
&apos; Abrègement des titres de revues
Abbreviate (oDocument, mTitreLong(), mAbrev(), mJournal, False)
AbbrevAnnee_Philologique(True)
&apos; Numéros de lignes en exposant sans &quot;l. &quot;
oSearch.SearchString = sLineRefRegex
oSearch.SearchRegularExpression = TRUE
oResult = oDocument.findAll(oSearch)
For n = 0 To oResult.count - 1
oFound = oResult.getByIndex(n)
oFoundCursor = oFound.Text.createTextCursorByRange(oFound)
oFoundCursor.CharEscapement = nExponentCharSizePercentage
oFoundCursor.CharEscapementHeight = nExponentCharHeightPercentage
Next n
ReplaceString(sLineRefRegex, &quot;$1&quot;, TRUE)
SetFolioToPluralForm(&quot;f. &quot;, &quot;ff. &quot;)
ReplaceString(&quot;&quot;, &quot; &quot;, FALSE) &apos; Replace narrow non breakable spaces (automatically generated by Zotero) by simple non breakable spaces.
ReplaceString(&quot; - &quot;, &quot;-&quot;, FALSE)
SetStringPartToExponent(oDocument, sRectoVersoRegex, &quot;[rv](-v)?&quot;)
SetStringPartToExponent(oDocument, sNumberOrIssueRegex, &quot;os?&quot;)
SetFontSlantToString(&quot;CPG&quot;, com.sun.star.awt.FontSlant.ITALIC)
SetFontSlantToString(&quot;BHG&quot;, com.sun.star.awt.FontSlant.ITALIC)
HandleItemsInBibliography(&quot;Titre Liste des abréviations&quot;)
end sub
</script:module>

View File

@ -0,0 +1,55 @@
<?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="ApZotUtilities" script:language="StarBasic" script:moduleType="normal">REM ***** BASIC *****
'************************************************************************
'* Copyright 2021 by Bastien Dumont (bastien.dumont@posteo.net)
'*
'* This file is part of the ApresZotero library.
'*
'* ApresZotero is free software: you can redistribute it and/or modify
'* it under the terms of the GNU General Public License as published by
'* the Free Software Foundation, either version 3 of the License, or
'* (at your option) any later version.
'*
'* ApresZotero is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'* GNU General Public License for more details.
'*
'* You should have received a copy of the GNU General Public License
'* along with ApresZotero. If not, see &lt;https://www.gnu.org/licenses/&gt;.
'*
'************************************************************************
Sub CountOccurrencesPerReference
Dim vSortedItemMap As Variant
Dim oScope As Object
oScope = ThisComponent
vSortedItemMap = getOccurrencesCount(oScope)
PrintMap(vSortedItemMap)
End Sub
Sub ChangeGreekFont
Dim oSearch As Object
Dim oDocument As Object
Dim oResult As Object
Dim i As Integer
Dim oFound As Object
Dim oFoundCursor As Object
oDocument = ThisComponent
oSearch = oDocument.createSearchDescriptor
oSearch.SearchString = sGreekTextRegex
oSearch.SearchRegularExpression = TRUE
oResult = oDocument.findAll(oSearch)
For i = 0 To oResult.count - 1
oFound = oResult.getByIndex(i)
oFoundCursor = oFound.Text.createTextCursorByRange(oFound)
oFoundCursor.CharFontName = GreekFont
Next i
End Sub
</script:module>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ApresZotero" library:readonly="false" library:passwordprotected="false"/>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ApresZotero" library:readonly="false" library:passwordprotected="false">
<library:element library:name="ApZotRevues"/>
<library:element library:name="ApZotFunctions"/>
<library:element library:name="ApZotGlobalOptions"/>
<library:element library:name="ApZotUtilities"/>
</library:library>

Binary file not shown.