mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Handle !define in JSON #if fields - fixes docs
This commit is contained in:
parent
0eee205e88
commit
1eb760cadb
@ -382,10 +382,19 @@ for jsondata in detail:
|
||||
if "ifndef" in jsondata:
|
||||
desc.append("\n\n**Note:** This is not available in "+common.get_ifdef_description(jsondata["ifndef"]));
|
||||
if "#if" in jsondata:
|
||||
d = jsondata["#if"].replace("||", " and ").replace("&&", " with ")
|
||||
d = jsondata["#if"];
|
||||
dprefix = "This is only available in ";
|
||||
if re.match('^!defined\((.+?)\) && !defined\((.+?)\)$', d):
|
||||
dprefix = "This is not available in ";
|
||||
d = re.sub('^!defined\((.+?)\) && !defined\((.+?)\)$', "defined(\\1) or defined(\\2)", d)
|
||||
if re.match('^!defined\((.+?)\)$', d):
|
||||
dprefix = "This is not available in ";
|
||||
d = re.sub('^!defined\((.+?)\)$', "defined(\\1)", d)
|
||||
d = re.sub('!defined\(', "not defined(", d)
|
||||
d = d.replace("||", " and ").replace("&&", " with ")
|
||||
d = re.sub('defined\((.+?)\)', replace_with_ifdef_description, d)
|
||||
d = re.sub('(.*)_COUNT>=(.*)', "devices with more than \\2 \\1 peripherals", d)
|
||||
desc.append("\n\n**Note:** This is only available in "+d);
|
||||
desc.append("\n\n**Note:** "+dprefix+d);
|
||||
html_description(desc, jsondata["name"])
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user