From 075a7cd0fdf8936d1e4726dc2d78b98d7524587a Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sun, 26 Dec 2021 17:02:18 -0500 Subject: [PATCH] markdown that renders better on github/pages --- gtsam/discrete/DiscreteConditional.cpp | 6 +++--- gtsam/discrete/tests/testDiscreteBayesNet.cpp | 4 ++-- gtsam/discrete/tests/testDiscreteConditional.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gtsam/discrete/DiscreteConditional.cpp b/gtsam/discrete/DiscreteConditional.cpp index 080dbba9b..2d3a5ddf8 100644 --- a/gtsam/discrete/DiscreteConditional.cpp +++ b/gtsam/discrete/DiscreteConditional.cpp @@ -228,7 +228,7 @@ std::string DiscreteConditional::markdown( std::stringstream ss; // Print out signature. - ss << " $P("; + ss << " *P("; bool first = true; for (Key key : frontals()) { if (!first) ss << ","; @@ -237,7 +237,7 @@ std::string DiscreteConditional::markdown( } if (nrParents() == 0) { // We have no parents, call factor method. - ss << ")$:" << std::endl; + ss << ")*:\n" << std::endl; ss << DecisionTreeFactor::markdown(keyFormatter); return ss.str(); } @@ -250,7 +250,7 @@ std::string DiscreteConditional::markdown( ss << keyFormatter(parent); first = false; } - ss << ")$:" << std::endl; + ss << ")*:\n" << std::endl; // Print out header and construct argument for `cartesianProduct`. std::vector> pairs; diff --git a/gtsam/discrete/tests/testDiscreteBayesNet.cpp b/gtsam/discrete/tests/testDiscreteBayesNet.cpp index 7a5f180ad..1de45905a 100644 --- a/gtsam/discrete/tests/testDiscreteBayesNet.cpp +++ b/gtsam/discrete/tests/testDiscreteBayesNet.cpp @@ -180,13 +180,13 @@ TEST(DiscreteBayesNet, markdown) { string expected = "`DiscreteBayesNet` of size 2\n" "\n" - " $P(Asia)$:\n" + " *P(Asia)*:\n\n" "|Asia|value|\n" "|:-:|:-:|\n" "|0|0.99|\n" "|1|0.01|\n" "\n" - " $P(Smoking|Asia)$:\n" + " *P(Smoking|Asia)*:\n\n" "|Asia|0|1|\n" "|:-:|:-:|:-:|\n" "|0|0.8|0.2|\n" diff --git a/gtsam/discrete/tests/testDiscreteConditional.cpp b/gtsam/discrete/tests/testDiscreteConditional.cpp index 74092d17c..604b0ce71 100644 --- a/gtsam/discrete/tests/testDiscreteConditional.cpp +++ b/gtsam/discrete/tests/testDiscreteConditional.cpp @@ -114,7 +114,7 @@ TEST(DiscreteConditional, markdown_prior) { DiscreteKey A(Symbol('x', 1), 3); DiscreteConditional conditional(A % "1/2/2"); string expected = - " $P(x1)$:\n" + " *P(x1)*:\n\n" "|x1|value|\n" "|:-:|:-:|\n" "|0|0.2|\n" @@ -131,7 +131,7 @@ TEST(DiscreteConditional, markdown_multivalued) { DiscreteConditional conditional( A | B = "2/88/10 2/20/78 33/33/34 33/33/34 95/2/3"); string expected = - " $P(a1|b1)$:\n" + " *P(a1|b1)*:\n\n" "|b1|0|1|2|\n" "|:-:|:-:|:-:|:-:|\n" "|0|0.02|0.88|0.1|\n" @@ -149,7 +149,7 @@ TEST(DiscreteConditional, markdown) { DiscreteKey A(2, 2), B(1, 2), C(0, 3); DiscreteConditional conditional(A, {B, C}, "0/1 1/3 1/1 3/1 0/1 1/0"); string expected = - " $P(A|B,C)$:\n" + " *P(A|B,C)*:\n\n" "|B|C|0|1|\n" "|:-:|:-:|:-:|:-:|\n" "|0|0|0|1|\n"