src/js/guidox@wunderbyte.com/spirits/output/dox.DocsOutputSpirit.js
function ( source ) {

		var comment = false;
		var chapters = [];
		var chapter = null;
		var sections = [];
		var section = null;
		var marker = new Showdown.converter ();

		function nextchapter ( title ) {
			if ( chapter ) {
				chapter.sections = sections.map ( function ( section, i ) {
					section.desc = marker.makeHtml ( section.desc );
					return section;
				});
				chapters.push ( chapter );
			}
			chapter = new dox.Chapter ({
				title : title || null
			});
			sections = [];
		}

		function nextsection ( line ) {
			if ( section && section.code ) {
				sections.push ( section );
			}
			section = new dox.Block ({
				line : line || 0,
				tags : [],
				desc : "",
				code : ""
			});
		}

		nextsection ();
		nextchapter ();
		source.split ( "\n" ).forEach ( function ( line, index ) {
			var md, trim = line.trim ();
			if ( comment ) {
				if ( trim.startsWith ( "*/" )) {
					comment = false;
				} else {
					if ( trim === "*" ) {
						section.desc += "\n\n";
					} else {
						md = line.replace ( this._GUTTER, "" );
						switch ( md [ 0 ]) {
							case "@" :
								section.tags.push ( new dox.Tag ({
									text : this._encode ( md )
								}));
								break;
							case "#" :
								//chapter.title = md.replace ( this._HEADER, "" );
								section.desc += "\n" + md + "\n\n";
								break;
							default :
								if ( !md.match ( this._LETTER )) {
									section.desc += "\n";
								}
								section.desc += this._encode ( md );
								break;
						}
					}
				}
			} else {
				if ( line.match ( this._CHAPTER )) {
					var title = this._TITLE.exec ( line );
					nextsection ( index );
					nextchapter ( title ? title [ 0 ] : null );
					section.code += this._HELLO.exec ( line );
				} else {
					if ( trim.startsWith ( "/**" )) {
						comment = true;
						nextsection ( index );
					} else {
						section.code += line + "\n";
					}
				}
			}
		}, this );
		nextsection ();
		nextchapter ();
		return chapters;
	}
function ( source ) {

		var comment = false;
		var chapters = [];
		var chapter = null;
		var sections = [];
		var section = null;
		var marker = new Showdown.converter ();

		function nextchapter ( title ) {
			if ( chapter ) {
				chapter.sections = sections.map ( function ( section, i ) {
					section.desc = marker.makeHtml ( section.desc );
					return section;
				});
				chapters.push ( chapter );
			}
			chapter = new dox.Chapter ({
				title : title || null
			});
			sections = [];
		}

		function nextsection ( line ) {
			if ( section && section.code ) {
				sections.push ( section );
			}
			section = new dox.Block ({
				line : line || 0,
				tags : [],
				desc : "",
				code : ""
			});
		}

		nextsection ();
		nextchapter ();
		source.split ( "\n" ).forEach ( function ( line, index ) {
			var md, trim = line.trim ();
			if ( comment ) {
				if ( trim.startsWith ( "*/" )) {
					comment = false;
				} else {
					if ( trim === "*" ) {
						section.desc += "\n\n";
					} else {
						md = line.replace ( this._GUTTER, "" );
						switch ( md [ 0 ]) {
							case "@" :
								section.tags.push ( new dox.Tag ({
									text : this._encode ( md )
								}));
								break;
							case "#" :
								//chapter.title = md.replace ( this._HEADER, "" );
								section.desc += "\n" + md + "\n\n";
								break;
							default :
								if ( !md.match ( this._LETTER )) {
									section.desc += "\n";
								}
								section.desc += this._encode ( md );
								break;
						}
					}
				}
			} else {
				if ( line.match ( this._CHAPTER )) {
					var title = this._TITLE.exec ( line );
					nextsection ( index );
					nextchapter ( title ? title [ 0 ] : null );
					section.code += this._HELLO.exec ( line );
				} else {
					if ( trim.startsWith ( "/**" )) {
						comment = true;
						nextsection ( index );
					} else {
						section.code += line + "\n";
					}
				}
			}
		}, this );
		nextsection ();
		nextchapter ();
		return chapters;
	}
function ( source ) { var comment = false ; var chapters = [ ] ; var chapter = null ; var sections = [ ] ; var section = null ; var marker = new Showdown . converter ( ) ; function nextchapter ( title ) { if ( chapter ) { chapter . sections = sections . map ( function ( section , i ) { section . desc = marker . makeHtml ( section . desc ) ; return section ; } ) ; chapters . push ( chapter ) ; } chapter = new dox . Chapter ( { title : title || null } ) ; sections = [ ] ; } function nextsection ( line ) { if ( section && section . code ) { sections . push ( section ) ; } section = new dox . Block ( { line : line || 0 , tags : [ ] , desc : "" , code : "" } ) ; } nextsection ( ) ; nextchapter ( ) ; source . split ( "\n" ) . forEach ( function ( line , index ) { var md , trim = line . trim ( ) ; if ( comment ) { if ( trim . startsWith ( "*/" ) ) { comment = false ; } else { if ( trim === "*" ) { section . desc += "\n\n" ; } else { md = line . replace ( this . _GUTTER , "" ) ; switch ( md [ 0 ] ) { case "@" : section . tags . push ( new dox . Tag ( { text : this . _encode ( md ) } ) ) ; break ; case "#" : //chapter.title = md.replace ( this._HEADER, "" ); section . desc += "\n" + md + "\n\n" ; break ; default : if ( ! md . match ( this . _LETTER ) ) { section . desc += "\n" ; } section . desc += this . _encode ( md ) ; break ; } } } } else { if ( line . match ( this . _CHAPTER ) ) { var title = this . _TITLE . exec ( line ) ; nextsection ( index ) ; nextchapter ( title ? title [ 0 ] : null ) ; section . code += this . _HELLO . exec ( line ) ; } else { if ( trim . startsWith ( "/**" ) ) { comment = true ; nextsection ( index ) ; } else { section . code += line + "\n" ; } } } } , this ) ; nextsection ( ) ; nextchapter ( ) ; return chapters ; }
Parse source code to chapters.
@param {String} source
@return {Array<dox.Chapter>}
Parse source code to chapters .