diff --git a/doc/oxtradoc/oxtradoc.in b/doc/oxtradoc/oxtradoc.in index c610f853..eb395494 100644 --- a/doc/oxtradoc/oxtradoc.in +++ b/doc/oxtradoc/oxtradoc.in @@ -31,6 +31,9 @@ # the line (minus the '@') is not translated. # '!! include-figure ' includes the file, and makes # it's content a figure. +# '!! include-yang ' includes the YANG module in file, and makes +# it's content a figure, and adds a proper instruction. +# (requires pyang in the path) # '-' at the beginning of the line marks a symbol list item. # '_' at the beginning of the line marks an empty list item. # '+' at the beginning of the line marks a numbered list item. @@ -296,7 +299,7 @@ sub first_pass { last; } - # Handles include-figure, table, and row + # Handles include-figure, include-yang, table, and row if (/^!!\s*(\S+)/) { $tag = $1; $tag =~ s/-/_/g; @@ -560,7 +563,7 @@ sub section { sub start_picture { suspend_digress(); - print "\t
\n\t \n \n\t
\n"; + print " ]]>\n \n"; resume_digress(); } @@ -646,27 +649,27 @@ sub start_code { print "\n", $indent_digress, untabify($line), "\n"; } else { - print "\t
\n\t \n \n\t
\n" if $art; + print " ]]>\n \n" if $art; resume_digress(); $art = 0; } sub start_xml { suspend_digress(); - print "\t
\n\t \n \n\t
\n"; + print " ]]>\n \n"; resume_digress(); $art = 0; } @@ -753,7 +756,7 @@ sub nlist { } if ($type eq "hanging") { - print "\t\n"; + print " \n"; } else { print " " x $ndepth, "\n", esc($content), "\n"; } @@ -773,11 +776,11 @@ sub end_nlist { sub start_abstract { print " \n" unless &prev_tag() eq "abstract"; - print "\t\n", esc($line), "\n"; + print " \n", esc($line), "\n"; } sub end_abstract { - print "\t\n"; + print " \n"; print "\n" unless &next_tag() eq "abstract"; } @@ -855,7 +858,7 @@ sub include_figure { print "<CODE BEGINS> file \"${extract_to}\"\n"; } - print "\t
\n\t \n ) { $lnum += 1; @@ -871,13 +874,38 @@ sub include_figure { } } close FD; - print "\t ]]>\n\t
\n"; + print " ]]>\n \n"; if ($extract_to) { print "<CODE ENDS>\n"; } resume_digress(); } +sub include_yang { + my $prefix; + return if $phase eq "end"; + + my ($file) = ($line =~ /^!!\s*include-yang (\S+)/); + + my $cmd = "pyang -f name --name-print-revision ${file}"; + my $extract_to = `${cmd} || echo 1` || die "error invoking: ${cmd}"; + $extract_to =~ s/\s+$//; + !($extract_to eq "1") || die "error invoking: ${cmd}"; + + suspend_digress(); + print "<CODE BEGINS> file \"${extract_to}.yang\"\n"; + print "
\n ) { + $line = untabify($_); + print $indent_digress, $prefix, $line; + } + close FD; + print " ]]>\n
\n"; + print "<CODE ENDS>\n"; + resume_digress(); +} + sub list_sections { return if $phase eq "end"; @@ -994,11 +1022,11 @@ sub question { return if /^$/; if (/^\? /) { - print "\t \n\t\n" if $in_question; + print " \n \n" if $in_question; - print "\t\n\t\n", + print " \n \n", "Open Question\n"; - print "\t \n"; + print " \n"; s/^\?\s+//; } @@ -1007,7 +1035,7 @@ sub question { } sub end_question { - print "\t \n\t\n\t\n"; + print " \n \n \n"; $in_question = 0; } @@ -1045,9 +1073,9 @@ print "\n" if $doc{private}; EOF print_authors($doc); - print "\t\n"; + print " \n"; foreach $k (@{$doc{keyword}}) { - print "\t", $k, "\n"; + print " ", $k, "\n"; } }