Skip to content

Commit 7ab4303

Browse files
committed
xref要素に、rid属性の前に#を足して作ったhref属性を追加
1 parent 20c1549 commit 7ab4303

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

jats2html/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
<body>
1111
<h1>JATS XML文書をHTMLに変換</h1>
1212
<p>JATS XML文書を読み込んで、Vivliostyleでページ組版できるHTML文書に変換する。</p>
13-
<p style="text-align: end;">2025-07-04</p>
13+
<p style="text-align: end;">v0.2 2025-07-14</p>
14+
<p style="text-align: end;">v0 2025-07-04</p>
1415
<div class="input-container">
1516
<input type="url" id="urlInput"
1617
placeholder="Enter URL to fetch HTML content"

jats2html/lib/convert.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const Convert = (document) => {
88
title2h(document);
99
img(document);
1010
math(document);
11+
xref(document);
1112
// jatsBody(document);
1213
}
1314

@@ -75,6 +76,16 @@ const math = (document) => {
7576
});
7677
}
7778

79+
const xref = (document) => {
80+
document.querySelectorAll('xref').forEach((xref) => {
81+
const rid = xref.getAttribute('rid');
82+
if (rid) {
83+
const href = '#' + rid;
84+
xref.setAttribute('href', href);
85+
}
86+
});
87+
};
88+
7889
/* ***
7990
End of script
8091
*** */

0 commit comments

Comments
 (0)