Difference between revisions of "Inlined MDL Molfile"

From Jmol
Jump to navigation Jump to search
m (add to Category)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Inlined MDL Molfile ==
 
== Inlined MDL Molfile ==
 +
This uses <code>inlineContents</code> tag with MOL-formatted data:
  
 
<jmol>
 
<jmol>
Line 49: Line 50:
 
   </jmolApplet>
 
   </jmolApplet>
 
</jmol>
 
</jmol>
 +
(The MOL data above have normal line breaks.)
  
<!--  This problem was solved on 8-9 Dec. 2008
+
It can also be done with MOL data that has no newlines but has pipe characters instead:
This page does not currently display correctly.  the problem seems to be the first three lines of the Molfile.
 
If lines  2 and 3 are left blank, the current system strips these lines out entirely, invalidating the Molfile.
 
A title in line  2 preserves it, but we are currently finding out what line 3 should be!
 
  
The solution is to preserve blank lines in inlined data files.--[[User:Rzepa|Rzepa]] 08:58, 8 June 2006 (CEST)
+
<jmol>
:I get it working when commenting out the following line in JmolExtension.php:<br/><code>$this->mValInlineContents = preg_replace("/\n/", "\\n'+\n'", $this->mValInlineContents);</code><br/>--[[User:SHL|SHL]] 06:13, 21 February 2007 (CET)
+
<jmolApplet>
 +
<size>150</size>
 +
<color>bluetint</color>
 +
<inlineContents>chair.mol|Conformational analysis|0| 18 18  0  0  0                1 V2000 |    1.6881    2.1572  -3.0193 C  0  0  0  0  0 |    2.1484    3.6217  -2.9797 C  0  0  0  0  0 |    2.9361    3.9126  -1.6942 C  0  0  0  0  0 |    2.0927    3.5769  -0.4557 C  0  0  0  0  0 |    1.6329    2.1120  -0.4898 C  0  0  0  0  0 |    0.8532    1.8102  -1.7778 C  0  0  0  0  0 |    2.5807    1.4887  -3.0652 H  0  0  0  0  0 |    1.0897    1.9711  -3.9430 H  0  0  0  0  0 |    1.2578    4.2927  -3.0282 H  0  0  0  0  0 |    2.7791    3.8474  -3.8727 H  0  0  0  0  0 |    3.8725    3.3053  -1.6844 H  0  0  0  0  0 |    3.2413    4.9861  -1.6685 H  0  0  0  0  0 |    1.2005    4.2467  -0.4224 H  0  0  0  0  0 |    2.6835    3.7700    0.4714 H  0  0  0  0  0 |    0.9957    1.8928    0.4002 H  0  0  0  0  0 |    2.5240    1.4426  -0.4294 H  0  0  0  0  0 |    0.5642    0.7322  -1.8031 H  0  0  0  0  0 |   -0.0919    2.4039  -1.7878 H  0  0  0  0  0 |  1  2  1  0  0  0 |  1  6  1  1  0  0 |  1  7  1  0  0  0 |  1  8  1  6  0  0 |  2  3  1  1  0  0 |  2  9  1  0  0  0 |  2 10  1  6  0  0 |  3  4  1  1  0  0 |  3 11  1  0  0  0 |  3 12  1  0  0  0 |  4  5  1  0  0  0 |  4 13 1  0  0  0 |  4 14  1  1  0  0 |  5  6  1  6  0  0 |  5 15  1  1  0  0 |  5 16  1  0  0  0 |  6 17  1  0  0  0 |  6 18  1  0  0  0 |M  END                                           
 +
</inlineContents>
 +
  </jmolApplet>
 +
</jmol>
  
I think the problem is not in the contents of the first 3 lines, but in the MediaKiwi extension parsing incorrectly the newline characters (the code mentioned above by SHL and belonging to Jmol.body.php),
+
[[Category:Pages Using Jmol MW Extension]]
which inserts literal single quotes in the call to jmolAppletInline() that remain there after being passed through Jmol.js. Since this latter inserts a vertical bar (pipe, |) in every new line, I think that the quotes and the excess \n are not needed any longer. The same ought to happen with an [[Inlined PDB File]]. [[Inlined CML File]] works I guess because it does not depend on newlines, or maybe because of the CDATA tags. I cannot test it since I don't have a WikiMedia implementation of my own. --[[User:AngelHerraez|AngelHerraez]] 21:32, 30 November 2008 (CET)
 
: OK, I have confirmed this in a local wiki. Commenting out the line in Jmol.body.php solves the problem for inline MOL data. I guess the change may have been raised by a new Jmol.js version. Once I double-check this, I will commit a fix to SVN and have it implemented in this wiki. --[[User:AngelHerraez|AngelHerraez]] 13:51, 7 December 2008 (CET)
 
-->
 

Latest revision as of 20:38, 23 November 2010

Inlined MDL Molfile

This uses inlineContents tag with MOL-formatted data:

(The MOL data above have normal line breaks.)

It can also be done with MOL data that has no newlines but has pipe characters instead:

Contributors

AngelHerraez, Rzepa, SHL