0d9a3e897f88bf7e4a339c6063fa7aa532bc3d6c
[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 a3.get()->add_child (a4.get());
18 a1.get()->add_child (a2.get());
19 a1.get()->add_child (a3.get());
20 tree.get()->add_child (a1.get());
21 std::cout << a3.get()->stub_hierarchy () << a3.get()->get_stub () << std::endl;
22 tree.get()->visualize_tree ();
23 tree.get()->create_index (convert_title (argv[1]));
24 }
25 else
26 std::cout << "Usage: " << argv[0] << " <main tree>" << std::endl;
27
28 // Document doc;
29 // SideBar items;
30 // std::string title, contents, sidetitle;
31 // std::cout << "Enter document title: ";
32 // std::getline (std::cin, title);
33 // std::cout << "Enter markdown file of document: ";
34 // std::getline (std::cin, contents);
35 // while (1) {
36 // std::string name, url;
37 // std::cout << "Enter a sidebar item text (empty to end): ";
38 // std::getline (std::cin, name);
39 // if (name.empty()) break;
40 // std::cout << "Enter a sidebar item URL: ";
41 // std::getline (std::cin, url);
42 // SideBarItem item (name, url);
43 // items.add_sidebar_item (item);
44 // }
45 // std::cout << "Enter heading for sidebar: ";
46 // std::getline (std::cin, sidetitle);
47 // items.set_title (sidetitle);
48 // doc.set_title (title);
49 // std::ifstream f (contents);
50 // std::string markdown_contents ( (std::istreambuf_iterator<char> (f)),
51 // (std::istreambuf_iterator<char> ()) );
52
53 // doc.set_markdown_content (markdown_contents);
54 // doc.add_side_bar (items);
55
56 // doc.output_to_html ();
57
58 return 0;
59 }