From 546582ea0251245b3396ca8f0e4ef58a6d382fd3 Mon Sep 17 00:00:00 2001
From: Richard Berger <richard.berger@temple.edu>
Date: Mon, 12 Sep 2016 17:43:47 -0400
Subject: [PATCH] Escape pipe characters

---
 doc/utils/converters/lammpsdoc/txt2rst.py  | 2 ++
 doc/utils/converters/tests/test_txt2rst.py | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/doc/utils/converters/lammpsdoc/txt2rst.py b/doc/utils/converters/lammpsdoc/txt2rst.py
index 1bc279c0f3..3576f721ab 100755
--- a/doc/utils/converters/lammpsdoc/txt2rst.py
+++ b/doc/utils/converters/lammpsdoc/txt2rst.py
@@ -65,6 +65,7 @@ class RSTMarkup(Markup):
     def escape_rst_chars(self, text):
         text = text.replace('*', '\\*')
         text = text.replace('^', '\\^')
+        text = text.replace('|', '\\|')
         text = re.sub(r'([^"])_', r'\1\\_', text)
         return text
 
@@ -72,6 +73,7 @@ class RSTMarkup(Markup):
         text = text.replace('\\*', '*')
         text = text.replace('\\^', '^')
         text = text.replace('\\_', '_')
+        text = text.replace('\\|', '|')
         return text
 
     def inline_math(self, text):
diff --git a/doc/utils/converters/tests/test_txt2rst.py b/doc/utils/converters/tests/test_txt2rst.py
index 2fa2bd699e..b662a24e3f 100644
--- a/doc/utils/converters/tests/test_txt2rst.py
+++ b/doc/utils/converters/tests/test_txt2rst.py
@@ -81,6 +81,10 @@ class TestMarkup(unittest.TestCase):
         s = self.markup.convert("[*bold] and {italic*}")
         self.assertEqual("**\*bold** and *italic\**", s)
 
+    def test_escape_rst_characters(self):
+      s = self.markup.convert("[|bold|] and {|italic|}")
+      self.assertEqual("**\|bold\|** and *\|italic\|*", s)
+
     def test_escape_hat_character(self):
         s = self.markup.convert("x^2")
         self.assertEqual("x\^2", s)
-- 
GitLab