mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Added if-not expression.
Importing documentation generator tool. A kind of...
This commit is contained in:
parent
e19d0e46d5
commit
f340e3a32b
@ -18,6 +18,10 @@
|
||||
(define-macro (dec! n)
|
||||
`(set! ,n (- ,n 1)))
|
||||
|
||||
(define-macro (if-not . body)
|
||||
`(if (not ,(car body))
|
||||
,@(cdr body)))
|
||||
|
||||
;;
|
||||
;; Allow defining functions like:
|
||||
;; (def name (param1 param2)
|
||||
|
119
tools/capone/src/capone-doc
Executable file
119
tools/capone/src/capone-doc
Executable file
@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env perl
|
||||
# A tool to generate some html-ized documentation
|
||||
# based on capone source... see it as doxygen for capone.
|
||||
|
||||
sub write_prolog {
|
||||
print <<EOL
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>$_[0]</title>
|
||||
<style type="text/css">
|
||||
|
||||
h5.function {
|
||||
margin: 5px 0 5px 0;
|
||||
padding: 0;
|
||||
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
h5.example {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0;
|
||||
padding: 0 0 0 20px;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 20px 0 20px 0;
|
||||
text-align: center;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin: 20px;" text="#111111" bgcolor="#FFFFFF">
|
||||
EOL
|
||||
}
|
||||
|
||||
sub write_epilog {
|
||||
print <<EOL
|
||||
<div class="footer">generated with capone-doc</div>
|
||||
</body>
|
||||
</html>
|
||||
EOL
|
||||
}
|
||||
|
||||
sub main {
|
||||
if(@ARGV eq 0) {
|
||||
print "Usage: capone-doc [FILE]\n";
|
||||
print "Generate html-ized documentation by extracting documentation\n";
|
||||
print "specific tags on the specific manner from capone source file\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$in_block = 0;
|
||||
$filename = $ARGV[0];
|
||||
|
||||
open(INFILE, $filename) or die "Can't open $filename: $!";
|
||||
|
||||
&write_prolog($filename);
|
||||
|
||||
while(<INFILE>) {
|
||||
# find markers
|
||||
if(/^;;=/) {
|
||||
if($in_block eq 0) {
|
||||
print "<div class=\"function\">\n";
|
||||
$in_block = 1;
|
||||
} else {
|
||||
print "</div>\n";
|
||||
print "<br />\n";
|
||||
print "<center>-- ∂ --</center>\n";
|
||||
$in_block = 0;
|
||||
}
|
||||
|
||||
# strip them
|
||||
s/;;=(.*)$//;
|
||||
}
|
||||
|
||||
if($in_block eq 1) {
|
||||
# strip comments
|
||||
s/;;\s*\n$/<br \/>\n/;
|
||||
#s/;;\s*//;
|
||||
s/;;//;
|
||||
|
||||
# \code and \endcode
|
||||
s/\\code/ <h5 class="example">Example:<\/h5>\n<pre>/;
|
||||
s/\\endcode/ <\/pre>/;
|
||||
|
||||
# \func
|
||||
s/\\func (.*)/ <h5 class="function">$1<\/h5>/;
|
||||
|
||||
# \param
|
||||
s/\\param (.*)/ <b>parameter:<\/b> $1<br \/>/;
|
||||
|
||||
# \return
|
||||
s/\\return (.*)/ <b>returns:<\/b> $1<br \/>/;
|
||||
|
||||
# \br
|
||||
s/\\br/<br \/>/g;
|
||||
|
||||
# \center
|
||||
s/\\center (.*)$/<center>$1<\/center>/;
|
||||
|
||||
# grok everything out
|
||||
print $_;
|
||||
}
|
||||
}
|
||||
|
||||
&write_epilog;
|
||||
}
|
||||
|
||||
&main;
|
Loading…
Reference in New Issue
Block a user