Permalink
Browse files

allow docbook in source files (in comments) and build developer docum…

…entation from it
  • Loading branch information...
1 parent 880bb29 commit 49fac1c926b76895e6420ab372d773c01944b246 @postwait postwait committed Dec 17, 2011
Showing with 53 additions and 0 deletions.
  1. +3 −0 Makefile.in
  2. +35 −0 buildtools/mkcodedocs.pl
  3. +11 −0 docs/development/dev.xml
  4. +4 −0 docs/index.xml
View
@@ -7,6 +7,9 @@ install: all
(cd src && make install DESTDIR=$(DESTDIR))
(cd sql && make install DESTDIR=$(DESTDIR))
+dev-docs:
+ ./buildtools/mkcodedocs.pl ./src ./docs/development/docs
+
clean:
(cd src && make clean)
(cd sql && make clean)
View
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+use strict;
+use File::Find;
+my $inbase = shift || die;
+my $outbase = shift || die;
+
+sub xlate {
+ my $in = shift;
+ my $out = shift;
+ open(F, "<$in") || die " <<< $in ";
+ $/ = undef;
+ my $a = <F>;
+ close(F);
+ unlink($out) if(-f $out);
+ if($a =~ /\/\*\*\s*DOCBOOK(.+)\*\//sm) {
+ my $b = $1;
+ $b =~ s/^\s+\*//gm;
+ print "Appending to $out\n";
+ open(F, ">>$out");
+ print F $b;
+ close(F);
+ }
+}
+
+
+finddepth({
+ wanted => sub {
+ (my $file = $File::Find::name) =~ s/^$inbase\///;
+ return if($file !~ /\.(?:c|h|lua|pl|java)$/);
+ (my $out = $file) =~ s/(\/|\.)/_/g;
+ xlate("$inbase/$file", "$outbase/$out.xml");
+ },
+ no_chdir => 1
+}, $inbase);
View
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+ "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
+[
+ <!ENTITY % magic.fixup SYSTEM "http://labs.omniti.com/docbook/ent">
+ %magic.fixup;
+]>
+<chapter id="dev.reconnoiter">
+ <title>Developer's Guide</title>
+&development.docs.all;
+</chapter>
View
@@ -36,6 +36,10 @@
<title>Operation</title>
&operation.all;
</part>
+ <part id="development">
+ <title>Development</title>
+ &development.all;
+ </part>
<part id="reference">
<title>Reference</title>
<reference id="exe">

0 comments on commit 49fac1c

Please sign in to comment.