prct11 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +8 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +5 -0
- data/Guardfile +88 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +5 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/doc/APA.html +377 -0
- data/doc/Book.html +296 -0
- data/doc/CODE_OF_CONDUCT_md.html +125 -0
- data/doc/DSL.html +153 -0
- data/doc/DSLBook.html +278 -0
- data/doc/DSLJournal.html +281 -0
- data/doc/Electronicdocument.html +211 -0
- data/doc/Gemfile.html +99 -0
- data/doc/Gemfile_lock.html +221 -0
- data/doc/Guardfile.html +186 -0
- data/doc/JournalArticle.html +301 -0
- data/doc/LICENSE_txt.html +117 -0
- data/doc/LinkedList.html +588 -0
- data/doc/MagazineArticle.html +301 -0
- data/doc/Object.html +126 -0
- data/doc/Prct11.html +109 -0
- data/doc/README_md.html +164 -0
- data/doc/Rakefile.html +99 -0
- data/doc/Reference.html +303 -0
- data/doc/Regularpublications.html +158 -0
- data/doc/bin/setup.html +101 -0
- data/doc/created.rid +35 -0
- data/doc/css/fonts.css +167 -0
- data/doc/css/rdoc.css +590 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +129 -0
- data/doc/js/darkfish.js +161 -0
- data/doc/js/jquery.js +4 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +228 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/prct11_gemspec.html +136 -0
- data/doc/table_of_contents.html +301 -0
- data/lib/prct11.rb +13 -0
- data/lib/prct11/APA.rb +153 -0
- data/lib/prct11/DSL.rb +78 -0
- data/lib/prct11/book.rb +37 -0
- data/lib/prct11/electronicdocument.rb +20 -0
- data/lib/prct11/journalarticle.rb +42 -0
- data/lib/prct11/linkedList.rb +96 -0
- data/lib/prct11/magazinearticle.rb +42 -0
- data/lib/prct11/prueba.rb +42 -0
- data/lib/prct11/reference.rb +33 -0
- data/lib/prct11/regularpublications.rb +6 -0
- data/lib/prct11/version.rb +3 -0
- data/prct11.gemspec +40 -0
- metadata +263 -0
data/lib/prct11/DSL.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# article = Article.new("Ejemplo") do
|
2
|
+
# author :surname => "Apellido,
|
3
|
+
# :name => "Nombre"
|
4
|
+
# journal :name => "Titulo de la revista",
|
5
|
+
# :volume => 20,
|
6
|
+
# :issue => 3
|
7
|
+
# title "Titulo"
|
8
|
+
# abstract "Resumen"
|
9
|
+
# end
|
10
|
+
|
11
|
+
require "prct11/book"
|
12
|
+
require "prct11/journalarticle"
|
13
|
+
|
14
|
+
class DSLBook < Book
|
15
|
+
|
16
|
+
def initialize(&block)
|
17
|
+
self.title = []
|
18
|
+
self.editorial = []
|
19
|
+
self.edition = []
|
20
|
+
self.date = []
|
21
|
+
self.isbn =[]
|
22
|
+
self.authors = []
|
23
|
+
self.volume = []
|
24
|
+
instance_eval(&block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def title(title)
|
28
|
+
self.title = title
|
29
|
+
end
|
30
|
+
|
31
|
+
def author(author)
|
32
|
+
self.authors = author
|
33
|
+
end
|
34
|
+
|
35
|
+
def book (datos = {})
|
36
|
+
self.title = datos[:nombre]
|
37
|
+
self.editorial = datos[:editorial]
|
38
|
+
self.edition = datos[:edicion]
|
39
|
+
self.date = datos[:fecha]
|
40
|
+
self.isbn = datos[:isbn]
|
41
|
+
self.volume = datos[:volumen]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
class DSLJournal < JournalArticle
|
47
|
+
|
48
|
+
def initialize(&block)
|
49
|
+
self.title = []
|
50
|
+
self.date = []
|
51
|
+
self.number = []
|
52
|
+
self.volume = []
|
53
|
+
self.initpage =[]
|
54
|
+
self.finalpage = []
|
55
|
+
self.authors = []
|
56
|
+
self.title = ""
|
57
|
+
self.journal = []
|
58
|
+
instance_eval(&block)
|
59
|
+
end
|
60
|
+
|
61
|
+
def title_(titles)
|
62
|
+
self.title = titles
|
63
|
+
end
|
64
|
+
|
65
|
+
def author(author)
|
66
|
+
self.authors = author
|
67
|
+
end
|
68
|
+
|
69
|
+
def journalarticle (datos = {})
|
70
|
+
self.title = datos[:nombre]
|
71
|
+
self.journal = datos[:periodico]
|
72
|
+
self.date = datos[:fecha]
|
73
|
+
self.number = datos[:numero]
|
74
|
+
self.volume = datos[:volumen]
|
75
|
+
self.initpage = datos[:paginicio]
|
76
|
+
self.finalpage = datos[:pagfinal]
|
77
|
+
end
|
78
|
+
end
|
data/lib/prct11/book.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
class Book < Reference
|
3
|
+
|
4
|
+
attr_accessor :volume, :editorial, :edition, :isbn, :authors
|
5
|
+
|
6
|
+
def initialize(title,editorial,edition,date,isbn,authors, volume)
|
7
|
+
super(authors,title,date)
|
8
|
+
@authors = authors
|
9
|
+
@volume = volume
|
10
|
+
@editorial = editorial
|
11
|
+
@edition = edition
|
12
|
+
|
13
|
+
self.isbn = []
|
14
|
+
isbn.each do |numeros|
|
15
|
+
@isbn.push(numeros)
|
16
|
+
end
|
17
|
+
return self
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
text=""
|
22
|
+
|
23
|
+
for i in (0..@authors.size-2)
|
24
|
+
text << "#{authors[i]} , "
|
25
|
+
end
|
26
|
+
text << "#{authors[authors.size-1]}."
|
27
|
+
text << "\n#{@title}."
|
28
|
+
text << "\n#{@volume}."
|
29
|
+
text << "\n#{@editorial}; #{@edition} Edition (#{@date})."
|
30
|
+
for i in (0..@isbn.size-1)
|
31
|
+
text << "\nISBN #{@isbn[i].length}: #{@isbn[i]}."
|
32
|
+
end
|
33
|
+
text
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Electronicdocument < Regularpublications
|
2
|
+
|
3
|
+
def initialize(authors, title, date, url)
|
4
|
+
super(authors, title, date)
|
5
|
+
@url = url
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_s()
|
9
|
+
string = ""
|
10
|
+
for i in (0..@authors.size-1)
|
11
|
+
string += "#{authors[i]}"
|
12
|
+
if (i != @authors.size-1)
|
13
|
+
string += ", "
|
14
|
+
end
|
15
|
+
end
|
16
|
+
string += " (" + date + ").\n"
|
17
|
+
string += title
|
18
|
+
string += ".\nDisponible en " + @url
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Formato de artículo del periódico:
|
2
|
+
# Autor/es
|
3
|
+
# Título del artículo.
|
4
|
+
# Título del periódico, [Volumen] (número), fecha
|
5
|
+
|
6
|
+
|
7
|
+
class JournalArticle < Regularpublications
|
8
|
+
|
9
|
+
attr_accessor :journal, :volume, :number, :initpage, :finalpage
|
10
|
+
|
11
|
+
def initialize(authorsJournal, titleJournal, dateJournal, journal, number, volumen=nil, initpage, finalpage)
|
12
|
+
super(authorsJournal, titleJournal, dateJournal)
|
13
|
+
|
14
|
+
@journal = journal
|
15
|
+
@volume = volume
|
16
|
+
@number = number
|
17
|
+
@initpage = initpage
|
18
|
+
@finalpage = finalpage
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
string = ""
|
23
|
+
for i in (0..@authors.size-1)
|
24
|
+
string += "#{authors[i]}"
|
25
|
+
if (i != @authors.size-1)
|
26
|
+
string += ", "
|
27
|
+
end
|
28
|
+
end
|
29
|
+
string +="\n"
|
30
|
+
string += title
|
31
|
+
string += ".\n"
|
32
|
+
string += @journal
|
33
|
+
string += ", "
|
34
|
+
if(!@volume.nil?)
|
35
|
+
string += @volume.to_s
|
36
|
+
string += " "
|
37
|
+
end
|
38
|
+
string += "(" + @number.to_s + ")"
|
39
|
+
string += ", " + date
|
40
|
+
string += "."
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
|
2
|
+
class LinkedList
|
3
|
+
include Enumerable
|
4
|
+
attr_accessor :node
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@Node = Struct.new(:value, :next, :prev)
|
8
|
+
@head = nil
|
9
|
+
@tail = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def insert_by_begin(value)
|
13
|
+
if @head.nil?
|
14
|
+
@head = @Node.new(value, nil, nil)
|
15
|
+
@tail = @head
|
16
|
+
else
|
17
|
+
@head[:prev] = @Node.new(value, @head, nil)
|
18
|
+
@head = @head[:prev]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def insert_by_end(value)
|
23
|
+
if @head.nil?
|
24
|
+
@head = @Node.new(value, nil, nil)
|
25
|
+
@tail = @head
|
26
|
+
else
|
27
|
+
@tail[:next] = @Node.new(value, nil, @tail)
|
28
|
+
@tail = @tail[:next]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def extract_by_begin()
|
33
|
+
if @head.nil?
|
34
|
+
raise RuntimeError, "List is empty, you can't extract a node"
|
35
|
+
else
|
36
|
+
if @head == @tail
|
37
|
+
@head, @tail = nil
|
38
|
+
else
|
39
|
+
@head = @head[:next]
|
40
|
+
@head[:prev] = nil
|
41
|
+
end
|
42
|
+
@head[:value]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def extract_by_end()
|
47
|
+
if @head.nil?
|
48
|
+
raise RuntimeError, "List is empty, you can't extract a node"
|
49
|
+
else
|
50
|
+
if @head == @tail
|
51
|
+
@head, @tail = nil
|
52
|
+
else
|
53
|
+
@tail = @tail[:prev]
|
54
|
+
@tail[:next] = nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def get_value
|
60
|
+
return @head[:value]
|
61
|
+
end
|
62
|
+
|
63
|
+
def get_next
|
64
|
+
return @head[:next]
|
65
|
+
end
|
66
|
+
|
67
|
+
def get_prev
|
68
|
+
return @head[:prev]
|
69
|
+
end
|
70
|
+
|
71
|
+
def size
|
72
|
+
size = 0
|
73
|
+
iterator = @head
|
74
|
+
while (!iterator.nil?)
|
75
|
+
iterator = iterator[:next]
|
76
|
+
size+=1
|
77
|
+
end
|
78
|
+
return size
|
79
|
+
end
|
80
|
+
|
81
|
+
def insert_set(others)
|
82
|
+
for i in (0.. others.size-1)
|
83
|
+
insert_by_end(others[i])
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def each
|
88
|
+
iterator = @head
|
89
|
+
while !iterator.nil?
|
90
|
+
yield iterator[:value]
|
91
|
+
iterator = iterator[:next]
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Formato de artículo de la revista:
|
2
|
+
# Autor/es
|
3
|
+
# Título del artículo.
|
4
|
+
# Título de la revista, [Volumen] (número), fecha
|
5
|
+
|
6
|
+
|
7
|
+
class MagazineArticle < Regularpublications
|
8
|
+
|
9
|
+
attr_accessor :magazine, :volume, :number, :initpage, :finalpage
|
10
|
+
|
11
|
+
def initialize(authorsMagazine, titleMagazine, dateMagazine, magazine, number, volumen=nil, initpage, finalpage)
|
12
|
+
super(authorsMagazine, titleMagazine, dateMagazine)
|
13
|
+
|
14
|
+
@magazine = magazine
|
15
|
+
@volume = volume
|
16
|
+
@number = number
|
17
|
+
@initpage = initpage
|
18
|
+
@finalpage = finalpage
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
string = ""
|
23
|
+
for i in (0..@authors.size-1)
|
24
|
+
string += "#{authors[i]}"
|
25
|
+
if (i != @authors.size-1)
|
26
|
+
string += ", "
|
27
|
+
end
|
28
|
+
end
|
29
|
+
string +="\n"
|
30
|
+
string += title
|
31
|
+
string += ".\n"
|
32
|
+
string += @magazine
|
33
|
+
string += ", "
|
34
|
+
if(!@volume.nil?)
|
35
|
+
string += @volume.to_s
|
36
|
+
string += " "
|
37
|
+
end
|
38
|
+
string += "(" + @number.to_s + ")"
|
39
|
+
string += ", " + date
|
40
|
+
string += "."
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class DSL
|
2
|
+
def self.Book(&block)
|
3
|
+
DSLBook.new(block)
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
class DSLBook < Book
|
8
|
+
def initialize(block)
|
9
|
+
|
10
|
+
instance_eval(&block)
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def author(author)
|
15
|
+
@author = author
|
16
|
+
end
|
17
|
+
|
18
|
+
def book(book)
|
19
|
+
@book = book
|
20
|
+
end
|
21
|
+
|
22
|
+
def title(title)
|
23
|
+
@title = title
|
24
|
+
end
|
25
|
+
end
|
26
|
+
# article = Article.new("Ejemplo") do
|
27
|
+
# author :surname => "Apellido,
|
28
|
+
# :name => "Nombre"
|
29
|
+
# journal :name => "Titulo de la revista",
|
30
|
+
# :volume => 20,
|
31
|
+
# :issue => 3
|
32
|
+
# title "Titulo"
|
33
|
+
# abstract "Resumen"
|
34
|
+
# end
|
35
|
+
DSL = DSL.Book do
|
36
|
+
author :name => "Nombre"
|
37
|
+
book :name => "Titulo de la revista",
|
38
|
+
:volume => 20
|
39
|
+
title "Titulo"
|
40
|
+
end
|
41
|
+
|
42
|
+
p DSL
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Reference
|
2
|
+
include Comparable
|
3
|
+
attr_accessor :title, :date, :authors
|
4
|
+
|
5
|
+
|
6
|
+
def initialize(authors, title, date)
|
7
|
+
self.authors = []
|
8
|
+
authors.each do |palabras|
|
9
|
+
@authors.push(palabras)
|
10
|
+
end
|
11
|
+
@title = title
|
12
|
+
@date = date
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_title
|
16
|
+
@title
|
17
|
+
end
|
18
|
+
|
19
|
+
def <=>(other)
|
20
|
+
return nil unless other.is_a? Reference
|
21
|
+
if authors == other.authors then
|
22
|
+
if date == other.date
|
23
|
+
title <=> other.title
|
24
|
+
else
|
25
|
+
date <=> other.date
|
26
|
+
end
|
27
|
+
else
|
28
|
+
authors <=> other.authors
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
data/prct11.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'prct11/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "prct11"
|
8
|
+
spec.version = Prct11::VERSION
|
9
|
+
spec.authors = ["Germán Méndez"]
|
10
|
+
spec.email = ["gcpmendez@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{DSL of Bibliography}
|
13
|
+
spec.description = %q{Lenguaje de dominio especifico de una Biblioteca de libros (revistas, periodicos, libros,...)}
|
14
|
+
spec.homepage = "https://github.com/gcpmendez/prct11"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 2.11"
|
33
|
+
spec.add_development_dependency "guard"
|
34
|
+
spec.add_development_dependency "guard-rspec"
|
35
|
+
spec.add_development_dependency "guard-bundler"
|
36
|
+
spec.add_development_dependency "coveralls"
|
37
|
+
spec.add_development_dependency "sourcify"
|
38
|
+
spec.add_development_dependency "ruby2ruby"
|
39
|
+
|
40
|
+
end
|