bibtex2html 0.1.0 → 0.2.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 +4 -4
- data/lib/bibtex2html.rb +1 -0
- data/lib/bibtex2html/convert.rb +17 -2
- data/lib/bibtex2html/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20c9063a44677965f0742c1dd9767ed94fc7da53
|
4
|
+
data.tar.gz: 1b2393b7a55e0d4f6e250d00120947f6d21499f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c95f356d0fc5794896fedfa0af04c290c0f4349f6e7456d4fb2d305278cef39a85b97b04d3b42ed89ece7d624782d6a51cf9afd25a2c179fa24c2980b150efd2
|
7
|
+
data.tar.gz: 540793e2332707f63ea756d42a2cb1e37570c4870795fc683a918887c5e66d2211e1c21209c0fc513707766fef1632bc8f141db87ce0c7f66b6cc8e5ac356b67
|
data/lib/bibtex2html.rb
CHANGED
data/lib/bibtex2html/convert.rb
CHANGED
@@ -1,11 +1,26 @@
|
|
1
|
-
# -+- coding: utf-8 -*-
|
2
1
|
require "bibtex2html/version"
|
3
2
|
require "bibtex"
|
3
|
+
require "cgi"
|
4
4
|
|
5
5
|
module Bibtex2html
|
6
|
+
module_function
|
7
|
+
|
6
8
|
def convert item
|
9
|
+
doc = "<div class='bibitem'>"
|
7
10
|
bibitem = BibTeX.parse item
|
8
|
-
|
11
|
+
bibitem.each do |attributes|
|
12
|
+
attributes.each do |key, values|
|
13
|
+
doc += "<h3>#{CGI.escapeHTML key.to_s}</h3>"
|
14
|
+
doc += "<ul>"
|
15
|
+
|
16
|
+
values.to_a.each do |value|
|
17
|
+
doc += "<li>#{CGI.escapeHTML value}</li>"
|
18
|
+
end
|
19
|
+
doc += "</ul>"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
doc += "</div>"
|
23
|
+
|
9
24
|
return doc
|
10
25
|
end
|
11
26
|
end
|
data/lib/bibtex2html/version.rb
CHANGED