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
0f336466
Commit
0f336466
authored
Jan 12, 2024
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jan 12, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use table for a more compact HTML annotations export
parent
7002a1d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
49 deletions
+128
-49
annotations-exporter.tsx
src/sidebar/services/annotations-exporter.tsx
+40
-15
annotations-exporter-test.js
src/sidebar/services/test/annotations-exporter-test.js
+88
-34
No files found.
src/sidebar/services/annotations-exporter.tsx
View file @
0f336466
...
...
@@ -222,21 +222,46 @@ export class AnnotationsExporter {
return
(
<
article
key=
{
annotation
.
id
}
>
<
h2
>
Annotation
{
index
+
1
}
:
</
h2
>
<
p
>
Created at:
<
time
dateTime=
{
annotation
.
created
}
>
{
formatDateTime
(
new
Date
(
annotation
.
created
))
}
</
time
>
</
p
>
<
p
>
Author:
{
extractUsername
(
annotation
)
}
</
p
>
{
page
&&
<
p
>
Page:
{
page
}
</
p
>
}
<
p
>
Quote:
<
blockquote
>
{
quote
(
annotation
)
}
</
blockquote
>
</
p
>
<
p
>
Comment:
{
annotation
.
text
}
</
p
>
{
annotation
.
tags
.
length
>
0
&&
(
<
p
>
Tags:
{
annotation
.
tags
.
join
(
', '
)
}
</
p
>
)
}
<
table
>
<
tbody
>
<
tr
>
<
td
>
Created at:
</
td
>
<
td
>
<
time
dateTime=
{
annotation
.
created
}
>
{
formatDateTime
(
new
Date
(
annotation
.
created
))
}
</
time
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Author:
</
td
>
<
td
>
{
extractUsername
(
annotation
)
}
</
td
>
</
tr
>
{
page
&&
(
<
tr
>
<
td
>
Page:
</
td
>
<
td
>
{
page
}
</
td
>
</
tr
>
)
}
<
tr
>
<
td
>
Quote:
</
td
>
<
td
>
<
blockquote
style=
{
{
margin
:
0
}
}
>
{
quote
(
annotation
)
}
</
blockquote
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Comment:
</
td
>
<
td
>
{
annotation
.
text
}
</
td
>
</
tr
>
{
annotation
.
tags
.
length
>
0
&&
(
<
tr
>
<
td
>
Tags:
</
td
>
<
td
>
{
annotation
.
tags
.
join
(
', '
)
}
</
td
>
</
tr
>
)
}
</
tbody
>
</
table
>
</
article
>
);
})
}
...
...
src/sidebar/services/test/annotations-exporter-test.js
View file @
0f336466
...
...
@@ -355,46 +355,100 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
<h1>Annotations</h1>
<article>
<h2>Annotation 1:</h2>
<p>
Created at:
<time datetime="
${
isoDate
}
">
${
formattedNow
}
</time>
</p>
<p>Author: jane</p>
<p>
Quote:
<blockquote></blockquote>
</p>
<p>Comment: Annotation text</p>
<p>Tags: foo, bar</p>
<table>
<tbody>
<tr>
<td>Created at:</td>
<td>
<time datetime="
${
isoDate
}
">
${
formattedNow
}
</time>
</td>
</tr>
<tr>
<td>Author:</td>
<td>jane</td>
</tr>
<tr>
<td>Quote:</td>
<td>
<blockquote style="margin:0px;"></blockquote>
</td>
</tr>
<tr>
<td>Comment:</td>
<td>Annotation text</td>
</tr>
<tr>
<td>Tags:</td>
<td>foo, bar</td>
</tr>
</tbody>
</table>
</article>
<article>
<h2>Annotation 2:</h2>
<p>
Created at:
<time datetime="
${
isoDate
}
">
${
formattedNow
}
</time>
</p>
<p>Author: bill</p>
<p>Page: 23</p>
<p>
Quote:
<blockquote>includes <p>HTML</p> tags</blockquote>
</p>
<p>Comment: Annotation text</p>
<p>Tags: tag_1, tag_2</p>
<table>
<tbody>
<tr>
<td>Created at:</td>
<td>
<time datetime="
${
isoDate
}
">
${
formattedNow
}
</time>
</td>
</tr>
<tr>
<td>Author:</td>
<td>bill</td>
</tr>
<tr>
<td>Page:</td>
<td>23</td>
</tr>
<tr>
<td>Quote:</td>
<td>
<blockquote style="margin:0px;">includes <p>HTML</p> tags</blockquote>
</td>
</tr>
<tr>
<td>Comment:</td>
<td>Annotation text</td>
</tr>
<tr>
<td>Tags:</td>
<td>tag_1, tag_2</td>
</tr>
</tbody>
</table>
</article>
<article>
<h2>Annotation 3:</h2>
<p>
Created at:
<time datetime="
${
isoDate
}
">
${
formattedNow
}
</time>
</p>
<p>Author: bill</p>
<p>Page: iii</p>
<p>
Quote:
<blockquote></blockquote>
</p>
<p>Comment: Annotation text</p>
<table>
<tbody>
<tr>
<td>Created at:</td>
<td>
<time datetime="
${
isoDate
}
">
${
formattedNow
}
</time>
</td>
</tr>
<tr>
<td>Author:</td>
<td>bill</td>
</tr>
<tr>
<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>
</tr>
</tbody>
</table>
</article>
</section>
</body>
...
...
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