Funny, I just sent the fix for this to Bob last night.  The problem is in j2s's 
implementation of String.$replace.  It does not escape the | character.  This 
is the correct implementation:

String.prototype.$replace=function(a,b){a=a.replace(/([\|\\\/\$\.\*\+\{\}\?\^\(\)\[\]])/g,function(a,b){return"\\"+b});return
 this.replace(RegExp(a,"gm"),b)}; 

The previous implementation is missing the "\|".  You can probably make the 
change on line 38 of core.z.js.

Hope this helps,
-Dave

On Jun 13, 2013, at 5:53 PM, jmol-users-requ...@lists.sourceforge.net wrote:

> To: <jmol-users@lists.sourceforge.net>
> Message-ID: <51ba423e.22328.902fc...@angel.herraez.uah.es>
> Content-Type: text/plain; charset="US-ASCII"
> 
> Solved!
> 
> Ok, I found an email thread from Nov.2012 which gave me the clue:
> 
> Changing the vertical bars (pipes) for \n solves the issue and works both for
> HTML5 and Java modes.
> 
> Bob, maybe the documentation should be ammended now:
> http://www.stolaf.edu/academics/chemapps/jmol/docs/#data
> says
> "In the specific case of a model file, if it is desired to use no new-line
> characters, you can start the data with | (vertical bar) and then use a 
> vertical
> bar to separate all lines"
> 
> Note that I am defining this model data in javascript, and so cannot use
> actual newlines - that's why I went for the vertical bars. But now the 
> solution
> is using literal  \n  in the javascript string.


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to