public ProcessedDocumentCacheElement(string path, Preprocessor preprocessor, ProcessedDocumentCache cache) { this.path = path; this.preprocessor = preprocessor; this.cache = cache; Reload(); watcher = new FileWatcher(path); watcher.Changed += (sender, args) => Reload(); }
/// <summary> /// Create a new Markdown instance and set the options from the MarkdownOptions object. /// </summary> public Markdown(MarkdownOptions options) { _autoHyperlink = options.AutoHyperlink; _autoNewlines = options.AutoNewlines; _emptyElementSuffix = options.EmptyElementSuffix; _encodeProblemUrlCharacters = options.EncodeProblemUrlCharacters; _linkEmails = options.LinkEmails; _strictBoldItalic = options.StrictBoldItalic; Preprocessor = new Preprocessor.Preprocessor(this); }
/// <summary> /// Create a new Markdown instance and optionally load options from a configuration /// file. There they should be stored in the appSettings section, available options are: /// /// Markdown.StrictBoldItalic (true/false) /// Markdown.EmptyElementSuffix (">" or " />" without the quotes) /// Markdown.LinkEmails (true/false) /// Markdown.AutoNewLines (true/false) /// Markdown.AutoHyperlink (true/false) /// Markdown.EncodeProblemUrlCharacters (true/false) /// /// </summary> public Markdown(bool loadOptionsFromConfigFile) { JustReadVariableDefinitionsRun = false; Preprocessor = new Preprocessor.Preprocessor(this); if (!loadOptionsFromConfigFile) return; var settings = ConfigurationManager.AppSettings; foreach (string key in settings.Keys) { switch (key) { case "Markdown.AutoHyperlink": _autoHyperlink = Convert.ToBoolean(settings[key]); break; case "Markdown.AutoNewlines": _autoNewlines = Convert.ToBoolean(settings[key]); break; case "Markdown.EmptyElementSuffix": _emptyElementSuffix = settings[key]; break; case "Markdown.EncodeProblemUrlCharacters": _encodeProblemUrlCharacters = Convert.ToBoolean(settings[key]); break; case "Markdown.LinkEmails": _linkEmails = Convert.ToBoolean(settings[key]); break; case "Markdown.StrictBoldItalic": _strictBoldItalic = Convert.ToBoolean(settings[key]); break; } } }
public string ParseVariablesDefinition(string text, string relPath, TransformationData data, PreprocessedTextLocationMap map) { return(Preprocessor.Replace(VariableDefinitionPattern, text, everyMatch => ParseVariableDefinition(everyMatch, relPath, data), map)); }