bibtex-ruby 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bibtex-ruby might be problematic. Click here for more details.

Files changed (67) hide show
  1. data/Gemfile +6 -1
  2. data/Gemfile.lock +48 -5
  3. data/History.txt +16 -1
  4. data/Manifest +43 -19
  5. data/README.md +178 -167
  6. data/Rakefile +26 -5
  7. data/auto.watchr +6 -0
  8. data/bibtex-ruby.gemspec +8 -5
  9. data/examples/bib2html.rb +28 -18
  10. data/features/bibtex.feature +96 -0
  11. data/features/entries.feature +67 -0
  12. data/features/issues/slash_keys.feature +21 -0
  13. data/features/names.feature +72 -0
  14. data/features/preambles.feature +27 -0
  15. data/features/query.feature +56 -0
  16. data/features/replacement.feature +68 -0
  17. data/features/step_definitions/bibtex_steps.rb +74 -0
  18. data/features/step_definitions/name_steps.rb +13 -0
  19. data/features/strings.feature +52 -0
  20. data/features/support/env.rb +7 -0
  21. data/lib/bibtex.rb +5 -1
  22. data/lib/bibtex/bibliography.rb +218 -95
  23. data/lib/bibtex/bibtex.y +18 -15
  24. data/lib/bibtex/elements.rb +130 -136
  25. data/lib/bibtex/entry.rb +133 -69
  26. data/lib/bibtex/extensions.rb +0 -35
  27. data/lib/bibtex/lexer.rb +9 -9
  28. data/lib/bibtex/name_parser.output +464 -0
  29. data/lib/bibtex/name_parser.rb +490 -0
  30. data/lib/bibtex/names.rb +162 -0
  31. data/lib/bibtex/names.y +196 -0
  32. data/lib/bibtex/parser.output +5 -5
  33. data/lib/bibtex/parser.rb +19 -16
  34. data/lib/bibtex/replaceable.rb +52 -0
  35. data/lib/bibtex/utilities.rb +23 -5
  36. data/lib/bibtex/value.rb +201 -0
  37. data/lib/bibtex/version.rb +1 -1
  38. data/test/benchmark.rb +52 -0
  39. data/test/bibtex/test_bibliography.rb +141 -0
  40. data/test/bibtex/test_elements.rb +40 -0
  41. data/test/bibtex/test_entry.rb +99 -0
  42. data/test/bibtex/test_names.rb +23 -0
  43. data/test/bibtex/test_parser.rb +79 -0
  44. data/test/bibtex/test_string.rb +83 -0
  45. data/test/bibtex/test_utilities.rb +34 -0
  46. data/test/bibtex/test_value.rb +70 -0
  47. data/test/{bib/10_bibdesk.bib → fixtures/bibdesk.bib} +1 -1
  48. data/test/{bib/05_comment.bib → fixtures/comment.bib} +0 -0
  49. data/test/{bib/08_decoret.bib → fixtures/decoret.bib} +0 -0
  50. data/test/{bib/00_empty.bib → fixtures/empty.bib} +0 -0
  51. data/test/{bib/07_entry.bib → fixtures/entry.bib} +0 -0
  52. data/test/{bib/09_errors.bib → fixtures/errors.bib} +0 -0
  53. data/test/{bib/01_no_bibtex.bib → fixtures/no_bibtex.bib} +0 -0
  54. data/test/{bib/06_preamble.bib → fixtures/preamble.bib} +1 -1
  55. data/test/{bib/11_roundtrip.bib → fixtures/roundtrip.bib} +1 -1
  56. data/test/helper.rb +17 -2
  57. data/test/test_bibtex.rb +87 -93
  58. data/test/test_export.rb +18 -22
  59. metadata +85 -30
  60. data/test/bib/02_string.bib +0 -1
  61. data/test/bib/03_string.bib +0 -25
  62. data/test/bib/04_string_replacement.bib +0 -16
  63. data/test/test_comment.rb +0 -21
  64. data/test/test_entry.rb +0 -98
  65. data/test/test_preamble.rb +0 -39
  66. data/test/test_string.rb +0 -97
  67. data/test/test_utilities.rb +0 -36
data/Rakefile CHANGED
@@ -18,15 +18,28 @@ Rake::RDocTask.new(:rdoc_task) do |rd|
18
18
  end
19
19
 
20
20
  Rake::TestTask.new(:test_task) do |t|
21
- t.libs << "test"
22
- t.test_files = FileList['test/test_*.rb']
21
+ t.libs << 'lib' << 'test'
22
+ t.test_files = FileList['test/**/test_*.rb']
23
23
  t.verbose = true
24
24
  end
25
25
 
26
+ begin
27
+ require 'cucumber/rake/task'
28
+ Cucumber::Rake::Task.new(:features) do |t|
29
+ t.cucumber_opts = "--format progress"
30
+ end
31
+ rescue LoadError
32
+ desc 'Cucumber rake task not available'
33
+ task :features do
34
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
35
+ end
36
+ end
37
+
38
+
26
39
  task :default => ['racc']
27
40
 
28
41
  desc 'Generates the BibTeX parser'
29
- task :racc => ['lib/bibtex/parser.rb']
42
+ task :racc => ['lib/bibtex/parser.rb','lib/bibtex/name_parser.rb']
30
43
 
31
44
  desc 'Generates RDoc documentation for BibTeX-Ruby'
32
45
  task :rdoc => ['clean','racc','rdoc_task']
@@ -35,7 +48,13 @@ task :test => ['racc','test_task']
35
48
 
36
49
  file 'lib/bibtex/parser.output' => ['lib/bibtex/parser.rb']
37
50
  file 'lib/bibtex/parser.rb' => ['lib/bibtex/bibtex.y'] do
38
- sh 'racc -v -g -o lib/bibtex/parser.rb lib/bibtex/bibtex.y'
51
+ # sh 'racc -v -g -o lib/bibtex/parser.rb lib/bibtex/bibtex.y'
52
+ sh 'racc -v -o lib/bibtex/parser.rb lib/bibtex/bibtex.y'
53
+ end
54
+
55
+ file 'lib/bibtex/name_parser.rb' => ['lib/bibtex/names.y'] do
56
+ # sh 'racc -v -g -o lib/bibtex/name_parser.rb lib/bibtex/names.y'
57
+ sh 'racc -v -o lib/bibtex/name_parser.rb lib/bibtex/names.y'
39
58
  end
40
59
 
41
60
  desc 'Updates the Manifest file'
@@ -52,11 +71,13 @@ end
52
71
 
53
72
  desc 'Pushes the gem file to rubygems.org'
54
73
  task :release => ['build'] do
55
- system "gem push bibtex-ruby-#{BibTeX::Version::STRING}"
74
+ system "gem push bibtex-ruby-#{BibTeX::Version::STRING}.gem"
56
75
  end
57
76
 
58
77
  CLEAN.include('lib/bibtex/parser.rb')
59
78
  CLEAN.include('lib/bibtex/parser.output')
79
+ CLEAN.include('lib/bibtex/name_parser.rb')
80
+ CLEAN.include('lib/bibtex/name_parser.output')
60
81
  CLEAN.include('doc/html')
61
82
  CLEAN.include('*.gem')
62
83
 
@@ -0,0 +1,6 @@
1
+ require 'autowatchr'
2
+
3
+ Autowatchr.new(self) do |config|
4
+ config.lib_dir = 'lib'
5
+ config.test_dir = 'test'
6
+ end
@@ -12,18 +12,21 @@ Gem::Specification.new do |s|
12
12
  s.email = 'http://sylvester.keil.or.at'
13
13
  s.homepage = 'http://inukshuk.github.com/bibtex-ruby'
14
14
  s.summary = 'A BibTeX parser and converter written in Ruby.'
15
- s.description = 'A (fairly complete) BibTeX parser written in Ruby. Supports regular BibTeX entries, @comments, string replacement via @string. Allows for easy export/conversion to formats such as YAML, JSON, and XML.'
15
+ s.description = 'A (fairly complete) BibTeX library and parser written in Ruby. Includes a name parser and supports regular BibTeX entries, @comments, string replacement via @string. Allows for easy export/conversion to formats such as YAML, JSON, and XML.'
16
16
  s.date = Time.now
17
17
 
18
18
  s.required_rubygems_version = '>= 1.3.6'
19
19
  s.rubyforge_project = s.name
20
20
 
21
- s.add_development_dependency('racc', ['>= 1.4.6'])
22
- s.add_development_dependency('minitest', ['>= 2.0.2'])
23
- s.add_development_dependency('json', ['>= 1.5.0'])
21
+ s.add_development_dependency('racc', ['>= 1.4'])
22
+ s.add_development_dependency('mini_shoulda', ['>= 0.3'])
23
+ s.add_development_dependency('mynyml-redgreen', ['>= 0.7'])
24
+ s.add_development_dependency('autowatchr', ['>= 0.1'])
25
+ s.add_development_dependency('cucumber', ['>= 0.10'])
26
+ s.add_development_dependency('json', ['>= 1.5'])
24
27
 
25
28
  s.files = File.open('Manifest').readlines.map(&:chomp)
26
- s.test_files = Dir.glob('test/test*.rb')
29
+ s.test_files = Dir.glob('test/**/test*.rb')
27
30
  s.executables = []
28
31
  s.require_path = 'lib'
29
32
 
@@ -3,26 +3,36 @@ require 'bibtex'
3
3
 
4
4
 
5
5
  # Open a bibliography file
6
- bib = BibTeX.open(File.expand_path('../markdown.bib',__FILE__),
7
- :include => [:meta_comments])
6
+ bib = BibTeX.open File.expand_path('../markdown.bib',__FILE__),
7
+ :include => [:meta_content]
8
8
 
9
9
 
10
- # Convert the BibTeX entries into a simple text format
11
- content = bib.data.map do |d|
12
- result = ''
13
-
14
- if d.class == BibTeX::Entry
15
- d.replace!(bib.strings)
16
- result = [d.author, '. ', d.title, '. ', d.publisher, ': ', d.address, ', ', d.year, '.'].join
17
- end
18
-
19
- if d.class == BibTeX::MetaComment
20
- result = d.to_s
10
+ # Replaces all strings in the Bibliography and then
11
+ # converts each BibTeX entries to a string using Chicago style
12
+ # (all other elements are mapped to simple strings)
13
+
14
+ # TODO 1.3.1
15
+ # begin
16
+ # require 'citeproc'
17
+ # rescue LoadError
18
+ # puts 'this example depends on the citeproc-ruby gem'
19
+ # exit
20
+ # end
21
+
22
+ content = bib.replace.q('@entry, @meta_content').map do |b|
23
+ if b.entry?
24
+ [b.author, '. ', b.title, '. ', b.publisher, ': ', b.address, ', ', b.year, '.'].join
25
+ else
26
+ b.to_s
21
27
  end
22
-
23
- result
24
28
  end
25
29
 
26
- # Convert all non BibTeX text (i.e., the `meta comments') using the maruku gem
27
- require 'maruku'
28
- puts Maruku.new(content.join).to_html_document
30
+
31
+ begin
32
+ require 'redcarpet'
33
+ rescue LoadError
34
+ puts 'this example depends on the redcarpet gem'
35
+ exit
36
+ end
37
+
38
+ puts Redcarpet.new(content.join).to_html
@@ -0,0 +1,96 @@
1
+ Feature: Parse BibTeX files
2
+ As a hacker who works with bibliographies
3
+ I want to be able to parse BibTeX files using Ruby
4
+
5
+ Scenario: A BibTeX file with lots of objects and comments
6
+ When I parse the following file:
7
+ """
8
+ %%
9
+ %% This BibTeX file contains all the examples of valid BibTeX objects
10
+ %% in Xavier Decoret's `A summary of BibTeX' at
11
+ %% http://artis.imag.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html
12
+ %%
13
+
14
+ @Article{py03,
15
+ author = {Xavier D\'ecoret},
16
+ title = "PyBiTex",
17
+ year = 2003
18
+ }
19
+
20
+ @Article{key03,
21
+ title = "A {bunch {of} braces {in}} title"
22
+ }
23
+
24
+ @Article{key01,
25
+ author = "Simon {"}the {saint"} Templar",
26
+ }
27
+
28
+ @Article{key01,
29
+ title = "The history of @ sign"
30
+ }
31
+
32
+ Some {{comments} with unbalanced braces
33
+ ....and a "commented" entry...
34
+
35
+ Book{landru21,
36
+ author = {Landru, Henri D\'esir\'e},
37
+ title = {A hundred recipes for you wife},
38
+ publisher = {Culinary Expert Series},
39
+ year = 1921
40
+ }
41
+
42
+ ..some other comments..before a valid entry...
43
+
44
+ @Book{steward03,
45
+ author = { Martha Steward },
46
+ title = {Cooking behind bars},
47
+ publisher = {Culinary Expert Series},
48
+ year = 2003
49
+ }
50
+
51
+ ...and finally an entry commented by the use of the special Comment entry type.
52
+
53
+ @Comment{steward04,
54
+ author = {Martha Steward},
55
+ title = {Cooking behind bars},
56
+ publisher = {Culinary Expert Series},
57
+ year = 2004
58
+ }
59
+ [Note: here BibTeX-Ruby differs from bibtex in that it does not parse
60
+ the nested book as an object, but treats it as a comment!]
61
+ @Comment{
62
+ @Book{steward04,
63
+ author = {Martha Steward},
64
+ title = {Cooking behind bars},
65
+ publisher = {Culinary Expert Series},
66
+ year = 2004
67
+ }
68
+ }
69
+
70
+ @String{mar = "march"}
71
+
72
+ @Book{sweig42,
73
+ Author = { Stefan Sweig },
74
+ title = { The impossible book },
75
+ publisher = { Dead Poet Society},
76
+ year = 1942,
77
+ month = "1~" # mar
78
+ }
79
+
80
+
81
+ @String {firstname = "Xavier"}
82
+ @String {lastname = "Decoret"}
83
+ @String {email = firstname # "." # lastname # "@imag.fr"}
84
+
85
+ @preamble {"This bibliography was generated on \today"}
86
+
87
+ @String {maintainer = "Xavier D\'ecoret"}
88
+
89
+ @preamble { "Maintained by " # maintainer }
90
+
91
+ """
92
+ Then my bibliography should contain the following numbers of elements:
93
+ | article | book | comment | string | preamble | total |
94
+ | 4 | 2 | 2 | 5 | 2 | 15 |
95
+ And my bibliography should contain an entry with key "sweig42"
96
+ But my bibliography should not contain an entry with key "steward04"
@@ -0,0 +1,67 @@
1
+ Feature: Parse BibTeX preambles
2
+ As a hacker who works with bibliographies
3
+ I want to be able to parse BibTeX files with entries
4
+ Because that's what BibTeX is all about
5
+
6
+ Scenario: A BibTeX file with three books
7
+ When I parse the following file:
8
+ """
9
+ %% This BibTeX bibliography file was created using BibDesk.
10
+ %% http://bibdesk.sourceforge.net/
11
+
12
+
13
+ %% Created for Sylvester Keil at 2010-08-05 10:07:07 +0200
14
+
15
+
16
+ %% Saved with string encoding Unicode (UTF-8)
17
+
18
+
19
+
20
+ @book{rails,
21
+ Address = {Raleigh, North Carolina},
22
+ Author = {Ruby, Sam, and Thomas, Dave, and Hansson Heinemeier, David},
23
+ Booktitle = {Agile Web Development with Rails},
24
+ Date-Added = {2010-08-05 10:01:36 +0200},
25
+ Date-Modified = {2010-08-05 10:06:46 +0200},
26
+ Edition = {third},
27
+ Isbn = {978-1-9343561-6-6},
28
+ Keywords = {ruby, rails},
29
+ Publisher = {The Pragmatic Bookshelf},
30
+ Series = {The Facets of Ruby},
31
+ Title = {Agile Web Development with Rails},
32
+ Year = {2009}
33
+ }
34
+
35
+ @book{dragon,
36
+ Address = {Boston},
37
+ Author = {Aho, Alfred V., and Lam, Monica S., and Ullman, Jeffrey D.},
38
+ Booktitle = {Compilers: Principles, Techniques, and Tools},
39
+ Date-Added = {2010-08-05 09:57:15 +0200},
40
+ Date-Modified = {2010-08-05 10:06:32 +0200},
41
+ Edition = {second},
42
+ Keywords = {compiler, lex, yacc},
43
+ Publisher = {Addison Wesley},
44
+ Title = {Compilers: Principles, Techniques, and Tools},
45
+ Year = {2007}
46
+ }
47
+
48
+ @book{pickaxe,
49
+ Address = {Raleigh, North Carolina},
50
+ Author = {Thomas, Dave, and Fowler, Chad, and Hunt, Andy},
51
+ Date-Added = {2010-08-05 09:54:07 +0200},
52
+ Date-Modified = {2010-08-05 10:07:01 +0200},
53
+ Keywords = {ruby},
54
+ Publisher = {The Pragmatic Bookshelf},
55
+ Series = {The Facets of Ruby},
56
+ Title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
57
+ Year = {2009}
58
+ }
59
+ """
60
+ Then my bibliography should contain these books:
61
+ | title | author | publisher | year |
62
+ | Agile Web Development with Rails | Ruby, Sam and Thomas, Dave and Hansson Heinemeier, David | The Pragmatic Bookshelf | 2009 |
63
+ | Compilers: Principles, Techniques, and Tools | Aho, Alfred V. and Lam, Monica S. and Ullman, Jeffrey D. | Addison Wesley | 2007 |
64
+ | Programming Ruby 1.9: The Pragmatic Programmer's Guide | Thomas, Dave and Fowler, Chad and Hunt, Andy | The Pragmatic Bookshelf | 2009 |
65
+ And my bibliography should contain 2 books published in 2009
66
+ And my bibliography should contain a book with id "pickaxe"
67
+ And my bibliography should contain a book with id "dragon"
@@ -0,0 +1,21 @@
1
+ Feature: Keys containing '/' symbols
2
+ As a hacker who works with bibliographies
3
+ I want to parse BibTeX entries with keys containing slashes
4
+ Because they frequently occur in key naming schemes
5
+
6
+ Scenario: An entry taken from the DBLP
7
+ When I parse the following file:
8
+ """
9
+ @article{DBLP:journals/dq/RossinK99,
10
+ author = {Donald F. Rossin and
11
+ Barbara D. Klein},
12
+ title = {Data Errors in Neural Network and Linear Regression Models:
13
+ An Experimental Comparison},
14
+ journal = {Data Quality Journal},
15
+ volume = {5},
16
+ year = {1999},
17
+ ee = {http://www.dataquality.com/999KR.htm},
18
+ bibsource = {DBLP, http://dblp.uni-trier.de}
19
+ }
20
+ """
21
+ Then my bibliography should contain an article with id "DBLP:journals/dq/RossinK99"
@@ -0,0 +1,72 @@
1
+ Feature: BibTeX Names
2
+ As a hacker who works with bibliographies
3
+ I want to be able to access individual parts of names in a BibTeX file
4
+
5
+ Scenario Outline: Name splitting
6
+ When I parse the name "<name>"
7
+ Then the parts should be:
8
+ | first | von | last | jr |
9
+ | <first> | <von> | <last> | <jr> |
10
+
11
+ @display
12
+ Scenarios: Decoret test suite (display order)
13
+ | name | first | von | last | jr |
14
+ | AA BB | AA | | BB | |
15
+ | AA BB CC | AA BB | | CC | |
16
+ | AA | | | AA | |
17
+ | AA bb | AA | | bb | |
18
+ | aa | | | aa | |
19
+ | aa bb | | aa | bb | |
20
+ | aa BB | | aa | BB | |
21
+ | AA bb CC | AA | bb | CC | |
22
+ | AA bb CC dd EE | AA | bb CC dd | EE | |
23
+ | AA 1B cc dd | AA 1B | cc | dd | |
24
+ | AA 1b cc dd | AA | 1b cc | dd | |
25
+ | AA {b}B cc dd | AA {b}B | cc | dd | |
26
+ | AA {b}b cc dd | AA | {b}b cc | dd | |
27
+ | AA {B}b cc dd | AA | {B}b cc | dd | |
28
+ | AA {B}B cc dd | AA {B}B | cc | dd | |
29
+ | AA \BB{b} cc dd | AA \\BB{b} | cc | dd | |
30
+ | AA \bb{b} cc dd | AA | \\bb{b} cc | dd | |
31
+ | AA {bb} cc DD | AA {bb} | cc | DD | |
32
+ | AA bb {cc} DD | AA | bb | {cc} DD | |
33
+ | AA {bb} CC | AA {bb} | | CC | |
34
+
35
+ @sort
36
+ Scenarios: Decoret test suite (sort order)
37
+ | name | first | von | last | jr |
38
+ | bb CC, AA | AA | bb | CC | |
39
+ | bb CC, aa | aa | bb | CC | |
40
+ | bb CC dd EE, AA | AA | bb CC dd | EE | |
41
+ | bb, AA | AA | | bb | |
42
+ | BB, | | | BB | |
43
+ | bb CC,XX, AA | AA | bb | CC | XX |
44
+ | bb CC,xx, AA | AA | bb | CC | xx |
45
+ | BB,, AA | AA | | BB | |
46
+
47
+ Scenarios: Decoret further remarks
48
+ | name | first | von | last | jr |
49
+ # | Paul \'Emile Victor | Paul \'Emile | | Victor | |
50
+ # | Paul {\'E}mile Victor | Paul {\'E}mile | | Victor | |
51
+ # | Paul \'emile Victor | Paul \'emile | | Victor | |
52
+ # | Paul {\'e}mile Victor | Paul {\'e}mile | | Victor | |
53
+ # | Victor, Paul \'Emile | Paul \'Emile | | Victor | |
54
+ # | Victor, Paul {\'E}mile | Paul {\'E}mile | | Victor | |
55
+ # | Victor, Paul \'emile | Paul \'emile | | Victor | |
56
+ # | Victor, Paul {\'e}mile | Paul {\'e}mile | | Victor | |
57
+ | Dominique Galouzeau de Villepin | Dominique Galouzeau | de | Villepin | |
58
+ | Dominique {G}alouzeau de Villepin | Dominique | {G}alouzeau de | Villepin | |
59
+ | Galouzeau {de} Villepin, Dominique | Dominique | | Galouzeau {de} Villepin | |
60
+
61
+ Scenarios: Some actual names
62
+ | name | first | von | last | jr |
63
+ | John Paul Jones | John Paul | | Jones | |
64
+ | Ludwig von Beethoven | Ludwig | von | Beethoven | |
65
+ | von Beethoven, Ludwig | Ludwig | von | Beethoven | |
66
+ | {von Beethoven}, Ludwig | Ludwig | | {von Beethoven} | |
67
+ | Ford, Jr., Henry | Henry | | Ford | Jr. |
68
+ | Brinch Hansen, Per | Per | | Brinch Hansen | |
69
+ | {Barnes and Noble, Inc.} | | | {Barnes and Noble, Inc.} | |
70
+ | {Barnes and} {Noble, Inc.} | {Barnes and} | | {Noble, Inc.} | |
71
+ | {Barnes} {and} {Noble,} {Inc.} | {Barnes} {and} {Noble,} | | {Inc.} | |
72
+ | Charles Louis Xavier Joseph de la Vallee Poussin | Charles Louis Xavier Joseph | de la | Vallee Poussin | |
@@ -0,0 +1,27 @@
1
+ Feature: Parse BibTeX preambles
2
+ As a hacker who works with bibliographies
3
+ I want to be able to parse BibTeX files with preambles
4
+ Because they are part of the BibTeX format
5
+
6
+ Scenario: A BibTeX file with preambles and strings
7
+ When I parse the following file:
8
+ """
9
+ %%
10
+ %% This is a valid BibTeX File
11
+ %%
12
+
13
+ % Testing preamble statements
14
+
15
+ @preamble{"This bibliography was created \today"}
16
+ @preamble { "Bib\TeX" }
17
+
18
+ @string{ maintainer = "Myself"}
19
+
20
+ @preamble { "Maintained by " # maintainer }
21
+ """
22
+ Then my bibliography should contain the following objects:
23
+ | type | value |
24
+ | preamble | This bibliography was created \\today |
25
+ | preamble | Bib\\TeX |
26
+ | string | Myself |
27
+ | preamble | "Maintained by " # maintainer |
@@ -0,0 +1,56 @@
1
+ Feature: Searching in BibTeX bibliographies
2
+ As a hacker who writes academic papers
3
+ I want to be able to search my bibliographies
4
+ In order to find the references I need
5
+
6
+ Scenario: Find entries in a simple bibliography
7
+ Given the bibliography:
8
+ """
9
+ @book{pickaxe,
10
+ Address = {Raleigh, North Carolina},
11
+ Author = {Thomas, Dave, and Fowler, Chad, and Hunt, Andy},
12
+ Date-Added = {2010-08-05 09:54:07 +0200},
13
+ Date-Modified = {2010-08-05 10:07:01 +0200},
14
+ Keywords = {ruby},
15
+ Publisher = {The Pragmatic Bookshelf},
16
+ Series = {The Facets of Ruby},
17
+ Title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
18
+ Year = {2009}
19
+ }
20
+ @article{a1,
21
+ Keywords = {@book}
22
+ }
23
+ @book{dragon,
24
+ Address = {Boston},
25
+ Author = {Aho, Alfred V., and Lam, Monica S., and Ullman, Jeffrey D.},
26
+ Booktitle = {Compilers: Principles, Techniques, and Tools},
27
+ Date-Added = {2010-08-05 09:57:15 +0200},
28
+ Date-Modified = {2010-08-05 10:06:32 +0200},
29
+ Edition = {second},
30
+ Keywords = {compiler, lex, yacc},
31
+ Publisher = {Addison Wesley},
32
+ Title = {Compilers: Principles, Techniques, and Tools},
33
+ Year = {2007}
34
+ }
35
+ """
36
+ When I search for "pickaxe"
37
+ Then there should be exactly 1 match
38
+ When I search for :pickaxe
39
+ Then there should be exactly 1 match
40
+ When I search for "camel"
41
+ Then there should be exactly 0 matches
42
+ When I search for "@book"
43
+ Then there should be exactly 2 matches
44
+ When I search for /@book/
45
+ Then there should be exactly 3 matches
46
+ When I search for "@book[]"
47
+ Then there should be exactly 2 matches
48
+ When I search for "@book[year=2007]"
49
+ Then there should be exactly 1 match
50
+ When I search for "@book[year=2009, keywords=ruby]"
51
+ Then there should be exactly 1 match
52
+ When I search for "@book[year=2009, keywords=yacc]"
53
+ Then there should be exactly 0 matches
54
+ When I search for "@book, @article"
55
+ Then there should be exactly 3 matches
56
+