Skip to content

Custom tool for pre-processing text generation templates using Razor syntax.

Notifications You must be signed in to change notification settings

vplusplus/RazorTextTemplatePreProcessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Razor Text Template PreProcessor

####(Custom tool: RTT)

Provides a custom tool that can pre-process text templates using Razor syntax to self-contained and stand-alone text generation template with NO MVC dependency.

If you are looking for pre-compiling standard MVC Razor Views, you are using a wrong custom tool. The class generated by this custom tool is conceptually comparable to T4 templates.

Base class

Generated class depends on a base class that provides required signatures. The custom-tool has two stock implementation of the baseclasses, one for TextTemplate and another for HtmlTemplate.

The TextTemplate base class provides minimal signatures required for Razor syntax based text generation. The HtmlTemplate provides additional services like nested layouts, named sections, etc. which are typical of html generation.

You can grab the default implementation of the base-class using following steps:

  • Create an empty file named TextTemplate.cshtml or HtmlTemplate.cshtml
  • Set Custom Tool name and generate

The generated base-class can be left-alone as-is in the assembly (self-contained-model) or can be moved aside to a shared library.

If you customize the base class, to use the custom base-class for other templates:

  • Update the nearest web config or
  • Use standard @inherits Razor directive

Supported Directives:

  • @** HelperPage *@
  • @** namespace : CustomNamespace *@
  • @** classname : CustomClassName *@
  • @** visibility : public | internal *@
  • @** Remove#lines *@

About

Custom tool for pre-processing text generation templates using Razor syntax.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages