bergamasco 0.2.8 → 0.2.9
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/Gemfile.lock +1 -1
- data/lib/bergamasco/markdown.rb +5 -2
- data/lib/bergamasco/version.rb +1 -1
- data/spec/fixtures/cool-dois.html.md +1 -0
- data/spec/markdown_spec.rb +2 -3
- 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: 019430c76e307359d0bdfa7e2e1f4bb6b765899b
|
4
|
+
data.tar.gz: 242da0ac868471fbfa51f9c8ddb77d55d7581836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feeff06a54ade78d2bd83ea8cda527e424b960307987c86c13598098dfb0271f4497e46d41980799d87b03bd1e15c25312cc3e43d5a431d3e857a7c66f3206c2
|
7
|
+
data.tar.gz: 14132388259869c8befb75255da89f3daaba00792205057feb9a826c804da94d8aee98f723c593132294f2d931fead7aca6b33aa4fefc29037e50a6ad4855500
|
data/Gemfile.lock
CHANGED
data/lib/bergamasco/markdown.rb
CHANGED
@@ -19,10 +19,13 @@ module Bergamasco
|
|
19
19
|
metadata.to_yaml + "---\n" + content
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.update_file(
|
22
|
+
def self.update_file(filepath, new_metadata)
|
23
|
+
file = IO.read(filepath)
|
23
24
|
metadata, content = split_yaml_frontmatter(file)
|
24
25
|
metadata = update_yaml_frontmatter(metadata, new_metadata)
|
25
|
-
join_yaml_frontmatter(metadata, content)
|
26
|
+
new_file = join_yaml_frontmatter(metadata, content)
|
27
|
+
IO.write(filepath, new_file)
|
28
|
+
new_file
|
26
29
|
end
|
27
30
|
|
28
31
|
def self.read_yaml(filepath)
|
data/lib/bergamasco/version.rb
CHANGED
@@ -7,6 +7,7 @@ tags:
|
|
7
7
|
- doi
|
8
8
|
- featured
|
9
9
|
image: https://blog.datacite.org/images/2016/12/cool-dois.png
|
10
|
+
doi: 10.23725/0000-03VC
|
10
11
|
---
|
11
12
|
In 1998 Tim Berners-Lee coined the term cool URIs [-@https://www.w3.org/Provider/Style/URI], that is URIs that don’t change. We know that URLs referenced in the scholarly literature are often not cool, leading to link rot [@https://doi.org/10.1371/journal.pone.0115253] and making it hard or impossible to find the referenced resource.READMORE
|
12
13
|
|
data/spec/markdown_spec.rb
CHANGED
@@ -73,10 +73,9 @@ describe Bergamasco::Markdown do
|
|
73
73
|
|
74
74
|
it 'should update file' do
|
75
75
|
filepath = fixture_path + 'cool-dois.html.md'
|
76
|
-
file = IO.read(filepath)
|
77
76
|
new_metadata = { "doi" => "10.23725/0000-03VC"}
|
78
|
-
|
79
|
-
expect(
|
77
|
+
file = subject.update_file(filepath, new_metadata)
|
78
|
+
expect(file).to include("\ndoi: 10.23725/0000-03VC\n")
|
80
79
|
end
|
81
80
|
|
82
81
|
it 'should convert markdown' do
|