File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ def nextpages
130130
131131 def toc_link page
132132 link_text = page . split ( /[-_]/ ) . map { |s |s . capitalize } . join ( ' ' )
133- path = "/#{ @site_name } /" + page
133+ path = page . start_with? ( '/' ) ? page : "/#{ @site_name } /" + page
134134 li do
135135 if page == page_name
136136 span link_text , class : 'current'
Original file line number Diff line number Diff line change 44require_relative "../lib/contents"
55
66here = File . expand_path File . dirname ( __FILE__ )
7+ real_sites_dir = File . expand_path "#{ here } /../sites"
78
89describe Contents do
9- before :all do
10+ before do
1011 @meals_toc = Contents . new ( site_name : 'meals' , site_dir : "#{ here } /sites/meals" , page_name : 'prepare_a_meal' )
1112 end
1213
14+ it "should render absolute links absolutely" do
15+ @docs_toc = Contents . new ( site_name : 'docs' , site_dir : "#{ real_sites_dir } /docs" , page_name : 'docs' )
16+
17+ toc_html = Nokogiri . parse ( @docs_toc . to_html )
18+ links = toc_html . css ( 'a' ) . inject ( { } ) { |hsh , link | hsh [ link . text ] = link . attr ( 'href' ) ; hsh }
19+ links [ '/curriculum' ] . should == '/curriculum'
20+ end
21+
1322 it "scans for subpage links" do
1423 @meals_toc . subpages . should == {
1524 "breakfast" => [ ] ,
You can’t perform that action at this time.
0 commit comments