Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/substance/lens
Lens - open science content creation and display
https://github.com/substance/lens
Last synced: about 1 month ago
JSON representation
Lens - open science content creation and display
- Host: GitHub
- URL: https://github.com/substance/lens
- Owner: substance
- License: mit
- Created: 2015-06-25T22:48:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-09T10:15:03.000Z (over 8 years ago)
- Last Synced: 2024-08-01T12:34:31.614Z (4 months ago)
- Language: JavaScript
- Homepage: http://substance.io/lens
- Size: 2.23 MB
- Stars: 124
- Watchers: 18
- Forks: 20
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - substance/lens - Lens - open science content creation and display (others)
README
**No longer maintained. Use http://github.com/substance/texture instead.**
# Lens (editable edition)
This is an evolution of [eLife Lens](http://github.com/elifesciences/lens), developed by [Substance](http://substance.io). It comes with a Writer component for web-based authoring and a new Reader component for displaying of scientific content.
Read about the backgrounds of this project:
- https://medium.com/@_mql/self-host-a-scientific-journal-with-elife-lens-f420afb678aa
- https://medium.com/@_mql/produce-a-scientific-paper-with-lens-writer-d0fc75d11919*Important note: This project is at an experimental state. It is also not compatible with JATS/NLM at this stage, as it reads a simplified custom XML format. We will add support for JATS import + export at a later time.*
## Install dev version
Clone the repository.
```bash
$ git clone https://github.com/substance/lens.git
```Navigate to the source directory.
```bash
$ cd lens
```Install dependencies via npm
```bash
$ npm install
```Start the dev server
```bash
$ npm run start
```And navigate to [http://localhost:5000](http://localhost:5000)
To create a new demo bundle do this:
```bash
$ npm run bundle
```## Usage
To embed Lens Reader:
```js
var LensReader = require('lens/LensReader');
var LensArticle = require('lens/model/LensArticle');
var Component = require('substance/ui/component');
var $$ = Component.$$;var doc = LensArticle.fromXml(LENS_XML);
Component.mount($$(LensReader, {
doc: doc
}), document.body);
```To embed Lens Writer:
```js
var LensWriter = require('lens/LensWriter');
var LensArticle = require('lens/model/LensArticle');
var Component = require('substance/ui/component');
var $$ = Component.$$;var doc = LensArticle.fromXml(LENS_XML);
Component.mount($$(LensWriter, {
doc: doc,
onUploadFile: function(file, cb) {
console.log('custom file upload handler in action...');
var fileUrl = window.URL.createObjectURL(file);
cb(null, fileUrl);
},
onSave: function(doc, changes, cb) {
console.log('custom save handler in action...', doc.toXml());
cb(null);
}
}), document.body);
```Make sure to also include the stylesheets into your app. We provide entry points at `styles/lens-writer.sass` and `styles/lens-reader.sass`. Lens requires a module bundler, such as Browserify or Webpack.