@@ -345,15 +345,15 @@ def generate_citation(bibtex_record)
345345 publication_type = PublicationType . find ( self . publication_type_id )
346346
347347 case publication_type . key
348- when ' journalarticle'
348+ when publication_type . journalarticle?
349349 self . citation += self . journal . nil? ? '' :self . journal
350350 self . citation += volume . blank? ? '' : " #{ volume } "
351351 self . citation += number . nil? ? '' : "(#{ number } )"
352352 self . citation += pages . blank? ? '' : ( ":#{ pages } " )
353- when ' booklet'
353+ when publication_type . booklet?
354354 self . citation += howpublished . blank? ? '' : "#{ howpublished } "
355355 self . citation += address . nil? ? '' : ( ", #{ address } " )
356- when ' bookchapter'
356+ when publication_type . bookchapter?
357357 self . citation += self . booktitle . nil? ? '' : ( "In #{ self . booktitle } " )
358358 self . citation += volume . blank? ? '' : ( ", volume #{ volume } " )
359359 self . citation += series . blank? ? '' : ( " of #{ series } " )
@@ -363,7 +363,7 @@ def generate_citation(bibtex_record)
363363 unless address . nil? || ( self . booktitle . try ( :include? , address ) )
364364 self . citation += address . nil? ? '' : ( ", #{ address } " )
365365 end
366- when ' conferencepaper' , ' collection' , ' book'
366+ when publication_type . conferencepaper? , publication_type . collection? , publication_type . book?
367367 # InProceedings / InCollection
368368 self . citation += self . booktitle . nil? ? '' : ( "In #{ self . booktitle } " )
369369 self . citation += volume . blank? ? '' : ( ", vol. #{ volume } " )
@@ -374,25 +374,25 @@ def generate_citation(bibtex_record)
374374 unless address . nil? || ( self . booktitle . try ( :include? , address ) )
375375 self . citation += address . nil? ? '' : ( ", #{ address } " )
376376 end
377- when 'bachelorsthesis' , 'mastersthesis' , 'phdthesis'
377+ when publication_type . dissertation?
378378 #PhD/Master Thesis
379379 self . citation += school . nil? ? '' : ( " #{ school } " )
380380 self . errors . add ( :base , 'A thesis need to have a school' ) if school . nil?
381381 self . citation += year . nil? ? '' : ( ", #{ year } " )
382382 self . citation += tutor . nil? ? '' : ( ", #{ tutor } (Tutor)" )
383383 self . citation += tutorhits . nil? ? '' : ( ", #{ tutorhits } (HITS Tutor)" )
384384 self . citation += url . nil? ? '' : ( ", #{ url } " )
385- when ' conferenceproceeding'
385+ when publication_type . conferenceproceeding?
386386 # Proceedings are conference proceedings, it has no authors but editors
387387 # Book
388388 self . journal = self . title
389389 self . citation += volume . blank? ? '' : ( "vol. #{ volume } " )
390390 self . citation += series . blank? ? '' : ( " of #{ series } " )
391391 self . citation += self . publisher . blank? ? '' : ( ", #{ self . publisher } " )
392- when ' report'
392+ when publication_type . report?
393393 self . citation += institution . blank? ? ' ' : institution
394394 self . citation += type . blank? ? ' ' : ( ", #{ type } " )
395- when ' preprint'
395+ when publication_type . preprint?
396396 self . citation += note . blank? ? ' ' : note
397397 end
398398
@@ -594,21 +594,21 @@ def check_bibtex_file (bibtex_record)
594594 return false
595595 end
596596
597- if ( [ 'Collection' , 'Conference Paper' ] . include? self . publication_type . title ) && ( bibtex_record [ :booktitle ] . blank? )
597+ if ( publication_type . collection? || publication_type . conferencepaper? ) && bibtex_record [ :booktitle ] . blank?
598598 errors . add ( :base , "A #{ self . publication_type . title } needs to have a booktitle." )
599599 return false
600600 end
601601
602- unless [ 'Booklet' , 'Text' , 'Other' , 'Conference Proceeding' ] . include? self . publication_type . title
602+ unless publication_type . booklet? || publication_type . text? || publication_type . other? || publication_type . conferenceproceeding?
603603 if bibtex_record [ :author ] . nil? && self . editor . nil?
604604 self . errors . add ( :base , "You need at least one author or editor for the #{ self . publication_type . title } ." )
605605 return false
606606 end
607607 end
608608
609- if [ 'bachelorsthesis' , 'mastersthesis' , 'phdthesis' , 'diplomthesis' ] . include? ( publication_type . key )
609+ if publication_type . dissertation?
610610 if bibtex_record [ :school ] . try ( :to_s ) . nil?
611- self . errors . add ( :base , "A #{ self . publication_type . title } needs to have a school." )
611+ self . errors . add ( :base , "A #{ publication_type . title } needs to have a school." )
612612 return false
613613 end
614614 end
0 commit comments