bivy 0.0.5

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.
Files changed (55) hide show
  1. data/.gitignore +21 -0
  2. data/History +16 -0
  3. data/LICENSE +29 -0
  4. data/README.rdoc +37 -0
  5. data/Rakefile +43 -0
  6. data/TODO +12 -0
  7. data/VERSION +1 -0
  8. data/bin/bivy.rb +56 -0
  9. data/bin/pubmed_to_bivy.rb +78 -0
  10. data/doc/config.yaml +13 -0
  11. data/doc/src/default.css +126 -0
  12. data/doc/src/default.template +38 -0
  13. data/doc/src/tutorial/basic_flow.page +71 -0
  14. data/doc/src/tutorial/index.page +8 -0
  15. data/doc/src/tutorial/new_formats_and_media.page +83 -0
  16. data/jrn_abbrev/abbr_html.tgz +0 -0
  17. data/jrn_abbrev/abbr_to_journal.yaml +676 -0
  18. data/jrn_abbrev/download_abbrevs.rb +20 -0
  19. data/jrn_abbrev/for_ruby_class.rb +686 -0
  20. data/jrn_abbrev/html_to_yaml.rb +50 -0
  21. data/lib/bibliography.rb +144 -0
  22. data/lib/bivy.rb +4 -0
  23. data/lib/citation.rb +194 -0
  24. data/lib/format.rb +120 -0
  25. data/lib/format/acs.rb +88 -0
  26. data/lib/format/bioinformatics.rb +33 -0
  27. data/lib/format/bmc.rb +38 -0
  28. data/lib/format/jtp.rb +30 -0
  29. data/lib/format/mla.rb +50 -0
  30. data/lib/formatter.rb +276 -0
  31. data/lib/journal.rb +6 -0
  32. data/lib/journal/iso_to_full.yaml +1320 -0
  33. data/lib/journal/medline_to_full.yaml +7 -0
  34. data/lib/journal/medline_to_iso.yaml +45 -0
  35. data/lib/media.rb +88 -0
  36. data/lib/media/html.rb +65 -0
  37. data/lib/ooffice.rb +39 -0
  38. data/lib/pubmed.rb +209 -0
  39. data/lib/rtf.rb +217 -0
  40. data/old_stuff/old_list2refs.rb +103 -0
  41. data/old_stuff/pubmed2html.rb +119 -0
  42. data/old_stuff/pubmed_bib_write.rb +92 -0
  43. data/old_stuff/xml.tmp.xml +115 -0
  44. data/scripts/merge_bibs.rb +70 -0
  45. data/spec/bibliography_spec.rb +127 -0
  46. data/spec/citation_positions.odt +0 -0
  47. data/spec/formatter_spec.rb +14 -0
  48. data/spec/formatter_spec/cits_after.xml +2 -0
  49. data/spec/formatter_spec/cits_before.xml +2 -0
  50. data/spec/formatter_spec/content.xml +2 -0
  51. data/spec/ooffice_spec.rb +27 -0
  52. data/spec/pubmed_spec.rb +26 -0
  53. data/spec/spec_helper.rb +7 -0
  54. data/spec/testfiles/doc1.odt +0 -0
  55. metadata +136 -0
@@ -0,0 +1,115 @@
1
+ <PubmedArticle>
2
+ <MedlineCitation Owner=\"NLM\" Status=\"MEDLINE\">
3
+ <PMID>17323448</PMID>
4
+ <DateCreated>
5
+ <Year>2007</Year>
6
+ <Month>02</Month>
7
+ <Day>23</Day>
8
+ </DateCreated>
9
+ <DateCompleted>
10
+ <Year>2007</Year>
11
+ <Month>03</Month>
12
+ <Day>27</Day>
13
+ </DateCompleted>
14
+ <Article PubModel=\"Print\">
15
+ <Journal>
16
+ <ISSN IssnType=\"Print\">0003-2700</ISSN>
17
+ <JournalIssue CitedMedium=\"Print\">
18
+ <Volume>79</Volume>
19
+ <Issue>3</Issue>
20
+ <PubDate>
21
+ <Year>2007</Year>
22
+ <Month>Feb</Month>
23
+ <Day>1</Day>
24
+ </PubDate>
25
+ </JournalIssue>
26
+ <Title>Analytical chemistry</Title>
27
+ <ISOAbbreviation>Anal. Chem.</ISOAbbreviation>
28
+ </Journal>
29
+ <ArticleTitle>Separation media for microchips.</ArticleTitle>
30
+ <Pagination>
31
+ <MedlinePgn>800-8</MedlinePgn>
32
+ </Pagination>
33
+ <Affiliation>University of Arizona, USA. mwirth@email.arizona.edu</Affiliation>
34
+ <AuthorList CompleteYN=\"Y\">
35
+ <Author ValidYN=\"Y\">
36
+ <LastName>Wirth</LastName>
37
+ <ForeName>Mary J</ForeName>
38
+ <Initials>MJ</Initials>
39
+ </Author>
40
+ </AuthorList>
41
+ <Language>eng</Language>
42
+ <GrantList CompleteYN=\"Y\">
43
+ <Grant>
44
+ <GrantID>R01 GM65980</GrantID>
45
+ <Acronym>GM</Acronym>
46
+ <Agency>NIGMS</Agency>
47
+ </Grant>
48
+ </GrantList>
49
+ <PublicationTypeList>
50
+ <PublicationType>Journal Article</PublicationType>
51
+ <PublicationType>Research Support, N.I.H., Extramural</PublicationType>
52
+ <PublicationType>Review</PublicationType>
53
+ </PublicationTypeList>
54
+ </Article>
55
+ <MedlineJournalInfo>
56
+ <Country>United States</Country>
57
+ <MedlineTA>Anal Chem</MedlineTA>
58
+ <NlmUniqueID>0370536</NlmUniqueID>
59
+ </MedlineJournalInfo>
60
+ <ChemicalList>
61
+ <Chemical>
62
+ <RegistryNumber>9007-49-2</RegistryNumber>
63
+ <NameOfSubstance>DNA</NameOfSubstance>
64
+ </Chemical>
65
+ </ChemicalList>
66
+ <CitationSubset>IM</CitationSubset>
67
+ <MeshHeadingList>
68
+ <MeshHeading>
69
+ <DescriptorName MajorTopicYN=\"Y\">Chemical Fractionation</DescriptorName>
70
+ </MeshHeading>
71
+ <MeshHeading>
72
+ <DescriptorName MajorTopicYN=\"N\">DNA</DescriptorName>
73
+ <QualifierName MajorTopicYN=\"N\">analysis</QualifierName>
74
+ </MeshHeading>
75
+ <MeshHeading>
76
+ <DescriptorName MajorTopicYN=\"Y\">Microchip Analytical Procedures</DescriptorName>
77
+ </MeshHeading>
78
+ <MeshHeading>
79
+ <DescriptorName MajorTopicYN=\"N\">Oligonucleotide Array Sequence Analysis</DescriptorName>
80
+ </MeshHeading>
81
+ <MeshHeading>
82
+ <DescriptorName MajorTopicYN=\"N\">Protein Array Analysis</DescriptorName>
83
+ </MeshHeading>
84
+ <MeshHeading>
85
+ <DescriptorName MajorTopicYN=\"N\">Proteomics</DescriptorName>
86
+ </MeshHeading>
87
+ <MeshHeading>
88
+ <DescriptorName MajorTopicYN=\"N\">Research</DescriptorName>
89
+ </MeshHeading>
90
+ </MeshHeadingList>
91
+ <NumberOfReferences>54</NumberOfReferences>
92
+ </MedlineCitation>
93
+ <PubmedData>
94
+ <History>
95
+ <PubMedPubDate PubStatus=\"pubmed\">
96
+ <Year>2007</Year>
97
+ <Month>2</Month>
98
+ <Day>27</Day>
99
+ <Hour>9</Hour>
100
+ <Minute>0</Minute>
101
+ </PubMedPubDate>
102
+ <PubMedPubDate PubStatus=\"medline\">
103
+ <Year>2007</Year>
104
+ <Month>3</Month>
105
+ <Day>28</Day>
106
+ <Hour>9</Hour>
107
+ <Minute>0</Minute>
108
+ </PubMedPubDate>
109
+ </History>
110
+ <PublicationStatus>ppublish</PublicationStatus>
111
+ <ArticleIdList>
112
+ <ArticleId IdType=\"pubmed\">17323448</ArticleId>
113
+ </ArticleIdList>
114
+ </PubmedData>
115
+ </PubmedArticle>
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ require 'yaml'
4
+
5
+ require 'optparse'
6
+
7
+ $force = false
8
+ opts = OptionParser.new do |op|
9
+ op.banner = "usage: #{File.basename(__FILE__)} bib.yml ..."
10
+ op.separator "on matching key or pmid aborts with informative warning"
11
+ op.separator "otherwise, outputs file 'merged.yml'"
12
+ op.on("-f", "--force", "gives warnings but still prints merged.yml") { $force = true }
13
+ end
14
+
15
+ opts.parse!
16
+
17
+ if ARGV.size < 2
18
+ puts opts.to_s
19
+ exit
20
+ end
21
+
22
+ all_pmids = {}
23
+ all_refs = {}
24
+ overlapping_refs = Hash.new {|h,k| h[k] = [] }
25
+ overlapping_pmids = Hash.new {|h,k| h[k] = [] }
26
+ one_bad = false
27
+ ARGV.each do |file|
28
+ yml = YAML.load_file(file)
29
+ yml.each do |k,v|
30
+ if all_refs.key?(k)
31
+ unless all_refs[k] == v
32
+ overlapping_refs[k].push(v)
33
+ end
34
+ elsif all_pmids.key?(k)
35
+ overlapping_pmids[k].push(v)
36
+ end
37
+ all_refs[k] = v
38
+ end
39
+ end
40
+
41
+ bad_keys = overlapping_refs.size > 0 || overlapping_pmids.size > 0
42
+
43
+ if bad_keys
44
+ if overlapping_refs.size > 0
45
+ puts "Overlapping KEYS (but different entries): "
46
+ overlapping_refs.each do |k,v|
47
+ puts "#{k}:"
48
+ v.each do |val|
49
+ puts "<<<<<<<<<<<<<"
50
+ puts "#{val.to_yaml}"
51
+ puts ">>>>>>>>>>>>>"
52
+ end
53
+ end
54
+ end
55
+ if overlapping_pmids.size > 0
56
+ puts "Overlapping PMIDs: "
57
+ overlapping_pmids.each do |k,v|
58
+ puts "#{k}:"
59
+ v.each do |val|
60
+ puts "<<<<<<<<<<<<<"
61
+ puts "#{val.to_yaml}"
62
+ puts ">>>>>>>>>>>>>"
63
+ end
64
+ end
65
+ end
66
+ end
67
+ if !bad_keys || $force
68
+ puts "printing to file: \"merged.yml\""
69
+ File.open('merged.yml', 'w') {|out| out.print(all_refs.to_yaml) }
70
+ end
@@ -0,0 +1,127 @@
1
+ require 'spec_helper'
2
+
3
+ require 'bibliography'
4
+ require 'citation'
5
+ #require 'format/html'
6
+
7
+
8
+ describe 'basic bibliography test' do
9
+ before do
10
+ authors = %w(HQ BY JT).zip(%w(Dork Man Prince)).map do |init, last|
11
+ Citation::Author.new(last, init)
12
+ end
13
+ hash = {
14
+ :authors => authors, :title => "Silly Title", :journal_medline => 'Jail Cell', :journal_full => 'Jail Cell', :journal_iso => 'Jail Cell', :year => '1996', :month => 'Aug', :vol => 32, :pages => '32-8', :ident => 'Prince1996', :quotes => []
15
+ }
16
+ @cit1 = Citation::Article.new(hash)
17
+ authors2 = %w(BM).zip(%w(Smith)).map do |init, last|
18
+ Citation::Author.new(last, init)
19
+ end
20
+ hash2 = {
21
+ :authors => authors2, :title => "Wacky Backy", :publisher => 'Rocky Mountain Publishing', :year => '2003', :ident => 'Smelly2003'
22
+ }
23
+ @cit2 = Citation::Book.new(hash2)
24
+ @cits = [@cit1, @cit2]
25
+ end
26
+
27
+ it 'makes a YAML round trip' do
28
+ yaml = <<END
29
+ ---
30
+ month: Aug
31
+ journal_full: Jail Cell
32
+ journal_iso: Jail Cell
33
+ journal_medline: Jail Cell
34
+ title: Silly Title
35
+ ident: Prince1996
36
+ year: "1996"
37
+ authors:
38
+ - Dork, HQ
39
+ - Man, BY
40
+ - Prince, JT
41
+ pages: 32-8
42
+ quotes: []
43
+ bibtype: article
44
+ vol: 32
45
+ END
46
+
47
+ YAML.load(@cit1.to_yaml).is YAML.load(yaml) # just frozen really
48
+
49
+ bibyaml = <<END2
50
+ Prince1996:
51
+ month: Aug
52
+ journal_full: Jail Cell
53
+ journal_iso: Jail Cell
54
+ journal_medline: Jail Cell
55
+ title: Silly Title
56
+ year: "1996"
57
+ authors:
58
+ - Dork, HQ
59
+ - Man, BY
60
+ - Prince, JT
61
+ pages: 32-8
62
+ quotes: []
63
+ bibtype: article
64
+ vol: 32
65
+ END2
66
+
67
+ bib = Bibliography.new
68
+ bib.citations = [@cit1]
69
+ created_yaml = bib.to_yaml
70
+
71
+ # frozen
72
+ YAML.load(created_yaml).is YAML.load(bibyaml)
73
+
74
+ bib_from_yaml = Bibliography.from_yaml(bibyaml)
75
+ #assert_equal(bibbib_from_yaml, "bibs are the same from objects and from yaml")
76
+ #assert_equal(bib.citations.first, bib_from_yaml.citations.first, "cits are the same from objects and from yaml")
77
+ bc1 = bib.citations.first
78
+ bc2 = bib_from_yaml.citations.first
79
+ %w(bibtype ident journal_full journal_medline journal_iso month pages title vol year).map {|v| v.to_sym}.each do |x|
80
+ bc2.send(x).is bc1.send(x)
81
+ end
82
+ bc2.send(:authors).is bc1.send(:authors)
83
+ end
84
+
85
+ xit 'writes a bibliography' do # better description??
86
+ frozen = <<END
87
+ <html>
88
+ <body>
89
+ <ol>
90
+ <li>Dork H.Q., Man B.Y., Prince J.T. <span style="font-style:italic;">Jail Cell.</span> <span style="font-weight:bold;">1996</span>, <span style="font-style:italic;">32</span>, 32-8.</li>
91
+ <li>Smith B.M. <span style="font-style:italic;">Wacky Backy.</span> <span style="font-weight:bold;">2003</span>.</li>
92
+ </ol>
93
+ </body>
94
+ </html>
95
+ END
96
+ bib = Bibliography.new(@cits)
97
+ bib.write(Format::HTML.new).is frozen
98
+ end
99
+
100
+ it 'adds citations to the bibliography' do
101
+ authors = %w(JT).zip(%w(Prince)).map do |init, last|
102
+ Citation::Author.new(last, init)
103
+ end
104
+ hash = {
105
+ :authors => authors, :title => "Theory of Everything", :journal_medline => 'OmiOmics', :journal_full => 'OmiOmics', :journal_iso => 'OmiOmics', :year => '2010', :month => 'Jan', :vol => 1010, :pages => '35-9', :ident => 'Prince2010', :quotes => []
106
+ }
107
+ diff_cit = Citation::Article.new(hash)
108
+
109
+ # single
110
+ bib = Bibliography.new([@cit1, @cit2])
111
+ cits_before = bib.citations.dup
112
+ ans = bib.add(@cit1)
113
+ ans.size.is 1
114
+ # rejects identical id
115
+ ans.first.is @cit1
116
+ # cits unchanged
117
+ bib.citations.is cits_before
118
+
119
+ ans = bib.add(@cit1, diff_cit)
120
+ ans.size.is 1
121
+ # rejects identical id
122
+ ans.first.is @cit1
123
+ # added a guy
124
+ bib.citations.is cits_before.push(diff_cit)
125
+ end
126
+
127
+ end
Binary file
@@ -0,0 +1,14 @@
1
+
2
+ require 'spec_helper'
3
+ require 'formatter'
4
+
5
+ describe 'replacing citations' do
6
+ it 'does basic citation replacement' do
7
+ string = "This is the#[billy211], document#[mark2006, john2007, simon2010]. Why do you think it is like it is? #[mark2006, billy211]. How are you doing? [#[sally32, mark2006]]. And you #[billy211, mark2006, simon2010, markus32]."
8
+ (new_string, ordered_cits) = Formatter.new.replace_citations_numerically(string, '#[', ']', ', ')
9
+ # returns ordered citations
10
+ ordered_cits.is %w(billy211 mark2006 john2007 simon2010 sally32 markus32)
11
+ # returns a new string properly formatted
12
+ new_string.is "This is the1, document2-4. Why do you think it is like it is? 1-2. How are you doing? [2,5]. And you 1-2,4,6."
13
+ end
14
+ end
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"><office:scripts/><office:font-face-decls><style:font-face style:name="Helvetica" svg:font-family="Helvetica"/><style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/><style:font-face style:name="Times" svg:font-family="Times"/><style:font-face style:name="AR PL ShanHeiSun Uni" svg:font-family="&apos;AR PL ShanHeiSun Uni&apos;" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="DejaVuSans" svg:font-family="DejaVuSans" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="T1" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style></office:automatic-styles><office:body><office:text><office:forms form:automatic-focus="false" form:apply-design-mode="false"/><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:p text:style-name="Standard">line 1: ruby is great.#[Mycit2008] <text:s/>It is also great,#[Hello2004] and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard">line 2: ruby is great.<text:span text:style-name="T1">#[Mycit2008]</text:span> <text:s/>It is also great,<text:span text:style-name="T1">#[Hello2004]</text:span> and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard">line 3: ruby is great.#[Mycit2008] <text:s/>It is also great,#[Hello2004] and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard">line 4: ruby is great.<text:span text:style-name="T1">#[Mycit2008]</text:span> <text:s/>It is also great,<text:span text:style-name="T1">#[Hello2004]</text:span> and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard"/></office:text></office:body></office:document-content>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"><office:scripts/><office:font-face-decls><style:font-face style:name="Helvetica" svg:font-family="Helvetica"/><style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/><style:font-face style:name="Times" svg:font-family="Times"/><style:font-face style:name="AR PL ShanHeiSun Uni" svg:font-family="&apos;AR PL ShanHeiSun Uni&apos;" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="DejaVuSans" svg:font-family="DejaVuSans" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="T1" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style></office:automatic-styles><office:body><office:text><office:forms form:automatic-focus="false" form:apply-design-mode="false"/><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:p text:style-name="Standard">line 1: ruby is great#[Mycit2008]. <text:s/>It is also great#[Hello2004], and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard">line 2: ruby is great<text:span text:style-name="T1">#[Mycit2008]</text:span>. <text:s/>It is also great<text:span text:style-name="T1">#[Hello2004]</text:span>, and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard">line 3: ruby is great#[Mycit2008]. <text:s/>It is also great#[Hello2004], and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard">line 4: ruby is great<text:span text:style-name="T1">#[Mycit2008]</text:span>. <text:s/>It is also great<text:span text:style-name="T1">#[Hello2004]</text:span>, and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard"/></office:text></office:body></office:document-content>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"><office:scripts/><office:font-face-decls><style:font-face style:name="Helvetica" svg:font-family="Helvetica"/><style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/><style:font-face style:name="Times" svg:font-family="Times"/><style:font-face style:name="AR PL ShanHeiSun Uni" svg:font-family="&apos;AR PL ShanHeiSun Uni&apos;" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="DejaVuSans" svg:font-family="DejaVuSans" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="T1" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style></office:automatic-styles><office:body><office:text><office:forms form:automatic-focus="false" form:apply-design-mode="false"/><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:p text:style-name="Standard">line 1: ruby is great#[Mycit2008]. <text:s/>It is also great#[Hello2004], and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard">line 2: ruby is great<text:span text:style-name="T1">#[Mycit2008]</text:span>. <text:s/>It is also great<text:span text:style-name="T1">#[Hello2004]</text:span>, and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard">line 3: ruby is great.#[Mycit2008] <text:s/>It is also great,#[Hello2004] and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard">line 4: ruby is great.<text:span text:style-name="T1">#[Mycit2008]</text:span> <text:s/>It is also great,<text:span text:style-name="T1">#[Hello2004]</text:span> and cool.</text:p><text:p text:style-name="Standard"/><text:p text:style-name="Standard"/></office:text></office:body></office:document-content>
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ require 'fileutils'
4
+ require 'ooffice'
5
+
6
+ describe 'basic test' do
7
+ before do
8
+ @doc_permanent = TESTFILES + '/doc1.odt'
9
+ @doc = TESTFILES + '/doc1.tmp.odt'
10
+ @newdoc = 'doc1.tmp.new.odt'
11
+ @newdoc_with_path = TESTFILES + '/doc1.tmp.new.odt'
12
+ FileUtils.cp @doc_permanent, @doc
13
+ end
14
+
15
+ after do
16
+ FileUtils.rm @doc
17
+ end
18
+
19
+ it 'can change the document' do
20
+ start_read = 300
21
+ OpenOffice.new.modify_content(@doc, @newdoc) {|string| string.sub(/john/,'peter')}
22
+ ok File.exist?(@newdoc_with_path)
23
+ # can mess up the file end
24
+ IO.read(@newdoc_with_path, 3000, start_read).isnt IO.read(@doc, 3000, start_read)
25
+ File.unlink @newdoc_with_path
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+
2
+ require 'spec_helper'
3
+ require 'pubmed'
4
+
5
+
6
+ describe 'basic pubmed testing' do
7
+ before do
8
+ @pmid = 17323448
9
+ end
10
+ it 'adds a journal given a pubmed id' do
11
+ begin
12
+ pm = PubMed.new(@pmid)
13
+ hash = {:title=>"Separation media for microchips.", :journal_medline =>"Anal Chem", :journal_iso=> 'Anal. Chem.', :journal_full => 'Analytical chemistry', :year=>"2007", :month=>"Feb", :vol=>"79", :issue=>"3", :pages=>"800-8", :ident=>"Wirth2007", :pmid=>17323448, :quotes => []}
14
+ hash.each do |k,v|
15
+ # "#{k}: attributes on pubmed retrieval"
16
+ pm.send(k).is v
17
+ end
18
+ pm.authors.first.last.is 'Wirth'
19
+ pm.authors.first.initials.is 'MJ'
20
+
21
+ rescue SocketError
22
+ ok !puts("No Internet Connection, skipping test")
23
+ end
24
+ end
25
+ end
26
+
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'spec/more'
3
+
4
+
5
+ TESTFILES = File.dirname(__FILE__) + '/testfiles'
6
+
7
+ Bacon.summary_on_exit
Binary file
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bivy
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 5
9
+ version: 0.0.5
10
+ platform: ruby
11
+ authors:
12
+ - John Prince
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-01 00:00:00 -06:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: spec-more
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ version_requirements: *id001
33
+ description: uses a simple YAML format to store bibliographies. Then modifies citations in openoffice and outputs a bibliography (in different forms) for inclusion in the document
34
+ email: jtprince@gmail.com
35
+ executables:
36
+ - pubmed_to_bivy.rb
37
+ - bivy.rb
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - LICENSE
42
+ - README.rdoc
43
+ - TODO
44
+ files:
45
+ - .gitignore
46
+ - History
47
+ - LICENSE
48
+ - README.rdoc
49
+ - Rakefile
50
+ - TODO
51
+ - VERSION
52
+ - bin/bivy.rb
53
+ - bin/pubmed_to_bivy.rb
54
+ - doc/config.yaml
55
+ - doc/src/default.css
56
+ - doc/src/default.template
57
+ - doc/src/tutorial/basic_flow.page
58
+ - doc/src/tutorial/index.page
59
+ - doc/src/tutorial/new_formats_and_media.page
60
+ - jrn_abbrev/abbr_html.tgz
61
+ - jrn_abbrev/abbr_to_journal.yaml
62
+ - jrn_abbrev/download_abbrevs.rb
63
+ - jrn_abbrev/for_ruby_class.rb
64
+ - jrn_abbrev/html_to_yaml.rb
65
+ - lib/bibliography.rb
66
+ - lib/bivy.rb
67
+ - lib/citation.rb
68
+ - lib/format.rb
69
+ - lib/format/acs.rb
70
+ - lib/format/bioinformatics.rb
71
+ - lib/format/bmc.rb
72
+ - lib/format/jtp.rb
73
+ - lib/format/mla.rb
74
+ - lib/formatter.rb
75
+ - lib/journal.rb
76
+ - lib/journal/iso_to_full.yaml
77
+ - lib/journal/medline_to_full.yaml
78
+ - lib/journal/medline_to_iso.yaml
79
+ - lib/media.rb
80
+ - lib/media/html.rb
81
+ - lib/ooffice.rb
82
+ - lib/pubmed.rb
83
+ - lib/rtf.rb
84
+ - old_stuff/old_list2refs.rb
85
+ - old_stuff/pubmed2html.rb
86
+ - old_stuff/pubmed_bib_write.rb
87
+ - old_stuff/xml.tmp.xml
88
+ - scripts/merge_bibs.rb
89
+ - spec/bibliography_spec.rb
90
+ - spec/citation_positions.odt
91
+ - spec/formatter_spec.rb
92
+ - spec/formatter_spec/cits_after.xml
93
+ - spec/formatter_spec/cits_before.xml
94
+ - spec/formatter_spec/content.xml
95
+ - spec/ooffice_spec.rb
96
+ - spec/pubmed_spec.rb
97
+ - spec/spec_helper.rb
98
+ - spec/testfiles/doc1.odt
99
+ has_rdoc: true
100
+ homepage: http://github.com/jtprince/bivy
101
+ licenses: []
102
+
103
+ post_install_message:
104
+ rdoc_options:
105
+ - --charset=UTF-8
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ segments:
122
+ - 0
123
+ version: "0"
124
+ requirements: []
125
+
126
+ rubyforge_project:
127
+ rubygems_version: 1.3.7
128
+ signing_key:
129
+ specification_version: 3
130
+ summary: roll your own citation manager (if you like that sort of thing)
131
+ test_files:
132
+ - spec/pubmed_spec.rb
133
+ - spec/bibliography_spec.rb
134
+ - spec/ooffice_spec.rb
135
+ - spec/formatter_spec.rb
136
+ - spec/spec_helper.rb