@@ -31,6 +31,7 @@ for (const pkg of JSON.parse(Deno.readTextFileSync(pkgsJson))) {
3131}
3232
3333import { extract } from "https://deno.land/std@0.206.0/front_matter/any.ts" ;
34+ import { describe } from "node:test" ;
3435
3536for ( const { name, isFile} of Deno . readDirSync ( `./blog/content` ) ) {
3637 if ( ! isFile || ! name . endsWith ( ".md" ) ) continue
@@ -50,13 +51,13 @@ for (const {name, isFile} of Deno.readDirSync(`./blog/content`)) {
5051}
5152
5253for ( const script of JSON . parse ( Deno . readTextFileSync ( scripthubJson ) ) . scripts ) {
53- const { fullname, description, birthtime, avatar } = script
54+ const { cmd , fullname, description, birthtime, avatar } = script
5455 const url = `https://mash.pkgx.sh/${ fullname } `
5556 if ( description ) rv . push ( {
56- type : 'script ' ,
57+ type : 'mash ' ,
5758 time : new Date ( birthtime ) ,
58- description : description . split ( ". " ) ?. [ 0 ] ?? description ,
59- title : fullname ,
59+ description : demarkdown ( description ) ,
60+ title : cmd ,
6061 image : avatar ,
6162 url
6263 } )
@@ -65,3 +66,11 @@ for (const script of JSON.parse(Deno.readTextFileSync(scripthubJson)).scripts) {
6566rv . sort ( ( a , b ) => b . time . getTime ( ) - a . time . getTime ( ) )
6667
6768console . log ( JSON . stringify ( rv ) )
69+
70+ function demarkdown ( input : any ) : string | undefined {
71+ let sentences = input . split ( '.' )
72+ if ( sentences . length > 1 ) {
73+ input = sentences [ 0 ] + '.'
74+ }
75+ return input . replaceAll ( / \[ ( [ ^ \] ] + ) \] \( [ ^ ) ] + \) / g, '$1' ) ;
76+ }
0 commit comments