Exemplo n.º 1
0
 private StubbleVisitorRenderer BuildRenderer(TemplateType type)
 {
     return(new StubbleBuilder()
            .Configure(settings =>
     {
         settings.AddValueGetter(typeof(Dictionary <string, string>), (val, key, ignoreCase) =>
         {
             var input = val as Dictionary <string, string>;
             string output = FieldHandler.HandleField(input, key, type, Card);
             string fieldName = FieldHandler.GetFieldName(key);
             RenderedFields[fieldName] = output;
             return output;
         })
         .SetEncodingFunction(x => x); // allow unescaped html
     }).Build());
 }
Exemplo n.º 2
0
        private StubbleVisitorRenderer BuildIgnoreDuplicatesAnswerRenderer(Dictionary <string, string> renderedQuestionFields)
        {
            return(new StubbleBuilder()
                   .Configure(settings =>
            {
                settings.AddValueGetter(typeof(Dictionary <string, string>), (val, key, ignoreCase) =>
                {
                    var input = val as Dictionary <string, string>;
                    string output = FieldHandler.HandleField(input, key, TemplateType.Answer, Card);
                    string fieldName = FieldHandler.GetFieldName(key);

                    // Only include field in answer if it is not already in the question
                    if (!renderedQuestionFields.ContainsKey(fieldName))
                    {
                        RenderedFields[fieldName] = output;
                        return output;
                    }
                    return string.Empty;
                })
                .SetEncodingFunction(x => x); // allow unescaped html
            })
                   .Build());
        }