Class: MathMetadata::NUMDAM

Inherits:
Site
  • Object
show all
Defined in:
lib/math_metadata_lookup/sites/numdam.rb

Overview

NUMDAM numdam.org/

Constant Summary collapse

ID =
:numdam
NAME =
"NUMDAM"
URL =
"http://numdam.org/"
AUTHOR_URL =

AUTHOR_URL % “Author, Name”

%~~
AUTHORS_RE =
%r{}mi
AUTHOR_RE =
%r{}mi
ARTICLE_ID_URL =
"http://www.numdam.org/numdam-bin/item?id=%s"
ARTICLE_URL =
"http://www.numdam.org/numdam-bin/search?bibitems.au_op=and&bibitems.text_op=and&ti=%s&au=%s&ti_op=and&Index1.y=0&Index1.x=0&bibitems.ti_op=and&au_op=and&py1=%s"
LIST_OF_ARTICLES_RE =
%r{<P>\s*<DIV\s+align="center">.*?</DIV>\s*</P>\s*(.*?)\s*<P>\s*<DIV\s+align="center">.*?</DIV>\s*</P>}mi
ARTICLE_ENTRY_RE =
%r{<a href="http://www.numdam.org:80/numdam-bin/item\?id=([^"]+)">Full entry</a>}mi
ARTICLE_ID_RE =
%r{<P>stable URL: http://www.numdam.org/item\?id=([^<]+)</P>}mi
ARTICLE_TITLE_RE =
%r{<SPAN class="atitle">(.*?)</SPAN>}mi
ARTICLE_LANGUAGE_RE =
%r{xxxxxxxxxxxxxxx}mi
ARTICLE_AUTHORS_RE =
%r{<head>\s*(.*?)\s*</head>}mi
ARTICLE_AUTHOR_RE =
%r{<meta content="([^"]+)" name="DC.creator">}mi
ARTICLE_MSCS_RE =
%r{Class\. Math\.:\s*(.*?)\s*<br>}mi
ARTICLE_MSC_RE =
%r{([^,]+)(?:,\s*)?}mi
ARTICLE_PUBLICATION_RE =
%r{<SPAN class="jtitle">(.*?)</SPAN>}mi
ARTICLE_PUBLISHER_RE =
%r{xxxxxxxxxxxxxxxxx}mi
ARTICLE_RANGE_RE =
%r{(\d+\-\d+)\s*<BR>\s*Full text}mi
ARTICLE_YEAR_RE =
%r{py=(\d+)}mi
ARTICLE_ISSNS_RE =
%r{xxxxxxxxxxxxxxxxx}mi
ARTICLE_ISSN_RE =
%r{xxxxxxxxxxxxxxxxx}mi
ARTICLE_KEYWORDS_RE =
%r{xxxxxxxxxxxxxxxxx}mi
ARTICLE_KEYWORD_RE =
%r{xxxxxxxxxxxxxxxxx}mi
ARTICLE_REFERENCES_RE =
%r{<P>\s*<B>\s*Bibliography\s*</B>\s*</P>\s*</DIV>\s*(.*?\s*</td>)}mi
ARTICLE_REFERENCE_RE =
%r{\[\d+\](.*?)(?:<BR>|</td>)}mi

Instance Method Summary collapse

Methods inherited from Site

#article, #author, inherited, #initialize, #to_json

Constructor Details

This class inherits a constructor from MathMetadata::Site

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MathMetadata::Site

Instance Method Details

#get_article_references(page) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/math_metadata_lookup/sites/numdam.rb', line 47

def get_article_references( page )
  references = []

  refs = get_article_reference_s page

  i = 0;
  refs.each do |r|
    i+=1
    ref = Reference.new nil, i
    ref.source = r.gsub(/  +/,' ')
    ref.article = Article.new

    r =~ %r{<span class="atitle">(.*?)</span>}im
    ref.article.title = $1.to_s.strip

    ref.article.authors = []
    r.split(%r{<span class="bauteur">\s?(.*?)\s*</span>}).each do |a|
      a.strip!
      next if a.empty? or a.== "-" or [',', '&'].include?(a[0,1]) or a.downcase=='and'
      author = a.gsub /<.*?>/, ''
      ref.article.authors << author
    end

    r =~ %r{<span class="brevue">(.*?)</span>}mi
    ref.article.publication = $1.strip if $1

    r =~ %r{<bediteur>(.*?)</bediteur>}mi
    ref.article.publisher = $1.strip if $1

    r =~ %r{<blieued>(.*?)</blieued>}mi
    ref.article.place = $1.strip if $1

    r =~ %r{<bannee>(.*?)</bannee>}mi
    ref.article.year = $1.strip if $1

    r =~ %r{<bpagedeb>(\d+)</bpagedeb>-<bpagefin>(\d+)</bpagefin>}mi
    ref.article.range = "#{$1.strip}-#{$2.strip}" if $1

    references << ref
  end

  references
end