Esempio n. 1
0
 private void CompileFiles(MingeParser parser, string root_dir, string [] files)
 {
     foreach (string file in files) {
         if (!Environment.AllowedExtensions.Contains (Path.GetExtension (file)))
             continue;
         ParsePage (file.Substring (root_dir.Length + 1));
     }
 }
Esempio n. 2
0
        internal Page ParsePage(string path)
        {
            MingeParser p = new MingeParser (Environment, Application);
            string full_path = FindFullPath (path);

            if (full_path == null)
                throw new Exception (String.Format ("Template not found: {0}", path));

            Page page = null;
            if (pages.TryGetValue (full_path, out page)) {
                return page;
            }

            using (TextReader tr = new StreamReader (File.OpenRead (full_path))) {
                page = p.ParsePage (path, tr);
            }

            pages.Add (full_path, page);
            return page;
        }
Esempio n. 3
0
 private void CompileDirectoriesRecursive(MingeParser parser, string [] directories, string root_dir, bool top)
 {
     foreach (string directory in directories) {
         CompileFiles (parser, top ? directory : root_dir, Directory.GetFiles (directory));
         CompileDirectoriesRecursive (parser, Directory.GetDirectories (directory), top ? directory : root_dir, false);
     }
 }
Esempio n. 4
0
        // Compiles all the templates that are found in the template directories
        public void CompileTemplates()
        {
            MingeParser p = new MingeParser (Environment, Application);

            CompileDirectoriesRecursive (p, Environment.TemplateDirectories, String.Empty, true);

            Application.Save ();
        }