Defining a NLM url.

15 views
Skip to first unread message

Dulip Withanage

unread,
Mar 10, 2014, 10:51:07 AM3/10/14
to subst...@googlegroups.com
Hi,
I am trying for the first type to include a server based NLM URL   to  substance io reader.
I was addin the  follwoing lines

// Endpoint must have CORS enabled, or file is served from the same domain as the app
var documentURL = "http://localhost:8000/neoliberalism.xml";
var app = new Lens({ document_url: documentURL });

and started the simple python server.

what am i doing wrong there?


 <script>

      if (window.Substance === undefined) {
        window.Substance = require("/src/substance.js");
      }
// Endpoint must have CORS enabled, or file is served from the same domain as the app
var documentURL = "https://s3.amazonaws.com/elife-cdn/elife-articles/00778/elife00778.xml";
var app = new Lens({ document_url: documentURL });


      // Create a new Lens app instance
      // --------
      //
      // Injects itself into body

      $.get("data/content.json")
      .done(function(data) {
          if (Object.prototype.toString.call(data) === "[object String]") {
            data = JSON.parse(data);
          }
          var app = new Substance.Reader({
            document: data
          });

          $(function() {
            app.start();
          });
      })
      .fail(function(err) {
        $('body').html(JSON.stringify(err));
      });

    </script>

Michael Aufreiter

unread,
Mar 10, 2014, 10:55:29 AM3/10/14
to subst...@googlegroups.com
Hi!

Is the Lens instance also running from localhost:8000? What error are you getting? Can you open the Chrome Developer Tools console to see if there are any JS errors.

Michael Aufreiter

--
You received this message because you are subscribed to the Google Groups "Substance" group.
To unsubscribe from this group and stop receiving emails from it, send an email to substance_+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dulip Withanage

unread,
Mar 10, 2014, 11:03:29 AM3/10/14
to subst...@googlegroups.com
Oh, I see. I get the following error.
Uncaught ReferenceError: Lens is not defined

Where should I impor that class.
Actually, I read the docs from lens and trying the newest reader from substance.io, cause I did not find it in substance.io
May be I am reading a old doc.


Michael Aufreiter

unread,
Mar 10, 2014, 11:06:17 AM3/10/14
to subst...@googlegroups.com
The Substance Reader doesn’t come with NLM support.

Just download the Lens 1.0.0 bundle from the official Lens website. You can replace the xml in the data folder with your own doc.


Please share the link here once you published the doc. ;)

Michael Aufreiter

Michael Aufreiter

unread,
Mar 10, 2014, 11:10:07 AM3/10/14
to subst...@googlegroups.com
Also, check out the latest Alpha version of the Substance Composer. If you don’t need formulas, inline images, tables etc. you should be able to draft a Lens-style document without the pain of hand-crafting XML.



Michael Aufreiter

Reply all
Reply to author
Forward
0 new messages