src/Pure/Thy/bibtex.scala
changeset 70230 8ba266889dee
parent 69367 34b7550b66c7
child 72193 742d94015918
equal deleted inserted replaced
70229:c03f381fd373 70230:8ba266889dee
   238     kind: String,
   238     kind: String,
   239     required: List[String],
   239     required: List[String],
   240     optional_crossref: List[String],
   240     optional_crossref: List[String],
   241     optional_other: List[String])
   241     optional_other: List[String])
   242   {
   242   {
       
   243     val optional_standard: List[String] = List("url", "doi", "ee")
       
   244 
   243     def is_required(s: String): Boolean = required.contains(s.toLowerCase)
   245     def is_required(s: String): Boolean = required.contains(s.toLowerCase)
   244     def is_optional(s: String): Boolean =
   246     def is_optional(s: String): Boolean =
   245       optional_crossref.contains(s.toLowerCase) || optional_other.contains(s.toLowerCase)
   247       optional_crossref.contains(s.toLowerCase) ||
   246 
   248       optional_other.contains(s.toLowerCase) ||
   247     def fields: List[String] = required ::: optional_crossref ::: optional_other
   249       optional_standard.contains(s.toLowerCase)
       
   250 
       
   251     def fields: List[String] =
       
   252       required ::: optional_crossref ::: optional_other ::: optional_standard
       
   253 
   248     def template: String =
   254     def template: String =
   249       "@" + kind + "{,\n" + fields.map(x => "  " + x + " = {},\n").mkString + "}\n"
   255       "@" + kind + "{,\n" + fields.map(x => "  " + x + " = {},\n").mkString + "}\n"
   250   }
   256   }
   251 
   257 
   252   val known_entries: List[Entry] =
   258   val known_entries: List[Entry] =