Remove styling: use css
parent
9087d3d81b
commit
bd53a0a6d9
|
@ -222,29 +222,13 @@ namespace gtsam {
|
||||||
/* ************************************************************************ */
|
/* ************************************************************************ */
|
||||||
string DecisionTreeFactor::html(const KeyFormatter& keyFormatter,
|
string DecisionTreeFactor::html(const KeyFormatter& keyFormatter,
|
||||||
const Names& names) const {
|
const Names& names) const {
|
||||||
const string style =
|
|
||||||
"<style scoped=\'\'>\n"
|
|
||||||
" .dataframe tbody tr th:only-of-type {\n"
|
|
||||||
" vertical-align: middle;\n"
|
|
||||||
" }\n"
|
|
||||||
" .dataframe tbody tr th {\n"
|
|
||||||
" vertical-align: top;\n"
|
|
||||||
" }\n"
|
|
||||||
" .dataframe thead th {\n"
|
|
||||||
" text-align: right;\n"
|
|
||||||
" }\n"
|
|
||||||
"</style>\n";
|
|
||||||
|
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
|
|
||||||
// Print out preamble.
|
// Print out preamble.
|
||||||
ss << "<div>\n"
|
ss << "<div>\n<table class=\'DecisionTreeFactor\'>\n <thead>\n";
|
||||||
<< style
|
|
||||||
<< "<table border=\'1\' class=\'dataframe\'>\n"
|
|
||||||
" <thead>\n";
|
|
||||||
|
|
||||||
// Print out header row.
|
// Print out header row.
|
||||||
ss << " <tr style=\'text-align: right;\'>";
|
ss << " <tr>";
|
||||||
for (auto& key : keys()) {
|
for (auto& key : keys()) {
|
||||||
ss << "<th>" << keyFormatter(key) << "</th>";
|
ss << "<th>" << keyFormatter(key) << "</th>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,21 +161,9 @@ TEST(DecisionTreeFactor, htmlWithValueFormatter) {
|
||||||
DecisionTreeFactor f(A & B, "1 2 3 4 5 6");
|
DecisionTreeFactor f(A & B, "1 2 3 4 5 6");
|
||||||
string expected =
|
string expected =
|
||||||
"<div>\n"
|
"<div>\n"
|
||||||
"<style scoped=''>\n"
|
"<table class='DecisionTreeFactor'>\n"
|
||||||
" .dataframe tbody tr th:only-of-type {\n"
|
|
||||||
" vertical-align: middle;\n"
|
|
||||||
" }\n"
|
|
||||||
" .dataframe tbody tr th {\n"
|
|
||||||
" vertical-align: top;\n"
|
|
||||||
" }\n"
|
|
||||||
" .dataframe thead th {\n"
|
|
||||||
" text-align: right;\n"
|
|
||||||
" }\n"
|
|
||||||
"</style>\n"
|
|
||||||
"<table border='1' class='dataframe'>\n"
|
|
||||||
" <thead>\n"
|
" <thead>\n"
|
||||||
" <tr style='text-align: "
|
" <tr><th>A</th><th>B</th><th>value</th></tr>\n"
|
||||||
"right;'><th>A</th><th>B</th><th>value</th></tr>\n"
|
|
||||||
" </thead>\n"
|
" </thead>\n"
|
||||||
" <tbody>\n"
|
" <tbody>\n"
|
||||||
" <tr><th>Zero</th><th>-</th><td>1</td></tr>\n"
|
" <tr><th>Zero</th><th>-</th><td>1</td></tr>\n"
|
||||||
|
@ -191,11 +179,6 @@ TEST(DecisionTreeFactor, htmlWithValueFormatter) {
|
||||||
DecisionTreeFactor::Names names{{12, {"Zero", "One", "Two"}},
|
DecisionTreeFactor::Names names{{12, {"Zero", "One", "Two"}},
|
||||||
{5, {"-", "+"}}};
|
{5, {"-", "+"}}};
|
||||||
string actual = f.html(keyFormatter, names);
|
string actual = f.html(keyFormatter, names);
|
||||||
cout << expected << endl;
|
|
||||||
cout << actual << endl;
|
|
||||||
ofstream ef("expected=html.txt"), af("actual-html.txt");
|
|
||||||
ef << expected << endl;
|
|
||||||
af << actual << endl;
|
|
||||||
EXPECT(actual == expected);
|
EXPECT(actual == expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue