Added summary to the document tree index
[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 tree.get()->set_markdown_summary ("# Hello there\n\n\
13 These are some contents for this page.");
14
15 std::shared_ptr<DocumentTree> a1 (new DocumentTree("Child a1"));
16 std::shared_ptr<DocumentTree> a2 (new DocumentTree("Child a2"));
17 std::shared_ptr<DocumentTree> a3 (new DocumentTree("Child a3"));
18 std::shared_ptr<DocumentTree> a4 (new DocumentTree("Child a4"));
19 std::shared_ptr<Document> d1 (new Document("Test Document", "",
20 ""));
21 d1.get()->set_markdown_content ("# Heading \n\nThis is some text, hello world");
22 a1.get()->add_document (d1.get());
23 a3.get()->add_child (a4.get());
24 a1.get()->add_child (a2.get());
25 a1.get()->add_child (a3.get());
26 tree.get()->add_child (a1.get());
27 std::cout << a3.get()->stub_hierarchy () << a3.get()->get_stub () << std::endl;
28 tree.get()->visualize_tree ();
29 tree.get()->create_tree_html (convert_title (argv[1]));
30 }
31 else
32 std::cout << "Usage: " << argv[0] << " <main tree>" << std::endl;
33
34 // Document doc;
35 // SideBar items;
36 // std::string title, contents, sidetitle;
37 // std::cout << "Enter document title: ";
38 // std::getline (std::cin, title);
39 // std::cout << "Enter markdown file of document: ";
40 // std::getline (std::cin, contents);
41 // while (1) {
42 // std::string name, url;
43 // std::cout << "Enter a sidebar item text (empty to end): ";
44 // std::getline (std::cin, name);
45 // if (name.empty()) break;
46 // std::cout << "Enter a sidebar item URL: ";
47 // std::getline (std::cin, url);
48 // SideBarItem item (name, url);
49 // items.add_sidebar_item (item);
50 // }
51 // std::cout << "Enter heading for sidebar: ";
52 // std::getline (std::cin, sidetitle);
53 // items.set_title (sidetitle);
54 // doc.set_title (title);
55 // std::ifstream f (contents);
56 // std::string markdown_contents ( (std::istreambuf_iterator<char> (f)),
57 // (std::istreambuf_iterator<char> ()) );
58
59 // doc.set_markdown_content (markdown_contents);
60 // doc.add_side_bar (items);
61
62 // doc.output_to_html ();
63
64 return 0;
65 }