This repository has been archived by the owner on Oct 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathitalicize.R
35 lines (33 loc) · 2.1 KB
/
italicize.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Italicize <- function (string) {
string <- gsub(paste0("\\b(",
paste0(gsub("_", "|", fixed = TRUE,
c(taxa_names,
'Bactrotheca', 'Bethia', 'Bowerbankia',
'Calloria',
'Disoma', 'Discinisca',
'Eichwaldia', 'Electra', 'Enchytraeus',
'Equisetum', 'Eoorthis', 'Fredericella',
'Galeolaria', 'Glottidia', 'Gompholites',
'Gryphus',
'Hadrotreta', 'Harmothoe', 'Hydroides',
'Hyolithes',
'Ischnochiton', 'Kraussina', 'Lingulella',
'Lochkothele', 'Loxosoma', 'Loxosomatoides',
'Magelona', 'Membranipora', 'Mopalia',
'Nereis', 'Neocrania', 'Notosaria',
'Neoancistrocrania', 'Oikozetetes',
'Paracraniops', 'Paramicrocornus',
'Phascolion', 'Phoronopsis', 'Recilites',
'Scolelepis',
'Terebratalia', 'Themiste', 'Tubulipora',
'atkinsae', 'comleyensis', 'cyrene', 'decaius',
'deleta', 'minuta', 'murmanica',
'schucherti', 'tenuis', 'worsleyi',
'vascula', 'genitalia','lateralia',
'media', 'myaria', 'terminalia',
'levator ani',
'et al\\.', 'et al', 'sensu')),
collapse='|'),
")\\b"), "_\\1_", string, perl=TRUE, ignore.case=FALSE)
gsub("\\b([A-Z]\\.) _([a-z])", "_\\1 \\2", string, perl=TRUE)
}