diff --git a/AstConv/HtmlStruct.fs b/AstConv/HtmlStruct.fs index d36e9fc..aa8e39d 100644 --- a/AstConv/HtmlStruct.fs +++ b/AstConv/HtmlStruct.fs @@ -496,6 +496,7 @@ open System.IO type PageText = interface + abstract member bindPage:unit ->obj abstract member getHtmlText:unit -> string end @@ -746,6 +747,9 @@ open System.IO | _ -> () interface PageText with + member this.bindPage():obj = + page + member this.getHtmlText(): string = let doc = this.getHtmlDocument() diff --git a/AstConv/Program.fs b/AstConv/Program.fs index 7c2b97b..1ad452e 100644 --- a/AstConv/Program.fs +++ b/AstConv/Program.fs @@ -4,6 +4,7 @@ open System.Xml open HtmlStruct.Assemble open HtmlStruct.Content open HtmlStruct.Present +open System.IO let doc = XmlDocument() @@ -20,8 +21,7 @@ let story_pages = story_page_assemble(visitor.contents()) |> List.map List.iter (fun it -> (it:?>PageAccess).setPageRoot("E:")) - -let maker = volume_pages @ story_pages @ point_pages +let makers = volume_pages @ story_pages @ point_pages |> List.map(fun page_unit -> match page_unit with | :? PointPage as point -> @@ -32,9 +32,7 @@ let maker = volume_pages @ story_pages @ point_pages PageMaker(story) | _ -> failwith "" ) -let docx0 = maker.Item(5).getHtmlText() -let docx1 = maker.Item(18).getHtmlText() -let docx2 = maker.Item(22).getHtmlText() -for refs in point_pages do - System.Console.WriteLine(refs.ToString()) \ No newline at end of file +for refs in makers do + let file_path = (refs.bindPage() :?> PageAccess).pageURL() + File.WriteAllLines(file_path, [refs.getHtmlText()]) \ No newline at end of file