Skip to content

Commit 25c0221

Browse files
committed
DOC: generate from json format
1 parent 58c8c69 commit 25c0221

File tree

7 files changed

+73
-121
lines changed

7 files changed

+73
-121
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Added "industrial" editor theme from Shian (slot 2)
77
Runtime errors now show source screen with red error highlighter
88
Form refresh command now takes an boolean arg, true=push ui state to vars
9+
Removed BALLOC, MALLOC and VADR keywords
910

1011
2016-02-11
1112
Added export to mobile command (SDL)

documentation/mkref.bas

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,19 @@ else
2727
mk_help(in_map)
2828
fi
2929

30-
func get_field(row, key)
30+
func get_field(row, key, escq)
3131
local n1, n2, result
3232
n1 = instr(row, key) + len(key)
3333
n2 = instr(n1, row, "\\r") - n1
3434
result = mid(row, n1, n2)
35+
if (escq) then
36+
result = translate(result, "\\\"", "\"\"")
37+
else
38+
result = translate(result, "\\\"", "\"")
39+
endif
3540
get_field = result
3641
end
3742

38-
func get_help_field(row, key)
39-
local result
40-
result = get_field(row, key)
41-
result = translate(result, "\\\"", "\"\"")
42-
get_help_field = result
43-
end
44-
4543
func fix_comments(comments, keyword)
4644
comments = translate(comments, "p. ", "")
4745
comments = translate(comments, "bq. ", "")
@@ -51,8 +49,9 @@ func fix_comments(comments, keyword)
5149
comments = translate(comments, "**", "")
5250
comments = translate(comments, " ", " ")
5351
comments = translate(comments, "\\\"", "\"")
54-
comments = translate(comments, "<code>", "----[ " + keyword + " example. cut here ]----" + chr(10))
55-
comments = translate(comments, "</code>", chr(10) + "----[ cut here ]----")
52+
comments = translate(comments, "<code>", "----[ " + keyword + " example. cut here ]--->" + chr(10))
53+
comments = translate(comments, "</code>", chr(10) + "<---[ cut here ]----" + chr(10))
54+
comments = translate(comments, "\\r\\n\\r\\n", chr(10))
5655
comments = translate(comments, "\\r\\n", chr(10))
5756
fix_comments = comments
5857
end
@@ -62,11 +61,11 @@ sub mk_help(byref in_map)
6261
local in_map_len = len(in_map) - 1
6362
for i = 0 to in_map_len
6463
row = in_map(i).body_value
65-
group = get_help_field(row, "group=")
66-
type = get_help_field(row, "type=")
67-
keyword = get_help_field(row, "keyword=")
68-
syntax = get_help_field(row, "syntax=")
69-
brief = get_help_field(row, "brief=")
64+
group = get_field(row, "group=", true)
65+
type = get_field(row, "type=", true)
66+
keyword = get_field(row, "keyword=", true)
67+
syntax = get_field(row, "syntax=", true)
68+
brief = get_field(row, "brief=", true)
7069
while (i + 1 < in_map_len && in_map(i).entity_id == in_map(i + 1).entity_id)
7170
i++
7271
wend
@@ -80,7 +79,12 @@ sub mk_text_reference(byref in_map)
8079
local end_block = "<!-- end heading block -->"
8180

8281
? "SmallBASIC Language reference"
83-
? "See: http://smallbasic.sourceforge.net/?q=node/201"
82+
?
83+
? "Online:
84+
? "http://smallbasic.sourceforge.net/?q=node/201"
85+
?
86+
? "Generated with:
87+
? "https://github.com/smallbasic/SmallBASIC/blob/master/documentation/mkref.bas
8488
?
8589
? " _____ _ _ ____ _____ _____ _____
8690
? " / ____| | | | _ \ /\ / ____|_ _/ ____|
@@ -89,14 +93,15 @@ sub mk_text_reference(byref in_map)
8993
? " ____) | | | | | | (_| | | | |_) / ____ \ ____) |_| || |____
9094
? " |_____/|_| |_| |_|\__,_|_|_|____/_/ \_\_____/|_____\_____|
9195
?
96+
?
9297

9398
for i = 0 to in_map_len
9499
row = in_map(i).body_value
95-
group = get_field(row, "group=")
96-
type = get_field(row, "type=")
97-
keyword = get_field(row, "keyword=")
98-
syntax = get_field(row, "syntax=")
99-
brief = translate(get_field(row, "brief="), "\\\"", "\"")
100+
group = get_field(row, "group=", false)
101+
type = get_field(row, "type=", false)
102+
keyword = get_field(row, "keyword=", false)
103+
syntax = get_field(row, "syntax=", false)
104+
brief = get_field(row, "brief=", false)
100105

101106
? (i+1) + ". (" + group + ") " + keyword
102107
?

0 commit comments

Comments
 (0)