# HG changeset patch
# User Myhailo Danylenko
# Date 1310444886 -10800
# Node ID 33ea13cef18527d6138edc54d6c6e3880c3c4e6a
# Parent c5a487f2fd7fc5772bc75479a71b1fa0e27907f7
Improve docgen script
diff -r c5a487f2fd7f -r 33ea13cef185 CMakeLists.txt
--- a/CMakeLists.txt Tue Jul 05 04:17:47 2011 +0300
+++ b/CMakeLists.txt Tue Jul 12 07:28:06 2011 +0300
@@ -57,7 +57,7 @@
## Extra targets
if(PERL_FOUND)
- add_custom_command(OUTPUT ${lua-lm_BINARY_DIR}/loudmouth.html COMMAND ${PERL_EXECUTABLE} ${lua-lm_SOURCE_DIR}/docgen.pl ${lua-lm_SOURCES} > ${lua-lm_BINARY_DIR}/loudmouth.html DEPENDS ${lua-lm_SOURCE_DIR}/docgen.pl ${lua-lm_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR})
+ add_custom_command(OUTPUT ${lua-lm_BINARY_DIR}/loudmouth.html COMMAND ${PERL_EXECUTABLE} ${lua-lm_SOURCE_DIR}/docgen.pl -f html -t "Lua-loudmouth API reference" -o ${lua-lm_BINARY_DIR}/loudmouth.html -- ${lua-lm_SOURCES} DEPENDS ${lua-lm_SOURCE_DIR}/docgen.pl ${lua-lm_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR})
add_custom_target(doc ALL DEPENDS ${lua-lm_BINARY_DIR}/loudmouth.html)
endif()
if(LUA_EXECUTABLE)
diff -r c5a487f2fd7f -r 33ea13cef185 docgen.pl
--- a/docgen.pl Tue Jul 05 04:17:47 2011 +0300
+++ b/docgen.pl Tue Jul 12 07:28:06 2011 +0300
@@ -1,6 +1,6 @@
#! /usr/bin/perl
-# Copyright 2009 Myhailo Danylenko
+# Copyright 2009, 2011 Myhailo Danylenko
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,9 +15,59 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+=head1
+
+Reads source and generates documentation, embedded in comments
+
+=head1 SYNTAX
+
+docgen.pl [B<-o> I] [B<-t> I] [B<-f> I] F [F] ...
+
+=cut
+
use strict;
use warnings;
+use Pod::Usage;
+use Getopt::Std;
+$Getopt::Std::STANDARD_HELP_VERSION = 1;
+
+our $VERSION = '0.0.3';
+our sub HELP_MESSAGE {
+ pod2usage (-verbose => 2,
+ -noperldoc => 1);
+}
+
+=head1 OPTIONS
+
+B<-o> F
+
+Output file (if not specified - stdout).
+
+B<-t> I
+
+Title for documentation html page
+
+B<-f> [I|I]
+
+Output type: html (default) or markdown.
+
+B<-p> I
+
+Prefix to search, by default c-like '///'
+
+B<-c> F
+
+Url to css file to include in html header.
+
+=cut
+
+our ( $opt_o, $opt_t, $opt_f, $opt_p, $opt_c )
+ = ( undef, "Docs", 'html', '///', undef );
+getopts ( 'o:t:f:p:c:' );
+$opt_c = $opt_c ? qq(\n) : "";
+my $prefix_rx = quotemeta $opt_p;
+
my %docs;
my @tags;
my $inside;
@@ -34,37 +84,35 @@
while (
"
+ };
+ print OUTPUT "\n\n- - -";
}
- print "
";
+
}
-print "