News

October 2009 : a new release (bibus 1.5.0)

  • OOo3.1 compatibility
  • Infinite number of file/http links
  • Clever capitalization (lord of war => Lord of War ...)
  • Better handling of journal abbreviations
  • Import/Export filters can be added easily (plugin)
  • journal abbreviations and shortcuts can be easily edited (simple csv file that can be edited in OOo/excel or a text editor)
  • Lot of bug fixes
  • Requires python2.5 (not a problem anymore under Windows since OOo3.1 includes 2.6)
  • Requires wxpython-2.8

Macros repository

From Bibus

Jump to: navigation, search

Here is a place to store macros for openoffice or word that can be useful for bibus users. Users can complete the following table and add the code of their macros at the end of the file.


Name Wordpocessor Author Description Link
Italicize words oOo Hilaire Drouineau Italicize words between tags <i> and </i>, it can be especially useful for species scientific names. The macro should be used after having finalized the document. link
Italicize words Word Hilaire Drouineau Italicize words between tags <i> and </i>, it can be especially useful for species scientific names. The macro should be used after having finalized the document. link
Remove empty parenthesis oOo Hilaire Drouineau Remove empty parenthesis () which occur for example, because of empty issue number. The macro should be used after having finalized the document. Be careful: it removes () in the whole text, not only in the bibliography. link
Alternative citation format oOo Hilaire Drouineau Change citations in the format (Dupont; 1998) or (Dupont, 1998) or (Dupont 1998), which are between tags <in> and </in>, into Dupont (1998). The macro should be used after having finalized the document. Be careful: it does not work for citation (Dupont; in Press) or (Dupont; submitted). link


Contents

Italicize words oOo

Sub ItaliqueBibus
  Dim vOpenSearch, vCloseSearch 'Open and Close descriptors
  Dim vOpenFound, vCloseFound 'Open and Close find objects
  ' Create descriptors from the searchable document.
  vOpenSearch = ThisComponent.createSearchDescriptor()
  vCloseSearch = ThisComponent.createSearchDescriptor()
  ' Set the text for which to search and other
  vOpenSearch.SearchString = "<i>"
  vCloseSearch.SearchString = "</i>"
  ' Find the first open delimiter
  vOpenFound = ThisComponent.findFirst(vOpenSearch)
  Do While Not IsNull(vOpenFound)
    'Search for the closing delimiter starting from the open delimiter
    vCloseFound = ThisComponent.findNext( vOpenFound.End, vCloseSearch)
    If IsNull(vCloseFound) Then
      Print "Found an opening bracket but no closing bracket!"
      Exit Do
    Else
      ' Clear the open bracket, if I do not do this, then I end up
      ' with only the text inside the brackets
      vOpenFound.setString("")
      ' select the te<th width="15%" bgcolor="#eeeeee">Wordpocessor</th>xt inside the brackets
      vOpenFound.gotoRange(vCloseFound, True)
      ' Print "Found " & vOpenFound.getString()
      ' clear the text inside the brackets
      vOpenFound.CharPosture=com.sun.star.awt.FontSlant.ITALIC
      ' Clear the close bracket
      vCloseFound.setString("")
      ' Do you really want to delete ALL of the spaces?
      ' If so, then do it here!
      vOpenFound = ThisComponent.findNext( vOpenFound.End, vOpenSearch)
    End If
  Loop
End Sub


Italicize words Word

Sub bibus()
    ActiveDocument.Select
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "<i>"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    While Selection.Find.Execute = True
        With Selection
            .MoveEndUntil Cset:="</i>", Count:=wdForward
            .MoveRight Unit:=wdCharacter, Count:=4, Extend:=wdExtend
        End With
        Selection.Font.Italic = wdToggle
        With Selection
            .MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdMove
        End With
    Wend
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

End Sub

Remove parenthesis oOo

 sub Parenthesis
   Dim vParenteseSearch 
   Dim vParentheseFound 
   'remove parenthesis ()
   vParentheseFound = ThisComponent.createSearchDescriptor()
   vParenteseSearch=ThisComponent.createSearchDescriptor()
   vParenteseSearch.SearchString = "()"
   vParentheseFound = ThisComponent.findFirst(vParenteseSearch)
   Do While Not IsNull(vParentheseFound)
     ' Clear the open bracket, if I do not do this, then I end up
     ' with only the text inside the brackets
     vParentheseFound.setString("")
     vParentheseFound=ThisComponent.findNext(vParentheseFound.End,vParenteseSearch)
     ' select the text inside the brackets
   Loop
 end sub

Alternative citation format

 Sub AlternaticeCitation
     Dim vOpenSearcha, vCloseSearcha
     Dim vOpenFounda, vCloseFounda
     vOpenSearcha = ThisComponent.createSearchDescriptor()
     vCloseSearcha = ThisComponent.createSearchDescriptor()
     vOpenSearcha.SearchString = "<in>"
     vCloseSearcha.SearchString = "</in>"
     ' Find the first open delimiter
     vOpenFounda = ThisComponent.findFirst(vOpenSearcha)
     Do While Not IsNull(vOpenFounda)
         'Search for the closing delimiter starting from the open delimiter
         vCloseFounda = ThisComponent.findNext( vOpenFounda.End, vCloseSearcha)
         If IsNull(vCloseFounda) Then
             Print "Found an opening bracket but no closing bracket!"
             Exit Do
         Else
             ' Clear the open bracket, if I do not do this, then I end up
             ' with only the text inside the brackets
             vOpenFounda.setString("")
             vOpenFounda.goRight(1,TRUE)
             vOpenFounda.setString("")
             ' select the text inside the brackets
             vOpenFounda.gotoRange(vCloseFounda, True)
             vCloseFounda.setString("")
             vCloseFounda.goLeft(5,FALSE)
             vCloseFounda.setString("(")
             vCloseFounda.goLeft(1,FALSE)
             vCloseFounda.goLeft(1,TRUE)
             if vCloseFounda.String=";" OR vCloseFounda.String="," Then
                 vCloseFounda.setString("")
             End If
             vCloseFounda.goLeft(1,TRUE)
             if vCloseFounda.String=" " Then
                 vCloseFounda.setString("")
             End If
        End If
        vOpenFounda = ThisComponent.findNext( vOpenFounda.End, vOpenSearcha)
     Loop
 end sub
Personal tools