markdown-like

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

View File

@@ -63,6 +63,7 @@ examples: $(EXAMPLES)
format:
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)
$(CC) $(L_LDFLAGS) -shared -o $@ $^ $(L_LIBS)

View File

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