trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1079018 - in /trafficserver/site/branches/ats-cms: content/docs/trunk/admin/index.en.mdtext content/docs/trunk/admin/order.txt lib/view.pm
Date Mon, 07 Mar 2011 23:11:54 GMT
Author: amc
Date: Mon Mar  7 23:11:54 2011
New Revision: 1079018

URL: http://svn.apache.org/viewvc?rev=1079018&view=rev
Log:
Added ability to mix custom and auto nav bar items

Modified:
    trafficserver/site/branches/ats-cms/content/docs/trunk/admin/index.en.mdtext
    trafficserver/site/branches/ats-cms/content/docs/trunk/admin/order.txt
    trafficserver/site/branches/ats-cms/lib/view.pm

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/admin/index.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/admin/index.en.mdtext?rev=1079018&r1=1079017&r2=1079018&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/admin/index.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/admin/index.en.mdtext Mon Mar 
7 23:11:54 2011
@@ -16,7 +16,7 @@ Notice:    Licensed to the Apache Softwa
            KIND, either express or implied.  See the License for the
            specific language governing permissions and limitations
            under the License.
-Navigation: [Home](/)
+Navigation: [Next](*)
             [SDK](../sdk/index.en.html)
 
 Available Languages: (*LANG*)

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/admin/order.txt
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/admin/order.txt?rev=1079018&r1=1079017&r2=1079018&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/admin/order.txt (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/admin/order.txt Mon Mar  7 23:11:54
2011
@@ -1,3 +1,4 @@
+index
 getting-started
 http-proxy-caching
 reverse-proxy-http-redirects

Modified: trafficserver/site/branches/ats-cms/lib/view.pm
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/lib/view.pm?rev=1079018&r1=1079017&r2=1079018&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/lib/view.pm (original)
+++ trafficserver/site/branches/ats-cms/lib/view.pm Mon Mar  7 23:11:54 2011
@@ -70,8 +70,21 @@ sub single_narrative {
     # Finally, read the actual target file.
     read_text_file $file, \%args;
 
+    # Process any user supplied nav links.
+    my $user_navs; # array ref of nav links from user data.
+    my $user_nav_fill = 0; # Need to fill generated links from navigation?
     if ($args{headers}{navigation}) {
-	$args{nav} = parse_links($args{headers}{navigation});
+	($user_navs, $user_nav_fill) = parse_links($args{headers}{navigation});
+    }
+    if ($user_navs) {
+	if ($user_nav_fill) {
+	    my %auto_navs;
+	    $auto_navs{$_->{text}} = $_ for (@{nav($file)});
+	    for (@$user_navs) {
+		$_->{url} = $auto_navs{$_->{text}}->{url} if exists $auto_navs{$_->{text}}
and $_->{url} eq '*';
+	    }
+	}
+	$args{nav} = $user_navs;
     } else {
 	$args{nav} = nav($file);
     }
@@ -234,6 +247,7 @@ sub order_probe {
 	local $/; # Grab the entire file
 	my @order = split(/\s+/, <$fh>);
 	my $n = scalar @order;
+	# Look for our stem and get the index if found.
 	$idx = 0;
 	++$idx while $idx < $n and $order[$idx] ne $stem;
 	if ($idx < $n) {
@@ -341,13 +355,15 @@ sub nav {
 sub parse_links {
     my ($input) = @_;
     my @links; # Return: list of link items.
+    my $need_fill = 0; # URLs to be named later found.
     for (split(/\s+/, $input)) {
 	if (/\[([^\]]+)\]\(([^)]+)/) {
 	    my ($text, $url) = ($1, $2);
 	    push (@links, { text => $text, url => $url });
+	    $need_fill = 1 if $url eq '*';
 	}
     }
-    return \@links;
+    return ( \@links , $need_fill );
 }
 
 =head1 LICENSE



Mime
View raw message