File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed
Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 33 < head >
44 < meta charset ="UTF-8 ">
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6- < title > Article Theme HTML to JATS Converter</ title >
6+ < title > JATS to HTML Converter</ title >
77 < link rel ="stylesheet " href ="./index.css " type ="text/css " />
88 < script type ="module " src ="./j2h.js "> </ script >
99 </ head >
Original file line number Diff line number Diff line change 33*** */
44
55export const Convert = ( document ) => {
6- // jatsTitle (document);
6+ articleTitle2Title ( document ) ;
77 wrapLabelTitle ( document ) ;
8+ title2h ( document ) ;
89 img ( document ) ;
910 // jatsBody(document);
1011}
1112
12- const jatsTitle = ( document ) => {
13- document . querySelectorAll ( 'title' ) . forEach ( ( title ) => {
14- // console.log(title);
15- const jatsTitle = document . createElement ( 'jats-title' ) ;
16- title . after ( jatsTitle ) ;
17- jatsTitle . append ( ...title . childNodes ) ;
13+ const articleTitle2Title = ( document ) => {
14+ const articleTitle = document . querySelector ( 'article-title' ) ;
15+ if ( articleTitle ) {
16+ const title = document . createElement ( 'title' ) ;
17+ title . textContent = articleTitle . textContent ;
18+ document . head . append ( title ) ;
19+ }
20+ }
21+
22+ const title2h = ( document ) => {
23+ document . querySelectorAll ( 'jats-body > sec > jats-title-wrap' ) . forEach ( ( title ) => {
24+ const h2 = document . createElement ( 'h2' ) ;
25+ title . after ( h2 ) ;
26+ h2 . append ( ...title . childNodes ) ;
1827 for ( const attr of title . attributes ) {
19- jatsTitle . setAttribute ( attr . name , attr . value ) ;
28+ h2 . setAttribute ( attr . name , attr . value ) ;
2029 }
2130 title . remove ( ) ;
2231 } ) ;
You can’t perform that action at this time.
0 commit comments