Module: Jekyll::JekyllRdf::Helper::RdfPageHelper
- Includes:
- RdfPrefixHelper
- Defined in:
- lib/jekyll/helper/rdf_page_helper.rb
Instance Attribute Summary collapse
-
#complete ⇒ Object
readonly
Returns the value of attribute complete.
Class Method Summary collapse
Instance Method Summary collapse
- #assimilate_page(page) ⇒ Object
- #re_init_as_rdf(resource, mapper) ⇒ Object
- #read_yaml(base, name, opts = {}) ⇒ Object
- #relative_path ⇒ Object
- #relative_path=(url) ⇒ Object
Methods included from RdfPrefixHelper
Instance Attribute Details
#complete ⇒ Object (readonly)
Returns the value of attribute complete.
5 6 7 |
# File 'lib/jekyll/helper/rdf_page_helper.rb', line 5 def complete @complete end |
Class Method Details
.prepare_resource(resource, mapper) ⇒ Object
50 51 52 53 |
# File 'lib/jekyll/helper/rdf_page_helper.rb', line 50 def self.prepare_resource resource, mapper @@template = mapper.map(resource) @@template.gsub!(".html", "") unless @@template.nil? #gsub only for downward compatibility // remove gsub + unless on next version update end |
.template(read_out = false) ⇒ Object
63 64 65 66 67 |
# File 'lib/jekyll/helper/rdf_page_helper.rb', line 63 def self.template read_out = false template = @@template @@template = nil if read_out template end |
Instance Method Details
#assimilate_page(page) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jekyll/helper/rdf_page_helper.rb', line 15 def assimilate_page page self.data.merge!(page.data) setData() if page.data['layout'].nil? self.content.gsub!(/{{\s*content\s*}}/, page.content) else self.content = page.content end self end |
#re_init_as_rdf(resource, mapper) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/jekyll/helper/rdf_page_helper.rb', line 26 def re_init_as_rdf(resource, mapper) @resource = resource if(@base.nil?) Jekyll.logger.warn "Resource #{resource} not rendered: no base url found." @complete = false #TODO: set a return here and adapt the test for displaying a warning for rendering a page without template else @complete = true end map_template(resource, mapper) return unless @complete load_data(@site) self.data['permalink'] = File.join(@dir, @name) #overwrite permalinks to stop them from interfering with JekyllRdfs rendersystem return unless @complete load_prefixes_yaml() resource.page = self resource.site = @site @site.data['resources'] << resource @url = resource.page_url #page_url reflects the url given by the uri of that site #Jekyll on the other hand renders .html in each url belonging to an html (also converted ones like .md) @url << ".html" unless (@url.length == 0) || (@url[-1].eql? "/") @url = "/" + @url unless (@url.length > 0)&&(@url[0].eql? "/") #by default jekyll renders with a leading / end |
#read_yaml(base, name, opts = {}) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/jekyll/helper/rdf_page_helper.rb', line 55 def read_yaml(base, name, opts = {}) begin template = @site.layouts[Jekyll::JekyllRdf::Helper::RdfPageHelper.template(true)] #load actual template @path = template.path unless template.nil? end unless Jekyll::JekyllRdf::Helper::RdfPageHelper.template.nil? super(base, name, opts) end |
#relative_path ⇒ Object
11 12 13 |
# File 'lib/jekyll/helper/rdf_page_helper.rb', line 11 def relative_path @relative_path ||= super end |
#relative_path=(url) ⇒ Object
7 8 9 |
# File 'lib/jekyll/helper/rdf_page_helper.rb', line 7 def relative_path= url @relative_path=url end |