private void InnerTranslate(IAsset asset, HandlebarsCompiler handlebarsCompiler)
        {
            string newContent;
            string assetUrl = asset.Url;

            try
            {
                newContent = handlebarsCompiler.Compile(asset.Content, assetUrl);
            }
            catch (HandlebarsCompilationException e)
            {
                throw new AssetTranslationException(
                          string.Format(CoreStrings.Translators_TranslationSyntaxError,
                                        INPUT_CODE_TYPE, OUTPUT_CODE_TYPE, assetUrl, e.Message));
            }
            catch (Exception e)
            {
                throw new AssetTranslationException(
                          string.Format(CoreStrings.Translators_TranslationFailed,
                                        INPUT_CODE_TYPE, OUTPUT_CODE_TYPE, assetUrl, e.Message));
            }

            asset.Content = newContent;
        }
		private void InnerTranslate(IAsset asset, HandlebarsCompiler handlebarsCompiler)
		{
			string newContent;
			string assetVirtualPath = asset.VirtualPath;

			try
			{
				newContent = handlebarsCompiler.Compile(asset.Content, assetVirtualPath);
			}
			catch (HandlebarsCompilingException e)
			{
				throw new AssetTranslationException(
					string.Format(CoreStrings.Translators_TranslationSyntaxError,
						INPUT_CODE_TYPE, OUTPUT_CODE_TYPE, assetVirtualPath, e.Message));
			}
			catch (Exception e)
			{
				throw new AssetTranslationException(
					string.Format(CoreStrings.Translators_TranslationFailed,
						INPUT_CODE_TYPE, OUTPUT_CODE_TYPE, assetVirtualPath, e.Message));
			}

			asset.Content = newContent;
		}
Esempio n. 3
0
 public HandlebarsTemplate Compile(TextReader template)
 {
     return(_compiler.Compile(template));
 }
Esempio n. 4
0
 public Action <TextWriter, object> Compile(TextReader template)
 {
     return(_compiler.Compile(template));
 }