2018-03-27 03:50:39 +13:00
require ( 'babel-register' )
// use a mock DOM so we can run mithril on the server
require ( 'mithril/test-utils/browserMock' ) ( global )
const kepubify = require ( '../src/kepubify' ) . default
2018-03-27 07:32:02 +13:00
console . log ( 1 , kepubify ( ` <?xml version="1.0" encoding="utf-8"?>
< ! DOCTYPE html >
2018-05-17 21:36:04 +12:00
< html > < body > text < p > aaaa < /p><p>Some text. Woo <!-- or --> not. Here is <img / > another sentence . < /p><!-- comment --><p>More text <img/ > tail < / p > b o d y t a i l < / b o d y > h t m l t a i l < / h t m l > ` ) = = = ` < ? x m l v e r s i o n = " 1 . 0 " e n c o d i n g = " u t f - 8 " ? >
< ! DOCTYPE html >
< html > < body > text < div class = "book-inner" > < div class = "book-columns" > < p > < span class = "koboSpan" id = "kobo.1.1" > aaaa < / s p a n > < / p > < p > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 2 . 1 " > S o m e t e x t . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 2 . 2 " > W o o n o t . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 2 . 3 " > H e r e i s < / s p a n > < i m g / > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 2 . 5 " > a n o t h e r s e n t e n c e . < / s p a n > < / p > < p > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 3 . 1 " > M o r e t e x t < / s p a n > < i m g / > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 3 . 3 " > t a i l < / s p a n > < / p > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 3 . 5 " > b o d y t a i l < / s p a n > < / d i v > < / d i v > < / b o d y > < / h t m l > ` )
2018-03-27 07:32:02 +13:00
console . log ( 2 , kepubify ( ` <?xml version="1.0" encoding="utf-8"?>
< ! DOCTYPE html >
< html > < body > < p > Dated : June 5 th . Wohoo < / p > < / b o d y > < / h t m l > ` ) = = = ` < ? x m l v e r s i o n = " 1 . 0 " e n c o d i n g = " u t f - 8 " ? >
< ! DOCTYPE html >
2018-05-17 21:36:04 +12:00
< html > < body > < div class = "book-inner" > < div class = "book-columns" > < p > < span class = "koboSpan" id = "kobo.1.1" > Dated : < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 2 " > J u n e 5 t h . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 3 " > W o h o o < / s p a n > < / p > < / d i v > < / d i v > < / b o d y > < / h t m l > ` )
console . log ( 3 , kepubify ( ` <?xml version="1.0" encoding="utf-8"?>
< ! DOCTYPE html >
< html > < body > < pre > hello < /pre><p>“Well, you know, Water Bearer and all,” she laughed weakly. “Don’ t kid yourself, though. You’ re <i>strong,</i > Daphne , and I ’ m not just saying that . You saved us , and you ’ ve come all this way through all these trials . If you get a little heartbroken now and again , well , you ’ re entitled to it . You ’ re like your mother in that . ” She smiled brightly . “ The Seer told me a bit about that , you know . The whole … thing passed down the female line , on and on for ages , all of them determined and gifted . < i > Apparently < / i > t h a t ’ s w h y t h i n g s h e r e r e s e m b l e s t u f f o n o u r e a r t h s o w e l l — b e c a u s e t h e E v e r f r e e W a y s h a v e b e e n f o l l o w i n g y o u r m a t e r n a l l i n e a l l a c r o s s E u r o p e a n d t h e A m e r i c a s , a n d a p p a r e n t l y a b r i e f s t o p a t N e w Z e a l a n d . T h e y w e r e s u p e r a d v e n t u r o u s . ” < / p > < / b o d y > < / h t m l > ` ) = = = ` < ? x m l v e r s i o n = " 1 . 0 " e n c o d i n g = " u t f - 8 " ? >
< ! DOCTYPE html >
< html > < body > < div class = "book-inner" > < div class = "book-columns" > < pre > hello < / p r e > < p > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 1 " > “ W e l l , y o u k n o w , W a t e r B e a r e r a n d a l l , ” s h e l a u g h e d w e a k l y . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 2 " > “ D o n ’ t k i d y o u r s e l f , t h o u g h . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 3 " > Y o u ’ r e < / s p a n > < i > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 5 " > s t r o n g , < / s p a n > < / i > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 7 " > D a p h n e , a n d I ’ m n o t j u s t s a y i n g t h a t . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 8 " > Y o u s a v e d u s , a n d y o u ’ v e c o m e a l l t h i s w a y t h r o u g h a l l t h e s e t r i a l s . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 9 " > I f y o u g e t a l i t t l e h e a r t b r o k e n n o w a n d a g a i n , w e l l , y o u ’ r e e n t i t l e d t o i t . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 1 0 " > Y o u ’ r e l i k e y o u r m o t h e r i n t h a t . ” < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 1 1 " > S h e s m i l e d b r i g h t l y . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 1 2 " > “ T h e S e e r t o l d m e a b i t a b o u t t h a t , y o u k n o w . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 1 3 " > T h e w h o l e … t h i n g p a s s e d d o w n t h e f e m a l e l i n e , o n a n d o n f o r a g e s , a l l o f t h e m d e t e r m i n e d a n d g i f t e d . < / s p a n > < i > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 1 5 " > A p p a r e n t l y < / s p a n > < / i > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 1 7 " > t h a t ’ s w h y t h i n g s h e r e r e s e m b l e s t u f f o n o u r e a r t h s o w e l l — b e c a u s e t h e E v e r f r e e W a y s h a v e b e e n f o l l o w i n g y o u r m a t e r n a l l i n e a l l a c r o s s E u r o p e a n d t h e A m e r i c a s , a n d a p p a r e n t l y a b r i e f s t o p a t N e w Z e a l a n d . < / s p a n > < s p a n c l a s s = " k o b o S p a n " i d = " k o b o . 1 . 1 8 " > T h e y w e r e s u p e r a d v e n t u r o u s . ” < / s p a n > < / p > < / d i v > < / d i v > < / b o d y > < / h t m l > ` )