File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,10 +68,17 @@ export class Command extends Ditamap {
6868
6969 const commandName = command . id . replace ( / : / g, asString ( commandMeta . topicSeparator , ':' ) ) ;
7070
71- const examples = ( ( command . examples as string [ ] ) || [ ] ) . map ( ( example ) => {
72- const parts = example . split ( '\n' ) ;
73- const desc = parts . length > 1 ? parts [ 0 ] : null ;
74- const commands = parts . length > 1 ? parts . slice ( 1 ) : [ parts [ 0 ] ] ;
71+ const examples = ( command . examples ?? [ ] ) . map ( ( example ) => {
72+ let desc : string | null = null ;
73+ let commands : string [ ] = [ ] ;
74+ if ( typeof example === 'string' ) {
75+ const parts = example . split ( '\n' ) ;
76+ desc = parts . length > 1 ? parts [ 0 ] : null ;
77+ commands = parts . length > 1 ? parts . slice ( 1 ) : [ parts [ 0 ] ] ;
78+ } else {
79+ desc = example . description ;
80+ commands = [ example . command ] ;
81+ }
7582
7683 return {
7784 description : desc ,
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ function loadTestDitamapFile(path: string) {
2525 return readFileSync ( join ( testFilesPath , path ) , 'utf8' ) ;
2626}
2727
28- describe ( 'plugin-login ' , ( ) => {
28+ describe ( 'plugin-auth ' , ( ) => {
2929 const resolvedPath = resolve ( process . cwd ( ) , testFilesPath ) ;
3030 before ( async ( ) => {
3131 try {
You can’t perform that action at this time.
0 commit comments