1- import os
2- import re
3- import textwrap
41import json
2+ import os
3+
4+ # import re
5+ # import textwrap
6+
7+ # SIGNED_DOCS_SPECS="signed_doc.json"
8+ SIGNED_DOCS_SPECS = "includes/signed_doc.json"
59
6- #SIGNED_DOCS_SPECS="signed_doc.json"
7- SIGNED_DOCS_SPECS = "includes/signed_doc.json"
810
911def uuid_as_cbor (uuid ):
1012 return f"37(h'{ uuid .replace ('-' , '' )} ')"
@@ -19,6 +21,7 @@ def get_signed_doc_data(env):
1921 with open (full_filename , "r" ) as f :
2022 return json .load (f )
2123
24+
2225def doc_type_summary (env ):
2326 """
2427 Generate a Document Base Type Summary from the Document Specifications Data
@@ -34,7 +37,9 @@ def doc_type_summary(env):
3437"""
3538
3639 for k in doc_types :
37- doc_type_summary += f"| { k } | `{ doc_types [k ]} ` | `{ uuid_as_cbor (doc_types [k ])} ` |\n "
40+ doc_type_summary += (
41+ f"| { k } | `{ doc_types [k ]} ` | `{ uuid_as_cbor (doc_types [k ])} ` |\n "
42+ )
3843
3944 return doc_type_summary
4045 except Exception as exc :
@@ -50,23 +55,25 @@ def name_for_uuid(doc_types, uuid):
5055 return k
5156 return "Unknown"
5257
53-
54- def name_to_spec_link (name ,ref = None ):
58+
59+ def name_to_spec_link (name , ref = None ):
5560 """
5661 Create a link to a document type, and an optional ref inside the document.
5762 """
58- link = "./../catalyst_docs/" + name .lower ().replace (' ' , '_' ) + ".md"
63+ link = "./../catalyst_docs/" + name .lower ().replace (" " , "_" ) + ".md"
5964 if ref is not None :
6065 link += f"#{ ref } "
6166 return link
6267
68+
6369def base_types (docs , doc_types , name ):
6470 types = docs [name ]["type" ]
6571 type_names = ""
6672 for sub_type in types :
6773 type_names += name_for_uuid (doc_types , sub_type ) + "/"
6874 return type_names [:- 1 ]
6975
76+
7077def types_as_cbor (docs , name ):
7178 types = docs [name ]["type" ]
7279 type_names = "["
@@ -91,16 +98,24 @@ def doc_type_details(env):
9198"""
9299
93100 for k in docs :
94- doc_type_details += f"| { k } | { base_types (docs ,doc_types ,k )} | { types_as_cbor (docs ,k )} | [Specification]({ name_to_spec_link (k )} ) | \n "
101+ doc_type_details += f"| { k } | { base_types (docs , doc_types , k )} | { types_as_cbor (docs , k )} | [Specification]({ name_to_spec_link (k )} ) | \n "
95102
96103 return doc_type_details
97104 except Exception as exc :
98105 return f"{ exc } "
99106
100- #class env:
107+
108+ def signed_doc_details (env , name ):
109+ """
110+ Generate Signed Document Detailed Documentation Page.
111+ """
112+ return name + "\n " + "test\n "
113+
114+
115+ # class env:
101116# project_dir = "/home/steven/Development/iohk/catalyst-libs/specs"
102117
103- #if __name__ == '__main__':
118+ # if __name__ == '__main__':
104119
105- # print(doc_type_details(env))
106- # print(doc_type_summary(env))
120+ # print(doc_type_details(env))
121+ # print(doc_type_summary(env))
0 commit comments