mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Remove all traces of the horrid "API Doc" code documentation tool
This commit is contained in:
parent
93e9cf089e
commit
5edec55a86
23
doc/Makefile
23
doc/Makefile
@ -107,7 +107,6 @@ install-local:
|
||||
# Generated asciidoc files
|
||||
|
||||
# Scripts and Dependencies
|
||||
CODE2DOC = $(srcdir)tools/code2doc
|
||||
HELP2DOC = $(srcdir)tools/help2doc
|
||||
CONF2DOC = $(srcdir)tools/conf2doc
|
||||
KEYS2DOC = $(srcdir)tools/keys2doc
|
||||
@ -130,9 +129,6 @@ quiet_cmd_conf2doc = ' [$(LINK_COLOR)CONF2DOC$(END_COLOR)] $(RELPATH)$@'
|
||||
quiet_cmd_keys2doc = ' [$(LINK_COLOR)KEYS2DOC$(END_COLOR)] $(RELPATH)$@'
|
||||
cmd_keys2doc = $(LOCALES) $(KEYS2DOC) $(KBDBIND) $@ > $@
|
||||
|
||||
quiet_cmd_code2doc = ' [$(LINK_COLOR)CODE2DOC$(END_COLOR)] $(RELPATH)$@'
|
||||
cmd_code2doc = $(LOCALES) $(CODE2DOC) $< > $@
|
||||
|
||||
features.txt: $(FEATURES) $(CONF2DOC)
|
||||
$(call cmd,conf2doc)
|
||||
|
||||
@ -143,25 +139,6 @@ option-%.txt: $(ELINKS) $(HELP2DOC)
|
||||
$(call cmd,help2doc)
|
||||
|
||||
|
||||
# API Docs
|
||||
|
||||
ifeq ($(findstring api,$(MAKECMDGOALS)),api)
|
||||
API = $(shell find $(top_srcdir)/src/ -name '*.h' -exec grep -q 'API Doc' \{\} \; -printf "%p " | sort)
|
||||
endif
|
||||
|
||||
define api_doc
|
||||
API_TXT += api/$(2).txt
|
||||
api/$(2).txt: $(1) $(CODE2DOC)
|
||||
@test -d api || $(MKINSTALLDIRS) api
|
||||
$$(call cmd,code2doc)
|
||||
endef
|
||||
|
||||
api_name = $(shell sed -n 's/.*API Doc\s*::\s*\([^ ]*\).*/\1/p' < $(1))
|
||||
$(foreach api,$(API),$(eval $(call api_doc,$(api),$(call api_name,$(api)))))
|
||||
|
||||
api: $(patsubst %.txt,%.html,$(API_TXT))
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Build commands and macros
|
||||
|
||||
|
@ -5,15 +5,6 @@
|
||||
#
|
||||
# General purpose:
|
||||
# - man:page[section]: which is used for linking between ELinks manpages.
|
||||
#
|
||||
# API Doc:
|
||||
# - id:[]
|
||||
# - enum:[]
|
||||
# - func:[]
|
||||
# - struct:[]
|
||||
# - macro:[]
|
||||
# - typedef:[]
|
||||
# - ref:[]
|
||||
|
||||
[replacements]
|
||||
(^|[^-])--($|[^-])=\1--\2
|
||||
@ -66,27 +57,4 @@ squote='
|
||||
{eval:re.match("elinks", "{target}") != None}<a href="{target}.{0}.html">{target}({0})</a>
|
||||
{eval:re.match("elinks", "{target}") == None}<b>{target}({0})</b>
|
||||
|
||||
# API Doc macros
|
||||
|
||||
[id-inlinemacro]
|
||||
<a id="{0}" href="#{0}">{0}</a>
|
||||
|
||||
[enum-inlinemacro]
|
||||
<a id="{target}">enum {target}: {0}</a>
|
||||
|
||||
[func-inlinemacro]
|
||||
<a id="{target}">{target}(): {0}</a>
|
||||
|
||||
[struct-inlinemacro]
|
||||
<a id="{target}">struct {target}: {0}</a>
|
||||
|
||||
[macro-inlinemacro]
|
||||
<a id="{target}">struct {target}: {0}</a>
|
||||
|
||||
[typedef-inlinemacro]
|
||||
<a id="{target}">typedef {target}: {0}</a>
|
||||
|
||||
[ref-inlinemacro]
|
||||
<a href="{target}#{0}">{0}</a>
|
||||
|
||||
endif::backend-xhtml11[]
|
||||
|
@ -1,112 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use Getopt::Std;
|
||||
|
||||
my $HELP = "Usage: $0 [FILE]...
|
||||
Parses [FILE], outputing the result to stdout.";
|
||||
|
||||
sub usage {
|
||||
print "@_\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
our($opt_h, $opt_v, $title, $body, $indent, $idpath, $inblock);
|
||||
|
||||
getopts("hv") or usage($HELP);
|
||||
$opt_v and usage("Copyleft (c) 2006, Russ Rowan (See `COPYING')");
|
||||
usage($HELP) if $opt_h or @ARGV < 1;
|
||||
|
||||
sub put_section {
|
||||
if ($title) {
|
||||
print "\n$title\n";
|
||||
$title =~ s/[^-]/-/g;
|
||||
print "$title\n" if not $indent;
|
||||
}
|
||||
if ($body) {
|
||||
$body =~ s/#newline#/$indent/g;
|
||||
print "$body\n";
|
||||
}
|
||||
$title = $body = undef;
|
||||
}
|
||||
|
||||
$idpath = $title = $body = "";
|
||||
while (<>)
|
||||
{
|
||||
my $end = s/\s*\*+\//\n/ ? 'yes' : undef;
|
||||
|
||||
if ($end and /[^=]*[\s*](\w+)[\s:,;].*\/\*:\s*(.*)([.]\s*)?$/) {
|
||||
# Implicit id for enum values and struct members.
|
||||
print "\nid:[$idpath$1]::\n\t$2.\n";
|
||||
|
||||
} elsif ($inblock) {
|
||||
# Redo the indentation, preserve empty lines.
|
||||
s/^(\s|\*)*//;
|
||||
s/^$/\n/;
|
||||
$body .= "#newline#" . $_;
|
||||
|
||||
} elsif (s/\s*\/\*\*+\s*(.*)/$1/) {
|
||||
# Found magic header; flush, record title and set indentation.
|
||||
put_section;
|
||||
$title = "$1";
|
||||
$indent = /::/ ? "\t" : "";
|
||||
|
||||
} else {
|
||||
next if not ($title or $body) or /^\s$/;
|
||||
|
||||
my $orig_title = $title;
|
||||
|
||||
|
||||
# Combine multi-line declarations to one. Break at empty
|
||||
# for #define ...
|
||||
while (not /(struct|enum|typedef|[^=])*[\s*](\w+).*[\[:,;{]/) {
|
||||
my $line = $_;
|
||||
$_ .= <>;
|
||||
last if $_ eq $line;
|
||||
}
|
||||
|
||||
if (/struct\s+(\w+)\s*{/) {
|
||||
$title = "struct:$1" . "[$title]";
|
||||
$idpath = "$1.";
|
||||
|
||||
} elsif (/enum\s+(\w+)\s*{/) {
|
||||
$title = "enum:$1" . "[$title]";
|
||||
$idpath = "";
|
||||
|
||||
} elsif (/#define/) {
|
||||
if (/#define\s+(\w+)[(]/) {
|
||||
$title = "func:$1" . "[$title]";
|
||||
} elsif (/#define\s+(\w+)/) {
|
||||
$title = "macro:$1" . "[$title]";
|
||||
}
|
||||
$idpath = "";
|
||||
|
||||
} elsif (/typedef/) {
|
||||
if (/.*\(\*(\w+)\)\(/) {
|
||||
$title = "typedef:$1" . "[$title]";
|
||||
} elsif (/typedef.*\s(\w+);/) {
|
||||
$title = "typedef:$1" . "[$title]";
|
||||
}
|
||||
$idpath = "";
|
||||
|
||||
} elsif (/.*[\s*](\w+)\(/) {
|
||||
$title = "func:$1" . "[$title]";
|
||||
$idpath = "";
|
||||
|
||||
} elsif (/.*\(\*(\w+)\)\(/) {
|
||||
$body = "#newline#" . $title if not $body;
|
||||
$title = "id:[$idpath$1]::";
|
||||
$indent = "\t";
|
||||
|
||||
} elsif (/[^=]*[\s*](\w+)[\[\s,:;]/) {
|
||||
$body = "#newline#" . $title if not $body;
|
||||
$title = "id:[$idpath$1]::";
|
||||
$indent = "\t";
|
||||
}
|
||||
put_section if $orig_title ne $title;
|
||||
next;
|
||||
}
|
||||
|
||||
$inblock = $end ? undef : 'yes';
|
||||
}
|
Loading…
Reference in New Issue
Block a user