src/Tools/jEdit/src/document_model.scala
changeset 76778 4086a0e4723b
parent 76777 7cf938666641
child 76781 d9f48960bf23
equal deleted inserted replaced
76777:7cf938666641 76778:4086a0e4723b
   289   /* file content */
   289   /* file content */
   290 
   290 
   291   sealed case class File_Content(text: String) {
   291   sealed case class File_Content(text: String) {
   292     lazy val bytes: Bytes = Bytes(Symbol.encode(text))
   292     lazy val bytes: Bytes = Bytes(Symbol.encode(text))
   293     lazy val chunk: Symbol.Text_Chunk = Symbol.Text_Chunk(text)
   293     lazy val chunk: Symbol.Text_Chunk = Symbol.Text_Chunk(text)
   294     lazy val bibtex_entries: Bibtex.Entries = Bibtex.Entries.try_parse(text)
   294     lazy val bibtex_entries: Bibtex.Entries = Bibtex.Entries.parse(text)
   295   }
   295   }
   296 
   296 
   297 
   297 
   298   /* HTTP preview */
   298   /* HTTP preview */
   299 
   299 
   593 
   593 
   594     def get_bibtex_entries: Bibtex.Entries = GUI_Thread.require {
   594     def get_bibtex_entries: Bibtex.Entries = GUI_Thread.require {
   595       if (File.is_bib(node_name.node)) {
   595       if (File.is_bib(node_name.node)) {
   596         bibtex_entries getOrElse {
   596         bibtex_entries getOrElse {
   597           val text = JEdit_Lib.buffer_text(buffer)
   597           val text = JEdit_Lib.buffer_text(buffer)
   598           val entries =
   598           val entries = Bibtex.Entries.parse(text)
   599             try { Bibtex.Entries.parse(text) }
   599           if (entries.errors.nonEmpty) Output.warning(cat_lines(entries.errors))
   600             catch { case ERROR(msg) => Output.warning(msg); Bibtex.Entries.empty }
       
   601           bibtex_entries = Some(entries)
   600           bibtex_entries = Some(entries)
   602           entries
   601           entries
   603         }
   602         }
   604       }
   603       }
   605       else Bibtex.Entries.empty
   604       else Bibtex.Entries.empty