CiscoDevNet / yang-explorer

An open-source Yang Browser and RPC Builder Application
Apache License 2.0
438 stars 177 forks source link

YANG viewer shows duplicated Description for a node #55

Closed maixuanhan closed 7 years ago

maixuanhan commented 7 years ago

In Yang detailed information section (panel on the right), the Description of any node is duplicated (means Description is shown twice)

rustogi commented 7 years ago

@maixuanhan Yes looks like an issue. Good catch.

Can you try patching the following diffs to see if this fixes this issue?


diff --git a/server/explorer/plugins/cxml.py b/server/explorer/plugins/cxml.py
index 7f4945d..e8d1a70 100644
--- a/server/explorer/plugins/cxml.py
+++ b/server/explorer/plugins/cxml.py
@@ -278,7 +278,7 @@ class Cxml:
         description = self.get_description(s)
         if description != '':
             desc = description.replace('<', '&lt')
-            desc += description.replace('>', '&gt')
+            desc = desc.replace('>', '&gt')
             cdata = ET.Element('![CDATA[')
             cdata.text = desc
             desc_node = ET.Element('description')

Here is a screenshot showing the repetition issue is fixed.

screen shot 2017-05-13 at 11 53 28 pm

maixuanhan commented 7 years ago

Fixed

rustogi commented 7 years ago

@maixuanhan Tx for trying the fix. I will get the issue fix committed soon.