@@ -65,6 +65,7 @@ def convert_to_jsondoc(
6565 indent : int | None = None ,
6666 source_format : str | None = None ,
6767 target_format : str | None = None ,
68+ force_page : bool = False ,
6869):
6970 """
7071 Convert to and from JSON-DOC format.
@@ -127,6 +128,7 @@ def convert_to_jsondoc(
127128 input_content if input_content is not None else input_file ,
128129 "html" ,
129130 format = source_format ,
131+ extra_args = ["--wrap=none" ],
130132 )
131133 except RuntimeError as e :
132134 # Handle different error message from Pandoc
@@ -143,7 +145,7 @@ def convert_to_jsondoc(
143145 else :
144146 raise e
145147
146- jsondoc = html_to_jsondoc (html_content )
148+ jsondoc = html_to_jsondoc (html_content , force_page = force_page )
147149
148150 # Serialize the jsondoc
149151 serialized_jsondoc = jsondoc_dump_json (jsondoc , indent = indent )
@@ -189,6 +191,12 @@ def main():
189191 help = "Number of spaces for indentation in the output JSON file" ,
190192 default = None ,
191193 )
194+ parser .add_argument (
195+ "--force-page" ,
196+ action = "store_true" ,
197+ help = "Force the creation of a page even if the input doesn't "
198+ "contain a top-level HTML structure" ,
199+ )
192200 args = parser .parse_args ()
193201
194202 try :
@@ -198,6 +206,7 @@ def main():
198206 indent = args .indent ,
199207 source_format = args .source_format ,
200208 target_format = args .target_format ,
209+ force_page = args .force_page ,
201210 )
202211 except (ValueError , RuntimeError ) as e :
203212 print (e )
0 commit comments