You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/12/17 18:24:07 UTC

[33/50] [abbrv] incubator-brooklyn git commit: improve the links between website and guide

improve the links between website and guide


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/c3bf7215
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/c3bf7215
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/c3bf7215

Branch: refs/heads/master
Commit: c3bf7215604f96b4dcccc922d8d1415e9c5991a3
Parents: f8521f4
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Dec 17 01:46:44 2014 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Dec 17 02:02:58 2014 +0000

----------------------------------------------------------------------
 docs/_build/config-guide-latest.yml  |  1 +
 docs/_build/config-guide-version.yml |  2 +-
 docs/_build/config-website-root.yml  |  1 +
 docs/_layouts/guide-normal.html      |  2 +-
 docs/_plugins/read.rb                | 47 +++++++++++++++----------------
 docs/_plugins/site_structure.rb      | 12 ++++++--
 docs/website/documentation.md        |  2 +-
 7 files changed, 37 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c3bf7215/docs/_build/config-guide-latest.yml
----------------------------------------------------------------------
diff --git a/docs/_build/config-guide-latest.yml b/docs/_build/config-guide-latest.yml
index 8b20811..faf2631 100644
--- a/docs/_build/config-guide-latest.yml
+++ b/docs/_build/config-guide-latest.yml
@@ -1,2 +1,3 @@
 path:
   guide: /v/latest
+  website: ""

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c3bf7215/docs/_build/config-guide-version.yml
----------------------------------------------------------------------
diff --git a/docs/_build/config-guide-version.yml b/docs/_build/config-guide-version.yml
index 03b654d..640f22f 100644
--- a/docs/_build/config-guide-version.yml
+++ b/docs/_build/config-guide-version.yml
@@ -3,4 +3,4 @@ path:
   guide: /v/0.7.0-SNAPSHOT
   # BROOKLYN_VERSION_BELOW
   style: /v/0.7.0-SNAPSHOT/style
-
+  website: ""

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c3bf7215/docs/_build/config-website-root.yml
----------------------------------------------------------------------
diff --git a/docs/_build/config-website-root.yml b/docs/_build/config-website-root.yml
index 7ac39fe..e5e4b07 100644
--- a/docs/_build/config-website-root.yml
+++ b/docs/_build/config-website-root.yml
@@ -1,2 +1,3 @@
 path:
   website: ""
+  guide: "/v/latest"

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c3bf7215/docs/_layouts/guide-normal.html
----------------------------------------------------------------------
diff --git a/docs/_layouts/guide-normal.html b/docs/_layouts/guide-normal.html
index 411769e..e04c674 100644
--- a/docs/_layouts/guide-normal.html
+++ b/docs/_layouts/guide-normal.html
@@ -187,7 +187,7 @@ console.log("setting text to "+txt);
     <div id="header">
     
         <div id="identity">
-            <a href="http://brooklyncentral.github.com/" rel="home">Brooklyn</a>
+            <a href="{{ site.path.website }}" rel="home">Brooklyn</a>
         </div>
         
         <ul id="quicklinks">

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c3bf7215/docs/_plugins/read.rb
----------------------------------------------------------------------
diff --git a/docs/_plugins/read.rb b/docs/_plugins/read.rb
index 74a7613..ae0ba75 100644
--- a/docs/_plugins/read.rb
+++ b/docs/_plugins/read.rb
@@ -37,18 +37,18 @@ module JekyllRead
       @text = text
     end
     def render(context)
-	filename = @text.strip
-        filename = context[filename] || filename
+      filename = @text.strip
+      filename = context[filename] || filename
 
-        # Pathname API ignores first arg below if second is absolute
-        file = Pathname.new(File.dirname(context['page']['path'])) + filename
-        file = file.cleanpath
-        # is there a better way to trim a leading / ?
-        file = file.relative_path_from(Pathname.new("/")) unless file.relative?
-        raise "No such file #{file} in read call (from #{context['page']['path']})" unless file.exist?
+      # Pathname API ignores first arg below if second is absolute
+      file = Pathname.new(File.dirname(context['page']['path'])) + filename
+      file = file.cleanpath
+      # is there a better way to trim a leading / ?
+      file = file.relative_path_from(Pathname.new("/")) unless file.relative?
+      raise "No such file #{file} in read call (from #{context['page']['path']})" unless file.exist?
 
-	file = File.open(file, "rb")
-	return file.read
+      file = File.open(file, "rb")
+      return file.read
     end
   end
 
@@ -58,25 +58,24 @@ module JekyllRead
       @text = text
     end
     def render(context)
-        filename = @text.strip
-        filename = context[filename] || filename
+      filename = @text.strip
+      filename = context[filename] || filename
 
-        # Pathname API ignores first arg below if second is absolute
-        file = Pathname.new(File.dirname(context['page']['path'])) + filename
-        file = file.cleanpath
-        # is there a better way to trim a leading / ?
-        file = file.relative_path_from(Pathname.new("/")) unless file.relative?
-        raise "No such file #{file} in readj call (from #{context['page']['path']})" unless file.exist?
+      # Pathname API ignores first arg below if second is absolute
+      file = Pathname.new(File.dirname(context['page']['path'])) + filename
+      file = file.cleanpath
+      # is there a better way to trim a leading / ?
+      file = file.relative_path_from(Pathname.new("/")) unless file.relative?
+      raise "No such file #{file} in readj call (from #{context['page']['path']})" unless file.exist?
 
-        # with readj we support vars and paths relative to a file being readj'd
-        jekyllSite = context.registers[:site]
-	targetPage = Jekyll::Page.new(jekyllSite, jekyllSite.source, File.dirname(file), File.basename(file))
-	targetPage.render(jekyllSite.layouts, jekyllSite.site_payload)
-	return targetPage.output
+      # with readj we support vars and paths relative to a file being readj'd
+      jekyllSite = context.registers[:site]
+      targetPage = Jekyll::Page.new(jekyllSite, jekyllSite.source, File.dirname(file), File.basename(file))
+      targetPage.render(jekyllSite.layouts, jekyllSite.site_payload)
+      return targetPage.output
     end
   end
 end
 
 Liquid::Template.register_tag('read', JekyllRead::ReadTag)
 Liquid::Template.register_tag('readj', JekyllRead::ReadjTag)
-

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c3bf7215/docs/_plugins/site_structure.rb
----------------------------------------------------------------------
diff --git a/docs/_plugins/site_structure.rb b/docs/_plugins/site_structure.rb
index 95ba1d5..af98473 100644
--- a/docs/_plugins/site_structure.rb
+++ b/docs/_plugins/site_structure.rb
@@ -38,7 +38,12 @@ module SiteStructure
       site.data['navgroups'] = navgroups
       site.data['structure'] = gen_structure(site, SiteStructure::BROOKLYN_WEBSITE_ROOT, nil, navgroups)
     end
-    
+
+    def render_liquid(site, page, content)
+      info = { :filters => [Jekyll::Filters], :registers => { :site => site, :page => page } }
+      page.render_liquid(content, site.site_payload, info)
+    end
+        
     def gen_structure(site, pagename, parent, navgroups)
       page = find_page_with_path_absolute_or_relative_to(site, pagename, parent)
       
@@ -72,10 +77,11 @@ module SiteStructure
         page.data['children'].each do |c|
           if c['path']
             # links to another Jekyll site-structured page
-            c['reference'] = gen_structure(site, c['path'], page, navgroups)
+            c['reference'] = gen_structure(site, render_liquid(site, page, c['path']), page, navgroups)
           elsif c['link']
             # links to a non-site-structured page, on this site or elsewhere
-            c['reference'] = { 'url' => c['link'], 'title' => c['title'] }
+            # allow title and link to use vars and tags (liquid processing)
+            c['reference'] = { 'url' => render_liquid(site, page, c['link']), 'title' => render_liquid(site, page, c['title']) }
           end
         end
       end

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c3bf7215/docs/website/documentation.md
----------------------------------------------------------------------
diff --git a/docs/website/documentation.md b/docs/website/documentation.md
index 5d164a4..4ad3c8e 100644
--- a/docs/website/documentation.md
+++ b/docs/website/documentation.md
@@ -2,7 +2,7 @@
 layout: website-normal
 title: Documentation
 children:
-- { link: "/v/latest", title: User Guide }
+- { link: "{{ site.path.guide }}", title: User Guide }
 - { path: glossary.md }
 - { path: documentation/install-on-server.md }
 ---