markdown-like

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@77 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
Nishi 2025-09-30 11:49:09 +00:00
commit b09cdf23a9
2 changed files with 162 additions and 149 deletions

View file

@ -63,6 +63,7 @@ examples: $(EXAMPLES)
format: format:
clang-format --verbose -i $(shell find src include examples tools -name "*.c" -or -name "*.h") clang-format --verbose -i $(shell find src include examples tools -name "*.c" -or -name "*.h")
perltidy -b -bext='/' --paren-tightness=2 $(shell find tools -name "*.pl")
src/libMw$(SO): $(L_OBJS) src/libMw$(SO): $(L_OBJS)
$(CC) $(L_LDFLAGS) -shared -o $@ $^ $(L_LIBS) $(CC) $(L_LDFLAGS) -shared -o $@ $^ $(L_LIBS)

View file

@ -9,7 +9,10 @@ our @notes = ("warning", "unsure", "note");
sub sentence { sub sentence {
my $str = $_[0]; my $str = $_[0];
$str =~ s/([^\.])$/\1./g; $str =~ s/([^\.])$/\1./g;
$str =~ s/`([^`]+)`/<code>\1<\/code>/g; $str =~ s/`(.+?)`/<code>\1<\/code>/g;
$str =~ s/\*\*\*(.+?)\*\*\*/<b><i>\1<\/i><\/b>/g;
$str =~ s/\*\*(.+?)\*\*/<b>\1<\/b>/g;
$str =~ s/\*(.+?)\*/<i>\1<\/i>/g;
return $str; return $str;
} }
@ -27,7 +30,8 @@ sub arguments {
$out = $out . "\t$str"; $out = $out . "\t$str";
if ($str eq $arglist[ 0 + @arglist - 1 ]) { if ($str eq $arglist[ 0 + @arglist - 1 ]) {
$out = $out . "\n"; $out = $out . "\n";
}else{ }
else {
$out = $out . ",\n"; $out = $out . ",\n";
} }
} }
@ -50,7 +54,8 @@ sub scan_dir {
scan_dir($first, $path . "/" . $p); scan_dir($first, $path . "/" . $p);
} }
closedir($dh); closedir($dh);
}else{ }
else {
my $spaces = ""; my $spaces = "";
my $in = 0; my $in = 0;
my $out = 0; my $out = 0;
@ -79,7 +84,8 @@ sub scan_dir {
$out = 0; $out = 0;
if (!$has_file) { if (!$has_file) {
print(STDERR "Warning: missing comment with %file, ignoring\n"); print(STDERR
"Warning: missing comment with %file, ignoring\n");
next; next;
} }
if (!defined($kv{brief})) { if (!defined($kv{brief})) {
@ -130,17 +136,22 @@ sub scan_dir {
out("</dd>"); out("</dd>");
} }
out("<hr>"); out("<hr>");
}elsif($l =~ /^([ \t]*)\/\*\!/){ }
elsif ($l =~ /^([ \t]*)\/\*\!/) {
$spaces = $1; $spaces = $1;
$in = 1; $in = 1;
$file = 0; $file = 0;
%kv = (); %kv = ();
%param = (); %param = ();
@paramlist = (); @paramlist = ();
}elsif($in && ($l =~ /^$spaces \*\//)){ }
elsif ($in && ($l =~ /^$spaces \*\//)) {
$in = 0; $in = 0;
$out = 1; $out = 1;
}elsif($in && ($l =~ /^$spaces \*[ \t]+%([^ ]+)(?:[ \t]+(.+))?$/)){ }
elsif ($in
&& ($l =~ /^$spaces \*[ \t]+%([^ ]+)(?:[ \t]+(.+))?$/))
{
$kv{$1} = $2; $kv{$1} = $2;
if ($1 eq "file") { if ($1 eq "file") {
if (!$has_file) { if (!$has_file) {
@ -149,7 +160,8 @@ sub scan_dir {
$file = 1; $file = 1;
$has_file = 1; $has_file = 1;
}elsif($1 eq "param"){ }
elsif ($1 eq "param") {
my $p = $2; my $p = $2;
$p =~ /^([^ ]+)(?:[ \t]+(.+))?$/; $p =~ /^([^ ]+)(?:[ \t]+(.+))?$/;