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
Hide 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 {
const
annotationsAsText
=
annotations
.
map
((
annotation
,
index
)
=>
{
const
page
=
pageLabel
(
annotation
);
const
annotationQuote
=
quote
(
annotation
);
const
lines
=
[
`Created at:
${
formatDateTime
(
new
Date
(
annotation
.
created
))}
`
,
`Author:
${
extractUsername
(
annotation
)}
`
,
page
?
`Page:
${
page
}
`
:
undefined
,
`Quote: "
${
quote
(
annotation
)}
"`
,
annotationQuote
?
`Quote: "
${
annotationQuote
}
"`
:
undefined
,
`Comment:
${
annotation
.
text
}
`
,
annotation
.
tags
.
length
>
0
?
`Tags:
${
annotation
.
tags
.
join
(
', '
)}
`
...
...
@@ -219,6 +220,8 @@ export class AnnotationsExporter {
<
h1
>
Annotations
</
h1
>
{
annotations
.
map
((
annotation
,
index
)
=>
{
const
page
=
pageLabel
(
annotation
);
const
annotationQuote
=
quote
(
annotation
);
return
(
<
article
key=
{
annotation
.
id
}
>
<
h2
>
Annotation
{
index
+
1
}
:
</
h2
>
...
...
@@ -242,14 +245,16 @@ export class AnnotationsExporter {
<
td
>
{
page
}
</
td
>
</
tr
>
)
}
<
tr
>
<
td
>
Quote:
</
td
>
<
td
>
<
blockquote
style=
{
{
margin
:
0
}
}
>
{
quote
(
annotation
)
}
</
blockquote
>
</
td
>
</
tr
>
{
annotationQuote
&&
(
<
tr
>
<
td
>
Quote:
</
td
>
<
td
>
<
blockquote
style=
{
{
margin
:
0
}
}
>
{
annotationQuote
}
</
blockquote
>
</
td
>
</
tr
>
)
}
<
tr
>
<
td
>
Comment:
</
td
>
<
td
>
{
annotation
.
text
}
</
td
>
...
...
src/sidebar/services/test/annotations-exporter-test.js
View file @
bb6a181b
...
...
@@ -90,6 +90,7 @@ describe('AnnotationsExporter', () => {
...
baseAnnotation
,
user
:
'acct:jane@localhost'
,
tags
:
[
'foo'
,
'bar'
],
target
:
targetWithSelectors
(
quoteSelector
(
'The quote'
)),
},
{
...
baseAnnotation
,
...
...
@@ -129,14 +130,13 @@ Tags: tag_1, tag_2
Annotation 2:
Created at:
${
formattedNow
}
Author: bill
Quote: "null"
Comment: Annotation text
Tags: tag_1, tag_2
Annotation 3:
Created at:
${
formattedNow
}
Author: jane
Quote: "
null
"
Quote: "
The quote
"
Comment: Annotation text
Tags: foo, bar
...
...
@@ -144,7 +144,6 @@ Annotation 4:
Created at:
${
formattedNow
}
Author: bill
Page: 23
Quote: "null"
Comment: Annotation text
Tags: tag_1, tag_2
...
...
@@ -152,7 +151,6 @@ Annotation 5:
Created at:
${
formattedNow
}
Author: bill
Page: iii
Quote: "null"
Comment: Annotation text`
,
);
});
...
...
@@ -185,7 +183,6 @@ Total replies: 0
Annotation 1:
Created at:
${
formattedNow
}
Author: John Doe
Quote: "null"
Comment: Annotation text
Tags: tag_1, tag_2`
,
);
...
...
@@ -273,10 +270,10 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
...
baseAnnotation
,
user
:
'acct:jane@localhost'
,
tags
:
[
'foo'
,
'bar'
],
target
:
targetWithSelectors
(
quoteSelector
(
'The quote'
)),
},
{
...
baseAnnotation
,
...
newReply
(),
target
:
targetWithSelectors
(
quoteSelector
(
'includes <p>HTML</p> tags'
),
pageSelector
(
23
),
...
...
@@ -284,6 +281,7 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
},
{
...
baseAnnotation
,
...
newReply
(),
tags
:
[],
target
:
targetWithSelectors
(
pageSelector
(
'iii'
)),
},
...
...
@@ -370,7 +368,7 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
<tr>
<td>Quote:</td>
<td>
<blockquote style="margin:0px;"></blockquote>
<blockquote style="margin:0px;">
The quote
</blockquote>
</td>
</tr>
<tr>
...
...
@@ -437,12 +435,6 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
<td>Page:</td>
<td>iii</td>
</tr>
<tr>
<td>Quote:</td>
<td>
<blockquote style="margin:0px;"></blockquote>
</td>
</tr>
<tr>
<td>Comment:</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