Revision 385:a6f8c0584a92 vendor/plugins/redmine_bibliography/app/controllers

View differences:

vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
1
# vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
2

  
1 3
class PublicationsController < ApplicationController
2 4

  
5
  # parse string with bibtex authors
6
  # return an ordered array
7
  def parse_authors
8
    
9
  end
10

  
11
  def parse_bibtex_file
12
  
13
  end
14

  
3 15
  def parse_bibtex_text
4

  
5
    logger.error "BBBBBBBB"
6

  
7 16
    bibtex_entry = params[:bibtex_entry]
8 17

  
18
    if bibtex_entry
19
      bib = BibTeX.parse bibtex_entry
20
      
21
      # parses the bibtex entries
22
      bib.data.map do |d|
23
        result = ''
24
        if d.class == BibTeX::Entry
25
          #    d.replace!(bib.strings)
26
          result = [d.author, '. ', d.title].join
27
        end
9 28

  
10

  
11

  
12
    #    logger.error bibtex_entry
13

  
14
    if bibtex_entry
15
      Bibtex::Parser.parse_string(bibtex_entry).map do |entry|
16
        logger.error entry[:title]
17
        logger.error entry[:year]
18
        logger.error entry.type  
29
        logger.error result
19 30
      end
20 31
    end
21

  
22
    logger.error "FIM"
23

  
24 32
  end 
25 33

  
26
  def new
27

  
28
    logger.error "AAAAAA"
29

  
30
    logger.error request.request_method
34
  def new 
35
    session[:publication_params] ||= {}
36
    @publication = Publication.new
31 37

  
32 38
    if request.post?
33 39
      parse_bibtex_text

Also available in: Unified diff