Huzaifa S
unread,Feb 17, 2016, 11:09:19 AM2/17/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Pretty Diff
I am fairly new javascript developer and I trying to figure out something I think will be easy for you to resolve. The code below is doing a diff on two XML documents.
var options = {
"source": srcXML,
"diff": diffXML,
"lang": "xml",
"langdefault": "xml",
"csvchar": ",",
"crlf": false,
"api": "dom",
"jsscope": false,
"braceline": false,
"bracepadding": false,
"braces": "knr",
"compressedcss": false,
"conditional": false,
"content": false,
"context": "",
"diffcomments": false,
"comments": "nocomment",
"difflabel": "new",
"diffspaceignore": false,
"diffview": "inline",
"dustjs": false,
"elseline": false,
"force_attribute": false,
"force_indent": false,
"html": false,
"insize": 4,
"methodchain": false,
"nocaseindent": false,
"objsort": "js",
"preserve": "all",
"quote": false,
"selectorlist": false,
"semicolon": false,
"sourcelabel": "base",
"space": true,
"style": "indent",
"tagmerge": false,
"tagsort": false,
"ternaryline": false,
"textpreserve": false,
"wrap": 80,
"inchar": " ",
"mode": "diff"
};
var pd = prettydiff(options); // returns and array: [beautified, report]
var pretty = pd[0];
var report = pd[1];
the value in 'report' from pd[1] gives me the results I am expecting.
<p>Code type is set to
<strong>markup</strong>.
</p>
<p>
<strong>Execution time:</strong>
<em>25.510 seconds </em>
</p>
<p>
<strong>Number of differences:</strong>
<em>113</em> differences from
<em>81</em> lines of code.
</p>
<p>Accessibility note.
<em> tags in the output represent character differences per lines compared.
</p>
But when I save the output of pd[0] as a XML document, it does not match the report I get when I run the same comparison using the HTML web tool. The HTML web tool is correcting rendering the report. How can I make result saved into pd[0] look the same as report rendered by the online tool. The diff output is not inline either even though I am indicating it in the options passed to pd. I need to make this work in a web app that does not run in the context of a browser or in nodejs.
Can you please provide tips to help me get this working?