File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed
Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ export async function createArticle(
1111 const payload = {
1212 article : {
1313 body_markdown : content ,
14- cover_image : config . cover_image ,
1514 description : config . description ,
1615 published : config . published ,
1716 title : config . title ,
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { load as loadYaml } from 'js-yaml';
33
44import { Article , ArticleConfig , MediumLicense } from './types' ;
55
6- const RelativePathRegex = / ( [ \. ] { 1 , 2 } \/ . * ) / ;
6+ const RelativePathRegex = / [ \( ' " ] ( [ \. ] { 1 , 2 } \/ \S * ) [ \) ' " ] / ;
77
88function getMetadataIndexes ( lines : string [ ] ) : number [ ] {
99 const indexes : number [ ] = [ ] ;
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ export enum MediumLicense {
1111}
1212
1313export interface ArticleConfig {
14- cover_image ?: string ;
1514 description ?: string ;
1615 license ?: MediumLicense ;
1716 published ?: boolean ;
Original file line number Diff line number Diff line change @@ -69,12 +69,10 @@ some content`;
6969some content` ) ;
7070 } ) ;
7171
72-
7372 it ( 'should parse all images with relative path' , ( ) => {
7473 const article = `
7574---
7675title: Some Title
77- cover_image: ./cover.jpg
7876description: New Article
7977tags:
8078 - one
@@ -89,23 +87,32 @@ some content
8987
9088
9189<img alt="image" src="./assets/img.gif" />
90+ <video src='./assets/video.mp4' />
9291
9392## Description
9493` ;
9594 const parsed = parseArticle ( article , 'raw.github.com/protiumx/blogpub/main/articles/' ) ;
96- expect ( parsed . config . cover_image ) . toEqual ( 'https://raw.github.com/protiumx/blogpub/main/articles/cover.jpg' ) ;
95+
9796 expect ( parsed . config . tags ) . toEqual ( [ 'one' , 'images' ] ) ;
9897 expect (
9998 parsed . content . includes (
10099 '' ,
101- ) ) . toBeTruthy ( ) ;
100+ ) ,
101+ ) . toBeTruthy ( ) ;
102102 expect (
103103 parsed . content . includes (
104104 '' ,
105- ) ) . toBeTruthy ( ) ;
105+ ) ,
106+ ) . toBeTruthy ( ) ;
106107 expect (
107108 parsed . content . includes (
108109 '<img alt="image" src="https://raw.github.com/protiumx/blogpub/main/articles/assets/img.gif"' ,
109- ) ) . toBeTruthy ( ) ;
110+ ) ,
111+ ) . toBeTruthy ( ) ;
112+ expect (
113+ parsed . content . includes (
114+ "<video src='https://raw.github.com/protiumx/blogpub/main/articles/assets/video.mp4'" ,
115+ ) ,
116+ ) . toBeTruthy ( ) ;
110117 } ) ;
111118} ) ;
You can’t perform that action at this time.
0 commit comments