substance / document Goto Github PK
View Code? Open in Web Editor NEWSubstance Document Model
Home Page: http://substance.io/#substance/manual
License: MIT License
Substance Document Model
Home Page: http://substance.io/#substance/manual
License: MIT License
By being explicit about the branch/head the operation should be applied, we can avoid additional commands for switching branches, and we don't need to create a branch with no new ops, before we can start applying operations on it.
Think about this:
doc.apply({
op: ["insert", {id: "text:5", "type": "text"}],
sha: abcdef, // optional: sha is generated on demand if not specified
head: 'patch-michael'
});
It will dynamically create a reference to the patch branch, once it has been applied to the document.
Just an idea.... let's find out if this works well.
I get the following output in the console when visiting index.html:
Uncaught TypeError: Cannot read property 'util' of undefined document.js:17
Uncaught ReferenceError: Substance is not defined
I downloaded this, and mapped it as web page. then opened index.html and received the error above.
The same error comes up when I simply open
http://interior.substance.io/modules/document.html
regardless of the browser. (latest chrome, latest ff)
javascript-operational-transformation out of date.
TypeError: Cannot call method 'fromJSON' of undefined at Document.methods.set (document.js:465:48)
doc.properties[key] = ot.TextOperation.fromJSON(val).apply(doc.properties[key] || "");
TextOperation is missing.
Since the Substance Document model is a "sequence of content nodes", and not a graph, I'm having trouble trying to figure out how I could have deeper level (h2,h3..) nodes in this model.
Any ideas?
Reproduce:
The text gets reinserted. The annotation does not show up.
There is already a standard format for "arbitrary digital documents" that "doesn't make any assumptions on a concrete type or structure": it's called bitstream, based on zeroes and ones. An there is another, calles Unicode strings, based in UCS characters. And there is XML, based on XML elements, attributed and text nodes. Or SQL with tables, columns, and data types. What I try to say is: the Substance Document Model is not better or worse to encode digital documents than any other technology. It depends on what you mean by "document" and which kinds of elements are better supported than others. From the current documentation your basic assumptions with atomic parts, data types etc. are not quite clear. Is the general structure a (connected) graph, a tree, a sequence? Which kinds of elements exist (strings, nodes, connections...)? Which predefined building blocks exist? For instance if I want do model documents with sections, paragraphs, characters, and a set of markup types, do I have to define them all on my own and manually map them to existing definitions in other document formats (HTML, Markdown, LaTeX...)? If there are no predefined data types, then substance looks like nothing more (or even less) than a content-agnostic data structuring language such as XML, JSON, or RDF. If there are too many predefined types, it is just another document format, such as TEI, HTML, ODT etc. But it's somewhere in between, right?
Should probably look like this. We need this to store a slug on the document, plus title, abstract etc. Everything that is directly attached to the document.
doc.apply(["set", {username: "michael", name: "hello-world"}]);
I understand from the documentation that the content's layout is pre-defined by the system instead having to be determined by the user and also noticed that the current Substance Document Model implementation makes use of a Heading and Text as main types. This make sense for a one-level document only.
When a user is willing to have a Text in a 3rd level of the document is she breaking the "layout is for the system" rule?
How is the current Document Model feasible for a multi-level arrangement of content elements?
Link: non-inclusive (both sides)
Idea,Question, Error: non inclusive (both sides)
strong, em: right-inclusive (except you enter text at pos 0, then it's also left inclusive)
Overlap business:
em and strong are mutually exclusive, while markers (question,idea,..) can be combined with them. However question/idea/error are mutually exclusive too.
We need a default transform method, that can be overridden by the application.
Very cool project! I was not able to publish with GitHub Pages when I tried the "Publish" function. I got the note that "Repo does not exist" and when I clicked "Create" I got the error "Could not create repository.". However, when I check my repositories, I see the "new" repo I just "created" (contains only the README.md). I get the same errors when I try to create the just "created" repo. It might be an issue on my side, but just wanted to let you know. Keep it up!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.