fixes/to_csl.fix
# map fields to csl
copy_field(type, res.type)
set_field(res.type, book)
if any_match(type, 'book_chapter|translation_chapter|encyclopedia_article')
set_field(res.type, chapter)
end
if any_match(type, 'preprint|journal_article|review|patent')
set_field(res.type, article)
end
if any_match(type, 'journal_article')
set_field(res.type, article-journal)
end
if any_match(type, 'newspaper_article')
set_field(res.type, article-newspaper)
end
if any_match(type, 'conference_abstract|^conference$')
set_field(res.type, paper-conference)
if exists(series_title)
unless exists(publication)
set_field(res.type, article)
end
end
end
# language
move_field(language.0.iso, res.language)
lookup(res.language, fixes/lookup/iso_mapping.csv)
move_field(title, res.title)
move_field(alternative_title.0, res.originalTitle)
move_field(publication, res.container-title)
move_field(series_title, res.collection-title)
move_field(publisher, res.publisher)
move_field(volume, res.volume)
move_field(issue, res.issue)
if exists(page_range_number)
if exists(page_range_number.type)
if any_match(page_range_number.type,"article_number")
copy_field(page_range_number.value, article_number)
else
copy_field(page_range_number.value, page)
end
end
end
if any_match(page, '-')
split_field(page, '-')
trim(page.0)
trim(page.1)
copy_field(page.0, res.page-first)
join_field(page, '-')
copy_field(page, res.page)
else
if any_match(type, 'book_chapter|conference_abstract|conference_editor|^conference$|encyclopedia_article|journal_article|review|translation_chapter')
copy_field(page, res.page)
else
copy_field(page, res.number-of-pages)
end
end
move_field(article_number, res.number)
move_field(year, res.sort-year)
#move_field(publication_status, res.status)
#copy_field(res.status, res.publstatus)
add_field(res.tmp_status, '0000')
#copy_field(res.status, res.tmp_status)
copy_field(publication_status, res.tmp_status)
if any_match(res.tmp_status, 'submitted|accepted|inpress|unpublished|draft')
if any_match(res.tmp_status, 'submitted')
set_field(res.issued.date-parts.0.0, 'Submitted')
end
if any_match(res.tmp_status, 'accepted')
set_field(res.issued.date-parts.0.0, 'Accepted')
end
if any_match(res.tmp_status, 'inpress')
set_field(res.issued.date-parts.0.0, 'In Press')
end
if any_match(res.tmp_status, 'unpublished')
set_field(res.issued.date-parts.0.0, 'Unpublished')
end
if any_match(res.tmp_status, 'draft')
set_field(res.issued.date-parts.0.0, 'Draft')
end
else
copy_field(res.sort-year, res.issued.date-parts.0.0)
end
remove_field(res.tmp_status)
if exists(publication_date)
split_field(publication_date, '-')
move_field(publication_date.2, 'res.publication_date.$append')
move_field(publication_date.1, 'res.publication_date.$append')
move_field(publication_date.0, 'res.publication_date.$append')
join_field(res.publication_date, '.')
#move_field(publication_date, res.publication_date)
end
move_field(place, res.publisher-place)
move_field(edition, res.edition)
move_field(conference.name, res.event)
move_field(conference.location, res.event-place)
move_field(doi, res.DOI)
move_field(ipn, res.patentNumber)
move_field(ipc, res.patentClassification)
move_field(author, res.author)
do list(path => res.author)
do identity()
move_field(first_name,given)
move_field(last_name,family)
move_field(full_name,full)
end
end
move_field(translator, res.translator)
do list(path => res.translator)
do identity()
move_field(first_name,given)
move_field(last_name,family)
move_field(full_name,full)
end
end
move_field(editor, res.editor)
do list(path => res.editor)
do identity()
move_field(first_name,given)
move_field(last_name,family)
move_field(full_name,full)
end
end
if exists(corporate_editor)
move_field(corporate_editor.*, 'res.editor.$append.literal')
end
move_field(_id, res.recordid)
retain_field(res)
move_field(res,items.ITEM-1)
add_field(items.ITEM-1.id,'ITEM-1')