Author Topic: Copy/paste wikipedia text comes up with reference numbers, [edit]? Use this Word macro to clean up.  (Read 1061 times)

spiros

  • Administrator
  • Hero Member
  • *****
  • Posts: 293621
  • Gender: Male
  • point d’amour
    • spiros.doikas
    • greektranslator
    • doikas
    • 102094522373850556729
    • lavagraph
    • Greek translator CV
Copy/paste wikipedia text comes up with reference numbers, [edit]? Use this Word macro to clean up.

I created a macro that will delete unnecessary text like [1], [edit], [citation needed] when pasting text from wikipedia. The macro does the trick for English and Greek wikipedia. Feel free to add your own language bits.


Code: [Select]
Sub cleanwikipedia()
'
' wikipedia clean up references Macro
' Macro by Spiros Doikas - see https://www.translatum.gr/forum/index.php?topic=171118.0
'
With Selection.Find
  .Text = "[citation needed]"
  .Replacement.Text = ""
  .Forward = True
  .Wrap = wdFindContinue
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
  .Execute Replace:=wdReplaceAll
  .Text = "[^#]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll
  .Text = "[^#^#]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll
  .Text = "[edit]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll
  .Text = "[Επεξεργασία]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll
  .Text = "[εκκρεμεί παραπομπή]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll

  End With
    
  End Sub

See also: How to install a macro in Word
« Last Edit: 17 Jun, 2011, 16:55:05 by spiros »


 

Templates: 5: index (citiez_20a), Ads (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 10: init, html_above, adsheaders_above, body_above, adsindex_above, main, adsindex_below, body_below, adsheaders_below, html_below.
Language files: 7: index+Modifications.english (citiez_20a), ThemeStrings.english (citiez_20a), Ads.english (citiez_20a), Post.english (citiez_20a), BadBehavior_bbc.english (citiez_20a), ShareThis.english (citiez_20a), TopicRenamer/.english (citiez_20a).
Style sheets: 2: editor (default), pagination (default).
Files included: 46 - 1124KB. (show)
Cache hits: 15: 0.00580s for 39163 bytes (show)
Queries used: 31.

[Show Queries]