Skip to content

Commit 75bd745

Browse files
committed
DOC: generate from json format
1 parent 9a4c79f commit 75bd745

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

documentation/mkref.bas

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ func get_field(row, key)
3535
get_field = result
3636
end
3737

38+
func fix_comments(comments)
39+
comments = translate(comments, "p. ", "")
40+
comments = translate(comments, "bq. ", "")
41+
comments = translate(comments, "bc. ", "")
42+
comments = translate(comments, "bc.. ", "")
43+
comments = translate(comments, "\\\"", "\"")
44+
comments = translate(comments, " ", " ")
45+
comments = translate(comments, "<code>", "--Example--" + chr(10))
46+
comments = translate(comments, "</code>", chr(10) + "--End Of Example--")
47+
comments = translate(comments, NL, chr(10))
48+
fix_comments = comments
49+
end
50+
3851
sub mk_help(byref in_map)
3952
local in_map_len = len(in_map) - 1
4053
for i = 0 to in_map_len
@@ -51,6 +64,7 @@ end
5164
sub mk_text_reference(byref in_map)
5265
local NL = "\\r\\n"
5366
local in_map_len = len(in_map) - 1
67+
local end_block = "<!-- end heading block -->"
5468

5569
? "SmallBASIC Language reference"
5670
? "See: http://smallbasic.sourceforge.net/?q=node/201"
@@ -69,13 +83,13 @@ sub mk_text_reference(byref in_map)
6983
?
7084
? brief
7185
?
86+
pos = instr(row, end_block) + len(end_block)
87+
if (pos < len(row)) then
88+
? fix_comments(mid(row, pos))
89+
endif
7290
comments = in_map(i).comment_body_value
7391
if (comments != "NULL") then
74-
comments = translate(comments, "&nbsp;", " ")
75-
comments = translate(comments, "<code>", "--Example--" + chr(10))
76-
comments = translate(comments, "</code>", chr(10) + "--End Of Example--")
77-
comments = translate(comments, NL, chr(10))
78-
? comments
92+
? fix_comments(comments)
7993
endif
8094
next i
8195
end

0 commit comments

Comments
 (0)