-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from Simaris/269/work_on_reset
jekyll-rdf still works after Jekyll reset
- Loading branch information
Showing
12 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'https://rubygems.org' | ||
group :jekyll_plugins do | ||
gem 'jekyll-rdf', :path => '../../../' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
baseurl: "/instance" # the subpath of your site, e.g. /blog | ||
url: "http://example.org/" # the base hostname & protocol for your site | ||
# Build settings | ||
markdown: kramdown | ||
plugins: | ||
- jekyll-rdf | ||
jekyll_rdf: | ||
path: "_data/knowledge-base.ttl" | ||
restriction: "SELECT ?resourceUri WHERE {?resourceUri ?p ?o}" | ||
default_template: "default-resource" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PREFIX eg: <http://example.org/instance/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@prefix eg: <http://example.org/instance/> . | ||
|
||
eg:resource1 eg:predicate eg:object . | ||
eg:resource2 eg:predicate eg:object . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
layout: default | ||
--- | ||
<h6>This is a resource</h6> <br/> | ||
{{ page.rdf }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
--- | ||
<!DOCTYPE html> | ||
<html> | ||
<head></head> | ||
<body> | ||
<div> | ||
<h4>This is made with jekyll-rdf</h4> <br/> | ||
{{content}} | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
layout: default | ||
rdf_prefix_path: _data/Prefixes.pref | ||
--- | ||
<div class="instance"> | ||
<h6> This page is mapped to: </h6> | ||
{{page.rdf}} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
layout: default | ||
rdf_prefix_path: _data/Prefixes.pref | ||
--- | ||
<div class="person"> | ||
<h6> | ||
name: | ||
</h6> | ||
{{page.rdf | rdf_property: "foaf:name"}} | ||
<br/> | ||
<h6> | ||
age: | ||
</h6> | ||
{{page.rdf | rdf_property: "foaf:age"}} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
layout: default | ||
--- | ||
|
||
<h6>This is a page</h6> <br/> | ||
Test-Page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
require 'test_helper' | ||
|
||
class TestGeneral < Test::Unit::TestCase | ||
include RSpec::Matchers | ||
include RdfTestUtility | ||
context "Jekyll-Rdf after reinitialization" do | ||
setup do | ||
setup_site_jekyll File.dirname(__FILE__) | ||
end | ||
|
||
should "render content completly" do | ||
file = File.read(File.join(@source, "_site/reset-page.html")) | ||
content = file[/\<div\>(.|\s)*\<\/div>/][5..-7].strip.split("<br/>").map do |entry| | ||
entry.strip | ||
end | ||
assert_equal "<h4>This is made with jekyll-rdf</h4>", content[0] | ||
assert_equal "<h6>This is a page</h6>", content[1] | ||
assert_equal "Test-Page", content[2] | ||
file = File.read(File.join(@source, "_site/resource1.html")) | ||
content = file[/\<div\>(.|\s)*\<\/div>/][5..-7].strip.split("<br/>").map do |entry| | ||
entry.strip | ||
end | ||
assert_equal "<h4>This is made with jekyll-rdf</h4>", content[0] | ||
assert_equal "<h6>This is a resource</h6>", content[1] | ||
assert_equal "http://example.org/instance/resource1", content[2] | ||
file = File.read(File.join(@source, "_site/resource2.html")) | ||
content = file[/\<div\>(.|\s)*\<\/div>/][5..-7].strip.split("<br/>").map do |entry| | ||
entry.strip | ||
end | ||
assert_equal "<h4>This is made with jekyll-rdf</h4>", content[0] | ||
assert_equal "<h6>This is a resource</h6>", content[1] | ||
assert_equal "http://example.org/instance/resource2", content[2] | ||
# Jekyll::JekyllRdf::Helper::RdfHelper.reinitialize | ||
@site.process | ||
file = File.read(File.join(@source, "_site/reset-page.html")) | ||
content = file[/\<div\>(.|\s)*\<\/div>/][5..-7].strip.split("<br/>").map do |entry| | ||
entry.strip | ||
end | ||
assert File.exist?(File.join(@source, "_site/resource1.html")), "resource1.html was in the render list but wasn't rendered after reset" | ||
assert_equal "<h4>This is made with jekyll-rdf</h4>", content[0] | ||
assert_equal "<h6>This is a page</h6>", content[1] | ||
assert_equal "Test-Page", content[2] | ||
file = File.read(File.join(@source, "_site/resource1.html")) | ||
content = file[/\<div\>(.|\s)*\<\/div>/][5..-7].strip.split("<br/>").map do |entry| | ||
entry.strip | ||
end | ||
assert_equal "<h4>This is made with jekyll-rdf</h4>", content[0] | ||
assert_equal "<h6>This is a resource</h6>", content[1] | ||
assert_equal "http://example.org/instance/resource1", content[2] | ||
file = File.read(File.join(@source, "_site/resource2.html")) | ||
content = file[/\<div\>(.|\s)*\<\/div>/][5..-7].strip.split("<br/>").map do |entry| | ||
entry.strip | ||
end | ||
assert_equal "<h4>This is made with jekyll-rdf</h4>", content[0] | ||
assert_equal "<h6>This is a resource</h6>", content[1] | ||
assert_equal "http://example.org/instance/resource2", content[2] | ||
end | ||
end | ||
end |