Project

General

Profile

« Previous | Next » 

Revision 6684

dict2redmine: RedmineDictWriter: Link citations to entry in sources list

View differences:

bin/dict2redmine
36 36

  
37 37
##### Redmine
38 38

  
39
sp = ' ' # Unicode thin space
40

  
39 41
def redmine_bold(text): return '*'+text+'*'
40 42

  
41 43
def redmine_url(text, url):
......
46 48
    if url: return redmine_url(url_term(url), simplify_url(url))
47 49
    else: return ''
48 50

  
51
def redmine_add_links(page_name, text):
52
    # Link citations to entry in sources list
53
    text = re.sub(r'(?<=\[)(.*?)(?=\])', sp+'[['+page_name+r'#\g<0>]]'+sp, text)
54
        # sp prevents [[[, which Redmine would parse incorrectly
55
    return text
56

  
49 57
class RedmineTableWriter:
50 58
    '''Formats rows as a Redmine table'''
51 59
    
......
62 70
        self.term_col = term_col
63 71
        self.def_col = def_col
64 72
        self.header = header
73
        self.page_name = header[term_col]
65 74
        self.stream = stream
66 75
    
67 76
    def writerow(self, row):
77
        row = map(lambda f: redmine_add_links(self.page_name, f), row)
78
        
68 79
        term = row[self.term_col]
69 80
        def_ = row[self.def_col]
70 81
        self.stream.write('h3. '+term+'\n\n')
mappings/VegCore.redmine
4 4

  
5 5
h3. "dcterms:modified":http://rs.tdwg.org/dwc/terms/#dcterms:modified
6 6

  
7
I think is this merely an internal timestamp indicated when record last modified, not necessarily when determination (taxon name) last modified [Brad Boyle]
7
I think is this merely an internal timestamp indicated when record last modified, not necessarily when determination (taxon name) last modified [&#x2009;[[VegCore#Brad Boyle]]&#x2009;]
8 8

  
9 9
|*Sources*|"DwC:dcterms:modified":http://rs.tdwg.org/dwc/terms/#dcterms:modified|
10 10

  
......
602 602

  
603 603
h3. "typeStatus":http://rs.tdwg.org/dwc/terms/#typeStatus
604 604

  
605
Indicates whether this specimen served as type for taxon name [Brad Boyle]
605
Indicates whether this specimen served as type for taxon name [&#x2009;[[VegCore#Brad Boyle]]&#x2009;]
606 606

  
607 607
|*Sources*|"DwC:typeStatus":http://rs.tdwg.org/dwc/terms/#typeStatus|
608 608

  
......
1023 1023

  
1024 1024
h3. "accordingTo":http://www.tdwg.org/standards/117/download/#/v101.xsd#/TaxonConcepts/TaxonConcept/AccordingTo
1025 1025

  
1026
Information about the authorship of this concept which uses the Name in their sense (i.e. secundum, sensu) [TCS]
1026
Information about the authorship of this concept which uses the Name in their sense (i.e. secundum, sensu) [&#x2009;[[VegCore#TCS]]&#x2009;]
1027 1027

  
1028 1028
|*Sources*|"TCS:AccordingTo":http://www.tdwg.org/standards/117/download/#/v101.xsd#/TaxonConcepts/TaxonConcept/AccordingTo|
1029 1029

  

Also available in: Unified diff