1 | <img src="http://www.deepelement.com/img/logos/de/de_logo.ico" height="30"> Annotext Attribution Format
|
2 | ---
|
3 |
|
4 | A document-based attribution engine for [NodeJS](http://nodejs.org).
|
5 |
|
6 |
|
7 | [![Build Status](https://travis-ci.org/DeepElement/AnnoText.png?branch=master)](https://travis-ci.org/DeepElement/AnnoText) [![npm status](https://nodei.co/npm/annotext.png?compact=true)](https://nodei.co/npm/annotext.png?compact=true)
|
8 |
|
9 | #Philosophy
|
10 |
|
11 | * The Content itself drives the Version history
|
12 | * Human & Machine readable YAML storage of document attributions
|
13 | * Fully serializable (Momento)
|
14 |
|
15 |
|
16 | # Node
|
17 | ## Usage
|
18 |
|
19 | ###Create a Document
|
20 |
|
21 | var annotextDoc = new annotext();
|
22 | annotextDoc.update(
|
23 | {
|
24 | content: 'Here is some sample content',
|
25 | user_key: 'toddpi314',
|
26 | revision_key: 'v0.1'
|
27 | });
|
28 |
|
29 | **AnnoText**
|
30 |
|
31 | ---
|
32 | annotations:
|
33 | - { range_start: 0, range_end: 26, created: '2013-11-09T18:30:56.080Z', user: toddpi314, revision: v0.1 }
|
34 | created: '2013-11-09T18:30:56.080Z'
|
35 | ---
|
36 | Here is some sample content
|
37 |
|
38 | ###Update an existing document
|
39 |
|
40 | var annotextDoc = new annotext();
|
41 | annotextDoc.update(
|
42 | {
|
43 | content: 'Here is some sample content',
|
44 | user_key: 'toddpi314',
|
45 | revision_key: 'v0.1'
|
46 | });
|
47 | annotextDoc.update(
|
48 | {
|
49 | content: 'Here is some sample "that I added" content',
|
50 | user_key: 'VictorHugo',
|
51 | revision_key: 'v0.2'
|
52 | });
|
53 |
|
54 |
|
55 | **AnnoText**
|
56 |
|
57 | ---
|
58 | annotations:
|
59 | - { created: '2013-11-09T18:45:43.511Z', user: toddpi314, revision: v0.1, range_start: 0, range_end: 20 }
|
60 | - { created: '2013-11-09T18:45:43.513Z', user: VictorHugo, revision: v0.2, range_start: 21, range_end: 35 }
|
61 | - { created: '2013-11-09T18:45:43.511Z', user: toddpi314, revision: v0.1, range_start: 36, range_end: 42 }
|
62 | created: '2013-11-09T18:45:43.514Z'
|
63 | ---
|
64 | Here is some sample "that I added" content
|
65 |
|
66 | ##API
|
67 | ###Update
|
68 | Add content to the document (creation and update)
|
69 |
|
70 | **Arguments**
|
71 |
|
72 | - content - document content
|
73 | - user_key - user key of creator
|
74 | - revision_key - revision key of first impression
|
75 | - (Optional) inline_custom - custom attributes to attach to the annotation record
|
76 | - (Optional) inline_header - custom attributes to attach to the document header
|
77 | - (Optional) edit_date - datestamp for the revision updates
|
78 |
|
79 | **Usage**
|
80 |
|
81 | var annotextDoc = new annotext();
|
82 | annotextDoc.update(
|
83 | {
|
84 | content: 'Here is some sample content', // Content
|
85 | user_key: 'toddpi314', // User key
|
86 | revision_key: 'v0.1', // Current Revision
|
87 | inline_custom: {
|
88 | 'go': 'ninja'
},
|
89 | header_custom: {
|
90 | 'custom': 'header-value' });
|
91 |
|
92 |
|
93 | ###Parse
|
94 | Parse an existing document and get a pretty "ok" api for accessing header/content.
|
95 |
|
96 | **Usage**
|
97 |
|
98 | var annotextDoc = new annotext();
|
99 | var annotextDoc = annotext.update(
|
100 | {
|
101 | content: 'Here is some sample content',
|
102 | user_key: 'toddpi314',
|
103 | revision_key: 'v0.1'
|
104 | });
|
105 | var parsedDoc = annotextDoc.parse();
|
106 |
|
107 |
|
108 |
|
109 | ###GetRevisionsByUser
|
110 | Get a list of revisions based on the user key used in prior attribution entries.
|
111 |
|
112 | **Usage**
|
113 |
|
114 | var annotextDoc = new annotext();
|
115 | var annotextDoc = annotext.update(
|
116 | {
|
117 | content: 'Here is some sample content',
|
118 | user_key: 'toddpi314',
|
119 | revision_key: 'v0.1'
|
120 | });
|
121 | var revisions = annotextDoc.getRevisionsByUser();
|
122 |
|
123 |
|
124 | ###GetDistinctRevisionDates
|
125 | Get a list of all revision dates relevant to the AnnoText document.
|
126 |
|
127 | **Usage**
|
128 |
|
129 | var annotextDoc = new annotext();
|
130 | var annotextDoc = annotext.update(
|
131 | {
|
132 | content: 'Here is some sample content',
|
133 | user_key: 'toddpi314',
|
134 | revision_key: 'v0.1'
|
135 | });
|
136 | var dates = annotextDoc.getDistinctRevisionDates();
|
137 |
|
138 | ###GetDistinctRevisionKeys
|
139 | Get a list of distinct revision keys relevant to the AnnoText document.
|
140 |
|
141 | **Usage**
|
142 |
|
143 | var annotextDoc = new annotext();
|
144 | var annotextDoc = annotext.update(
|
145 | {
|
146 | content: 'Here is some sample content',
|
147 | user_key: 'toddpi314',
|
148 | revision_key: 'v0.1'
|
149 | });
|
150 | var revisionKey = annotextDoc.getDistinctRevisionKeys();
|
151 |
|
152 | ###GetDistinctUserKeys
|
153 | Get a list of distinct user keys relevant to the AnnoText document.
|
154 |
|
155 | **Usage**
|
156 |
|
157 | var annotextDoc = new annotext();
|
158 | var annoTextDoc = annotext.update(
|
159 | {
|
160 | content: 'Here is some sample content',
|
161 | user_key: 'toddpi314',
|
162 | revision_key: 'v0.1'
|
163 | });
|
164 | var users = annotextDoc.getDistinctUserKeys();
|
165 |
|
166 |
|
167 | #Contact & Issues
|
168 |
|
169 | [https://github.com/DeepElement/AnnoText/issues](https://github.com/DeepElement/AnnoText/issues)
|
170 |
|
171 | <todd@deepelement.com>
|
172 |
|
173 | # License
|
174 |
|
175 | (The MIT License)
|
176 |
|
177 | Copyright (c) 2008-2014 Todd Morrison <todd@deepelement.com>
|
178 |
|
179 | Permission is hereby granted, free of charge, to any person obtaining
|
180 | a copy of this software and associated documentation files (the
|
181 | 'Software'), to deal in the Software without restriction, including
|
182 | without limitation the rights to use, copy, modify, merge, publish,
|
183 | distribute, sublicense, and/or sell copies of the Software, and to
|
184 | permit persons to whom the Software is furnished to do so, subject to
|
185 | the following conditions:
|
186 |
|
187 | The above copyright notice and this permission notice shall be
|
188 | included in all copies or substantial portions of the Software.
|
189 |
|
190 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
191 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
192 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
193 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
194 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
195 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
196 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|