Add() public method

public Add ( String Name, Stream Data ) : void
Name String
Data Stream
return void
Example #1
0
			public MyFastcgiServerAsync()
			{
				TemplateProvider = new TemplateProviderMemory();
				TemplateFactory = new TemplateFactory(TemplateProvider);
				TemplateProvider.Add("Base.html", "Test{% block Body %}Base{% endblock %}Test");
				TemplateProvider.Add("Test.html", "{% extends 'Base.html' %}{% block Body %}Ex{% endblock %}");
				//TemplateProvider.Add("Test.html", "{% block Body %}Ex{% endblock %}");
			}
Example #2
0
		static void Main()
		{
			//TemplateProvider TemplateProvider = new TemplateProviderVirtualFileSystem(new LocalFileSystem(FileUtils.GetExecutableDirectoryPath(), false));
			TemplateProviderMemory TemplateProvider = new TemplateProviderMemory();
			TemplateFactory TemplateFactory = new TemplateFactory(TemplateProvider);

			TemplateProvider.Add("Base.html", "Test{% block Body %}Base{% endblock %}Test");
			TemplateProvider.Add("Test.html", "{% extends 'Base.html' %}{% block Body %}Ex{% endblock %}");
			//TemplateProvider.Add("Test.html", "{% block Body %}Ex{% endblock %}");

			Console.WriteLine(TemplateFactory.GetTemplateCodeByFile("Test.html").RenderToString());

			Console.ReadKey();
		}
Example #3
0
		public void TestExecInheritanceWithParentOutside()
		{
			TemplateProviderMemory TemplateProvider = new TemplateProviderMemory();
			TemplateFactory TemplateFactory = new TemplateFactory(TemplateProvider, OutputGeneratedCode: true);

			TemplateProvider.Add("Base.html", "Test{% block Body %}Base{% endblock %}Test");
			TemplateProvider.Add("Test.html", "{% extends 'Base.html' %}Not{% block Body %}12{% endblock %}{% parent %}Rendered");

			Assert.AreEqual("Test1Base2Test", TemplateFactory.GetTemplateCodeByFile("Test.html").RenderToString());
		}
Example #4
0
        public void TestExecBasicInheritance()
        {
            TemplateProviderMemory TemplateProvider = new TemplateProviderMemory();
            TemplateFactory TemplateFactory = new TemplateFactory(TemplateProvider);

            TemplateProvider.Add("Base.html", "Test{% block Body %}Base{% endblock %}Test");
            TemplateProvider.Add("Test.html", "{% extends 'Base.html' %}Not{% block Body %}Ex{% endblock %}Rendered");

            Assert.AreEqual("TestExTest", TemplateFactory.GetTemplateCodeByFile("Test.html").RenderToString());
        }