Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
bb6a181b
Commit
bb6a181b
authored
Jan 15, 2024
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jan 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not render empty quotes when exporting to Text or HTML
parent
bd6446ac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
22 deletions
+19
-22
annotations-exporter.tsx
src/sidebar/services/annotations-exporter.tsx
+14
-9
annotations-exporter-test.js
src/sidebar/services/test/annotations-exporter-test.js
+5
-13
No files found.
src/sidebar/services/annotations-exporter.tsx
View file @
bb6a181b
...
@@ -77,11 +77,12 @@ export class AnnotationsExporter {
...
@@ -77,11 +77,12 @@ export class AnnotationsExporter {
const
annotationsAsText
=
annotations
.
map
((
annotation
,
index
)
=>
{
const
annotationsAsText
=
annotations
.
map
((
annotation
,
index
)
=>
{
const
page
=
pageLabel
(
annotation
);
const
page
=
pageLabel
(
annotation
);
const
annotationQuote
=
quote
(
annotation
);
const
lines
=
[
const
lines
=
[
`Created at:
${
formatDateTime
(
new
Date
(
annotation
.
created
))}
`
,
`Created at:
${
formatDateTime
(
new
Date
(
annotation
.
created
))}
`
,
`Author:
${
extractUsername
(
annotation
)}
`
,
`Author:
${
extractUsername
(
annotation
)}
`
,
page
?
`Page:
${
page
}
`
:
undefined
,
page
?
`Page:
${
page
}
`
:
undefined
,
`Quote: "
${
quote
(
annotation
)}
"`
,
annotationQuote
?
`Quote: "
${
annotationQuote
}
"`
:
undefined
,
`Comment:
${
annotation
.
text
}
`
,
`Comment:
${
annotation
.
text
}
`
,
annotation
.
tags
.
length
>
0
annotation
.
tags
.
length
>
0
?
`Tags:
${
annotation
.
tags
.
join
(
', '
)}
`
?
`Tags:
${
annotation
.
tags
.
join
(
', '
)}
`
...
@@ -219,6 +220,8 @@ export class AnnotationsExporter {
...
@@ -219,6 +220,8 @@ export class AnnotationsExporter {
<
h1
>
Annotations
</
h1
>
<
h1
>
Annotations
</
h1
>
{
annotations
.
map
((
annotation
,
index
)
=>
{
{
annotations
.
map
((
annotation
,
index
)
=>
{
const
page
=
pageLabel
(
annotation
);
const
page
=
pageLabel
(
annotation
);
const
annotationQuote
=
quote
(
annotation
);
return
(
return
(
<
article
key=
{
annotation
.
id
}
>
<
article
key=
{
annotation
.
id
}
>
<
h2
>
Annotation
{
index
+
1
}
:
</
h2
>
<
h2
>
Annotation
{
index
+
1
}
:
</
h2
>
...
@@ -242,14 +245,16 @@ export class AnnotationsExporter {
...
@@ -242,14 +245,16 @@ export class AnnotationsExporter {
<
td
>
{
page
}
</
td
>
<
td
>
{
page
}
</
td
>
</
tr
>
</
tr
>
)
}
)
}
{
annotationQuote
&&
(
<
tr
>
<
tr
>
<
td
>
Quote:
</
td
>
<
td
>
Quote:
</
td
>
<
td
>
<
td
>
<
blockquote
style=
{
{
margin
:
0
}
}
>
<
blockquote
style=
{
{
margin
:
0
}
}
>
{
quote
(
annotation
)
}
{
annotationQuote
}
</
blockquote
>
</
blockquote
>
</
td
>
</
td
>
</
tr
>
</
tr
>
)
}
<
tr
>
<
tr
>
<
td
>
Comment:
</
td
>
<
td
>
Comment:
</
td
>
<
td
>
{
annotation
.
text
}
</
td
>
<
td
>
{
annotation
.
text
}
</
td
>
...
...
src/sidebar/services/test/annotations-exporter-test.js
View file @
bb6a181b
...
@@ -90,6 +90,7 @@ describe('AnnotationsExporter', () => {
...
@@ -90,6 +90,7 @@ describe('AnnotationsExporter', () => {
...
baseAnnotation
,
...
baseAnnotation
,
user
:
'acct:jane@localhost'
,
user
:
'acct:jane@localhost'
,
tags
:
[
'foo'
,
'bar'
],
tags
:
[
'foo'
,
'bar'
],
target
:
targetWithSelectors
(
quoteSelector
(
'The quote'
)),
},
},
{
{
...
baseAnnotation
,
...
baseAnnotation
,
...
@@ -129,14 +130,13 @@ Tags: tag_1, tag_2
...
@@ -129,14 +130,13 @@ Tags: tag_1, tag_2
Annotation 2:
Annotation 2:
Created at:
${
formattedNow
}
Created at:
${
formattedNow
}
Author: bill
Author: bill
Quote: "null"
Comment: Annotation text
Comment: Annotation text
Tags: tag_1, tag_2
Tags: tag_1, tag_2
Annotation 3:
Annotation 3:
Created at:
${
formattedNow
}
Created at:
${
formattedNow
}
Author: jane
Author: jane
Quote: "
null
"
Quote: "
The quote
"
Comment: Annotation text
Comment: Annotation text
Tags: foo, bar
Tags: foo, bar
...
@@ -144,7 +144,6 @@ Annotation 4:
...
@@ -144,7 +144,6 @@ Annotation 4:
Created at:
${
formattedNow
}
Created at:
${
formattedNow
}
Author: bill
Author: bill
Page: 23
Page: 23
Quote: "null"
Comment: Annotation text
Comment: Annotation text
Tags: tag_1, tag_2
Tags: tag_1, tag_2
...
@@ -152,7 +151,6 @@ Annotation 5:
...
@@ -152,7 +151,6 @@ Annotation 5:
Created at:
${
formattedNow
}
Created at:
${
formattedNow
}
Author: bill
Author: bill
Page: iii
Page: iii
Quote: "null"
Comment: Annotation text`
,
Comment: Annotation text`
,
);
);
});
});
...
@@ -185,7 +183,6 @@ Total replies: 0
...
@@ -185,7 +183,6 @@ Total replies: 0
Annotation 1:
Annotation 1:
Created at:
${
formattedNow
}
Created at:
${
formattedNow
}
Author: John Doe
Author: John Doe
Quote: "null"
Comment: Annotation text
Comment: Annotation text
Tags: tag_1, tag_2`
,
Tags: tag_1, tag_2`
,
);
);
...
@@ -273,10 +270,10 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
...
@@ -273,10 +270,10 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
...
baseAnnotation
,
...
baseAnnotation
,
user
:
'acct:jane@localhost'
,
user
:
'acct:jane@localhost'
,
tags
:
[
'foo'
,
'bar'
],
tags
:
[
'foo'
,
'bar'
],
target
:
targetWithSelectors
(
quoteSelector
(
'The quote'
)),
},
},
{
{
...
baseAnnotation
,
...
baseAnnotation
,
...
newReply
(),
target
:
targetWithSelectors
(
target
:
targetWithSelectors
(
quoteSelector
(
'includes <p>HTML</p> tags'
),
quoteSelector
(
'includes <p>HTML</p> tags'
),
pageSelector
(
23
),
pageSelector
(
23
),
...
@@ -284,6 +281,7 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
...
@@ -284,6 +281,7 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
},
},
{
{
...
baseAnnotation
,
...
baseAnnotation
,
...
newReply
(),
tags
:
[],
tags
:
[],
target
:
targetWithSelectors
(
pageSelector
(
'iii'
)),
target
:
targetWithSelectors
(
pageSelector
(
'iii'
)),
},
},
...
@@ -370,7 +368,7 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
...
@@ -370,7 +368,7 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
<tr>
<tr>
<td>Quote:</td>
<td>Quote:</td>
<td>
<td>
<blockquote style="margin:0px;"></blockquote>
<blockquote style="margin:0px;">
The quote
</blockquote>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
...
@@ -437,12 +435,6 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
...
@@ -437,12 +435,6 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
<td>Page:</td>
<td>Page:</td>
<td>iii</td>
<td>iii</td>
</tr>
</tr>
<tr>
<td>Quote:</td>
<td>
<blockquote style="margin:0px;"></blockquote>
</td>
</tr>
<tr>
<tr>
<td>Comment:</td>
<td>Comment:</td>
<td>Annotation text</td>
<td>Annotation text</td>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment