Project

General

Profile

« Previous | Next » 

Revision 6627

dict2redmine: Added Definition column

View differences:

dict2redmine
38 38

  
39 39

  
40 40
def main():
41
    try: _prog_name, term_col, sources_col = sys.argv
41
    try: _prog_name, term_col, sources_col, def_col = sys.argv
42 42
    except ValueError: raise SystemExit('Usage: '+sys.argv[0]
43
        +' <spreadsheet term_col# sources_col# >redmine')
44
    term_col, sources_col = map(int, [term_col, sources_col])
43
        +' <spreadsheet term_col# sources_col# def_col# >redmine')
44
    term_col, sources_col, def_col = map(int, [term_col, sources_col, def_col])
45 45
    
46 46
    # Determine column order
47 47
    reader = csv.reader(sys.stdin)
......
49 49
    
50 50
    # Translate input
51 51
    writer = RedmineTableWriter(sys.stdout)
52
    writer.writerow(['*Term*', '*Sources*'])
52
    writer.writerow(['*Term*', '*Sources*', '*Definition*'])
53 53
    for row in reader:
54 54
        term = row[term_col]
55 55
        sources = map(simplify_url, row[sources_col].split(source_sep))
56 56
        sources_str = source_sep.join(map(source2redmine_url, sources))
57
        def_ = row[def_col]
57 58
        
58
        writer.writerow([redmine_url(term, sources[0]), sources_str])
59
        writer.writerow([redmine_url(term, sources[0]), sources_str, def_])
59 60

  
60 61
main()

Also available in: Unified diff