Skip to content

Commit

Permalink
Merge pull request #81 from KamasamaK/showParamType
Browse files Browse the repository at this point in the history
Added display of param type. Changed display of return type to match.
  • Loading branch information
jcberquist authored Jul 14, 2017
2 parents 8854b92 + 895bc95 commit f52eda2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cfdocs/cfdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def build_cfdoc(function_or_tag, data):
cfdoc["html"]["links"] = [{"href": "https://cfdocs.org" + "/" + function_or_tag, "text": "cfdocs.org" + "/" + function_or_tag}]
cfdoc["html"]["header"] = data["syntax"].replace("<", "&lt;").replace(">", "&gt;")
if len(data["returns"]) > 0:
cfdoc["html"]["header"] += ":" + data["returns"]
cfdoc["html"]["header"] += ": " + data["returns"]

cfdoc["html"]["description"] = "<div class=\"engines\">"
for engine in sorted(CFDOCS_ENGINES):
Expand All @@ -186,6 +186,8 @@ def build_cfdoc(function_or_tag, data):
cfdoc["html"]["body"] = "<h4>ARGUMENT REFERENCE</h4>" if data["type"] == "function" else "<h4>ATTRIBUTE REFERENCE</h4>"
for param in data["params"]:
param_variables = {"name": param["name"], "description": param["description"].replace("\n ", "<br>").replace("\n", "<br>"), "values": ""}
if "type" in param and len(param["type"]):
param_variables["name"] += ": " + param["type"]
if "values" in param and len(param["values"]):
param_variables["values"] = "<em>values:</em> " + ", ".join([str(value) for value in param["values"]])
if "required" in param and param["required"]:
Expand All @@ -212,7 +214,7 @@ def build_completion_doc(function_call_params, data):
cfdoc = {"styles": STYLES, "adaptive_styles": ADAPTIVE_STYLES, "html": {}}
cfdoc["html"]["header"] = data["syntax"].split('(')[0] + "(...)"
if len(data["returns"]) > 0:
cfdoc["html"]["header"] += ":" + data["returns"]
cfdoc["html"]["header"] += ": " + data["returns"]

cfdoc["html"]["description"] = ""
cfdoc["html"]["body"] = ""
Expand All @@ -228,6 +230,8 @@ def build_completion_doc(function_call_params, data):

if is_active:
param_variables = {"name": param["name"], "description": param["description"].replace("\n", "<br>"), "values": ""}
if "type" in param and len(param["type"]):
param_variables["name"] += ": " + param["type"]
if "values" in param and len(param["values"]):
param_variables["values"] = "<em>values:</em> " + ", ".join([str(value) for value in param["values"]])
if len(param_variables["description"]) > 0 or len(param_variables["values"]) > 0:
Expand Down

0 comments on commit f52eda2

Please sign in to comment.