Document tree generation to HTML output completed
[biaweb2.git] / biaweb.cpp
1 #include <iostream>
2 #include <fstream>
3 #include "biawebdocumenttree.hpp"
4 using namespace biaweb;
5
6 int main (int argc, char *argv[]) {
7
8 if (argc == 2)
9 {
10 std::shared_ptr<DocumentTree> tree (new DocumentTree (argv[1]));
11 tree.get()->set_stub ("");
12
13 std::shared_ptr<DocumentTree> a1 (new DocumentTree("Child a1"));
14 std::shared_ptr<DocumentTree> a2 (new DocumentTree("Child a2"));
15 std::shared_ptr<DocumentTree> a3 (new DocumentTree("Child a3"));
16 std::shared_ptr<DocumentTree> a4 (new DocumentTree("Child a4"));
17 std::shared_ptr<Document> d1 (new Document("Test Document", "",
18 ""));
19 d1.get()->set_markdown_content ("# Heading \n\nThis is some text, hello world");
20 a1.get()->add_document (d1.get());
21 a3.get()->add_child (a4.get());
22 a1.get()->add_child (a2.get());
23 a1.get()->add_child (a3.get());
24 tree.get()->add_child (a1.get());
25 std::cout << a3.get()->stub_hierarchy () << a3.get()->get_stub () << std::endl;
26 tree.get()->visualize_tree ();
27 tree.get()->create_tree_html (convert_title (argv[1]));
28 }
29 else
30 std::cout << "Usage: " << argv[0] << " <main tree>" << std::endl;
31
32 // Document doc;
33 // SideBar items;
34 // std::string title, contents, sidetitle;
35 // std::cout << "Enter document title: ";
36 // std::getline (std::cin, title);
37 // std::cout << "Enter markdown file of document: ";
38 // std::getline (std::cin, contents);
39 // while (1) {
40 // std::string name, url;
41 // std::cout << "Enter a sidebar item text (empty to end): ";
42 // std::getline (std::cin, name);
43 // if (name.empty()) break;
44 // std::cout << "Enter a sidebar item URL: ";
45 // std::getline (std::cin, url);
46 // SideBarItem item (name, url);
47 // items.add_sidebar_item (item);
48 // }
49 // std::cout << "Enter heading for sidebar: ";
50 // std::getline (std::cin, sidetitle);
51 // items.set_title (sidetitle);
52 // doc.set_title (title);
53 // std::ifstream f (contents);
54 // std::string markdown_contents ( (std::istreambuf_iterator<char> (f)),
55 // (std::istreambuf_iterator<char> ()) );
56
57 // doc.set_markdown_content (markdown_contents);
58 // doc.add_side_bar (items);
59
60 // doc.output_to_html ();
61
62 return 0;
63 }