@@ -40,7 +40,7 @@ class Document(Base):
4040
4141 Args:
4242 id: The unique id of the document
43- title: Document title
43+ title: The document title
4444 ISBN: International Standard Book Number
4545 sections: The sections of the document
4646 """
@@ -65,24 +65,29 @@ class Document(Base):
6565
6666print (doc )
6767print (doc .sections [0 ].paragraphs [0 ].contents )
68- print (doc .sections [0 ].paragraphs [0 ].__getattribute__ ("contents" ))
68+ print (doc .sections [0 ].paragraphs [1 ].__getattribute__ ("contents" ))
6969
7070doc .to_json_file ("document.json" )
7171doc .to_yaml_file ("document.yaml" )
7272doc .to_bson_file ("document.bson" )
7373
74+ print (" >> Full document details in YAML format:\n " )
75+
76+ print (doc .to_yaml ())
77+
7478doc_md = doc .generate_documentation (format = "markdown" )
7579
7680with open ("document.md" , "w" ) as d :
7781 d .write (doc_md )
7882
83+
7984doc_rst = doc .generate_documentation (format = "rst" )
8085
8186with open ("document.rst" , "w" ) as d :
8287 d .write (doc_rst )
8388
8489
85- print ("\n Generating specification in dict form" )
90+ print ("\n >> Generating specification in dict form... " )
8691doc_dict = doc .generate_documentation (format = "dict" )
8792
8893import json
@@ -92,9 +97,12 @@ class Document(Base):
9297with open ("document.specification.json" , "w" ) as d :
9398 d .write (json .dumps (doc_dict , indent = 4 ))
9499
95- print ("Generating specification in YAML" )
100+ print (" >> Generating specification in YAML...\n " )
101+
96102with open ("document.specification.yaml" , "w" ) as d :
97- d .write (yaml .dump (doc_dict , indent = 4 , sort_keys = False ))
103+ yy = yaml .dump (doc_dict , indent = 4 , sort_keys = False )
104+ print (yy )
105+ d .write (yy )
98106
99107with open ("document.specification.bson" , "wb" ) as d :
100108 d .write (bson .encode (doc_dict ))
0 commit comments