@gravityforms/gulp-tasks
Version:
Configurable Gulp tasks for use in Gravity Forms projects.
43 lines (30 loc) • 743 B
JavaScript
import { render } from '../../renderers/as-definition-list.js';
import { Token } from './token.js';
class details extends Token {
typeText = 'details';
constructor( text ) {
super( text );
this.tagNames = [ '@since', '@deprecated' ];
}
tokenCondition( text ) {
return this.tagNames.includes( text.trim().split( ' ' )[ 0 ] );
}
endCondition( text ) {
const trimmedText = text.trim();
if ( trimmedText === '' ) {
return true;
}
const firstWord = trimmedText.split( ' ' )[ 0 ];
if ( this.tagNames.includes( firstWord ) ) {
return false;
}
if ( firstWord.startsWith( '@' ) ) {
return true;
}
return false;
}
getContent() {
return render( this.lines, this.tagNames );
}
}
export { details };