Commit d93b8b3c authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Label annotation creation date with 'Created at:' in HTML and text formats

parent 345c5069
...@@ -78,7 +78,7 @@ export class AnnotationsExporter { ...@@ -78,7 +78,7 @@ export class AnnotationsExporter {
const annotationsAsText = annotations.map((annotation, index) => { const annotationsAsText = annotations.map((annotation, index) => {
const page = pageLabel(annotation); const page = pageLabel(annotation);
const lines = [ const lines = [
formatDateTime(new Date(annotation.created)), `Created at: ${formatDateTime(new Date(annotation.created))}`,
`Comment: ${annotation.text}`, `Comment: ${annotation.text}`,
extractUsername(annotation), extractUsername(annotation),
`Quote: "${quote(annotation)}"`, `Quote: "${quote(annotation)}"`,
...@@ -135,7 +135,7 @@ export class AnnotationsExporter { ...@@ -135,7 +135,7 @@ export class AnnotationsExporter {
.join(','); .join(',');
const headers = [ const headers = [
'Creation Date', 'Created at',
'URL', 'URL',
'Group', 'Group',
'Annotation/Reply Type', 'Annotation/Reply Type',
...@@ -223,6 +223,7 @@ export class AnnotationsExporter { ...@@ -223,6 +223,7 @@ export class AnnotationsExporter {
<article key={annotation.id}> <article key={annotation.id}>
<h2>Annotation {index + 1}:</h2> <h2>Annotation {index + 1}:</h2>
<p> <p>
Created at:
<time dateTime={annotation.created}> <time dateTime={annotation.created}>
{formatDateTime(new Date(annotation.created))} {formatDateTime(new Date(annotation.created))}
</time> </time>
......
...@@ -120,28 +120,28 @@ Total annotations: 5 ...@@ -120,28 +120,28 @@ Total annotations: 5
Total replies: 1 Total replies: 1
Annotation 1: Annotation 1:
${formattedNow} Created at: ${formattedNow}
Comment: Annotation text Comment: Annotation text
bill bill
Quote: "this is the quote" Quote: "this is the quote"
Tags: tag_1, tag_2 Tags: tag_1, tag_2
Annotation 2: Annotation 2:
${formattedNow} Created at: ${formattedNow}
Comment: Annotation text Comment: Annotation text
bill bill
Quote: "null" Quote: "null"
Tags: tag_1, tag_2 Tags: tag_1, tag_2
Annotation 3: Annotation 3:
${formattedNow} Created at: ${formattedNow}
Comment: Annotation text Comment: Annotation text
jane jane
Quote: "null" Quote: "null"
Tags: foo, bar Tags: foo, bar
Annotation 4: Annotation 4:
${formattedNow} Created at: ${formattedNow}
Comment: Annotation text Comment: Annotation text
bill bill
Quote: "null" Quote: "null"
...@@ -149,7 +149,7 @@ Tags: tag_1, tag_2 ...@@ -149,7 +149,7 @@ Tags: tag_1, tag_2
Page: 23 Page: 23
Annotation 5: Annotation 5:
${formattedNow} Created at: ${formattedNow}
Comment: Annotation text Comment: Annotation text
bill bill
Quote: "null" Quote: "null"
...@@ -183,7 +183,7 @@ Total annotations: 1 ...@@ -183,7 +183,7 @@ Total annotations: 1
Total replies: 0 Total replies: 0
Annotation 1: Annotation 1:
${formattedNow} Created at: ${formattedNow}
Comment: Annotation text Comment: Annotation text
John Doe John Doe
Quote: "null" Quote: "null"
...@@ -229,7 +229,7 @@ Tags: tag_1, tag_2`, ...@@ -229,7 +229,7 @@ Tags: tag_1, tag_2`,
assert.equal( assert.equal(
result, result,
`Creation Date,URL,Group,Annotation/Reply Type,Quote,User,Comment,Tags,Page `Created at,URL,Group,Annotation/Reply Type,Quote,User,Comment,Tags,Page
${formattedNow},http://example.com,My group,Annotation,,jane,Annotation text,"foo,bar", ${formattedNow},http://example.com,My group,Annotation,,jane,Annotation text,"foo,bar",
${formattedNow},http://example.com,My group,Reply,"includes ""double quotes"", and commas",bill,Annotation text,"tag_1,tag_2",23 ${formattedNow},http://example.com,My group,Reply,"includes ""double quotes"", and commas",bill,Annotation text,"tag_1,tag_2",23
${formattedNow},http://example.com,My group,Annotation,,bill,Annotation text,,iii`, ${formattedNow},http://example.com,My group,Annotation,,bill,Annotation text,,iii`,
...@@ -252,7 +252,7 @@ ${formattedNow},http://example.com,My group,Annotation,,bill,Annotation text,,ii ...@@ -252,7 +252,7 @@ ${formattedNow},http://example.com,My group,Annotation,,bill,Annotation text,,ii
assert.equal( assert.equal(
result, result,
`Creation Date,URL,Group,Annotation/Reply Type,Quote,User,Comment,Tags,Page `Created at,URL,Group,Annotation/Reply Type,Quote,User,Comment,Tags,Page
${formattedNow},http://example.com,My group,Annotation,,John Doe,Annotation text,"tag_1,tag_2",`, ${formattedNow},http://example.com,My group,Annotation,,John Doe,Annotation text,"tag_1,tag_2",`,
); );
}); });
...@@ -356,6 +356,7 @@ ${formattedNow},http://example.com,My group,Annotation,,John Doe,Annotation text ...@@ -356,6 +356,7 @@ ${formattedNow},http://example.com,My group,Annotation,,John Doe,Annotation text
<article> <article>
<h2>Annotation 1:</h2> <h2>Annotation 1:</h2>
<p> <p>
Created at:
<time datetime="${isoDate}">${formattedNow}</time> <time datetime="${isoDate}">${formattedNow}</time>
</p> </p>
<p>Comment: Annotation text</p> <p>Comment: Annotation text</p>
...@@ -369,6 +370,7 @@ ${formattedNow},http://example.com,My group,Annotation,,John Doe,Annotation text ...@@ -369,6 +370,7 @@ ${formattedNow},http://example.com,My group,Annotation,,John Doe,Annotation text
<article> <article>
<h2>Annotation 2:</h2> <h2>Annotation 2:</h2>
<p> <p>
Created at:
<time datetime="${isoDate}">${formattedNow}</time> <time datetime="${isoDate}">${formattedNow}</time>
</p> </p>
<p>Comment: Annotation text</p> <p>Comment: Annotation text</p>
...@@ -383,6 +385,7 @@ ${formattedNow},http://example.com,My group,Annotation,,John Doe,Annotation text ...@@ -383,6 +385,7 @@ ${formattedNow},http://example.com,My group,Annotation,,John Doe,Annotation text
<article> <article>
<h2>Annotation 3:</h2> <h2>Annotation 3:</h2>
<p> <p>
Created at:
<time datetime="${isoDate}">${formattedNow}</time> <time datetime="${isoDate}">${formattedNow}</time>
</p> </p>
<p>Comment: Annotation text</p> <p>Comment: Annotation text</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment