Beispiel #1
0
		string _render( TagList tags, string pathToSource, string saveFileName )
		{
			// ******
			if( null == srcPath || pathToSource != srcPath ) {
				srcPath = pathToSource;
				src = File.ReadAllText( srcPath );
			}
			var srcTags = GetSource( src, saveFileName );

			// ******
			var html = new BasicHtml( "Example" );

			// ******
			//
			// https://craig.is/making/rainbows
			// https://github.com/ccampbell/rainbow
			//
			html.AddStylesheetRef( "../Output/assets/css/code.css" );
			html.AddScriptRef( true, "../Output/assets/rainbow/rainbow.min.js" );
			html.AddScriptRef( true, "../Output/assets/rainbow/language/csharp.js" );

			// ******
			html.BodyContainer.AppendChildren( tags );
			html.BodyContainer.AppendChildren( srcTags );
			var result = html.Render();

			// ******
			var outputFilePath = $"{Path.GetDirectoryName(pathToSource)}\\{saveFileName}.html";
			File.WriteAllText( outputFilePath, result );
			return outputFilePath;
    }
Beispiel #2
0
		/////////////////////////////////////////////////////////////////////////////

		static void RunTableExamples1( IEnumerable<string> items )
		{
			// ******
			int index = 0;
			string directory = string.Empty;
			var tagList = new TagList { };

			// ******
			foreach( var example in TableExamples() ) {
				var htmlPath = example.Item1;
				var about = example.Item2;

				if( 0 == index ) {
					directory = Path.GetDirectoryName( htmlPath );
				}

				tagList.AddChild( new A( "file:///" + htmlPath ).SetValue( about ) );
			}

			//var div = new Div().AppendChildren( tagList );

			var list = new Ul().AddListItems( tagList );

			// ******
			//var page = new SimplePage<SimpleHtml> { };
			//page.AddBodyContent( tagList );
			//var html = page.Html.Render();

			var html = new BasicHtml( "Index" );
			html.BodyContainer.AddChild( list );
			var text = html.Render();

			File.WriteAllText( Path.Combine( directory,"index.html" ), text );
		}