Пример #1
0
        archiveFiles.forEach(function(file) {
            id = getFileName(file);

            archive = archives[id] = loadArticle(file);
            /** only publish public status article */
            if(archive.head.status != 'public') {
                delete archives[id];
                return;
            }

            archive.html = archive.body.length < 5 ? '' : md.toHtmlSync(archive.body);
            archive.cuthtml =  archive.body.length < 5 ? '' : md.toHtmlSync(archive.body.split('\n\n').slice(0, conf.contentLength).join('\n\n'));
            archive.cuthtml = archive.cuthtml.replace(/.\/@img\//g, '/post/'+id+'/@img/');

            //TODO: short cut html for index page
            archive.head.published = getDateFormat(archive.head.published);

            archive._file = id;
            archive.author = authors[archive.head.author];

            //serialize for prev & next article link
            arr.push(archive);
            if(arr[idx-1]) {
                arr[idx-1].next = archive;
                arr[idx].prev = arr[idx-1];
            }
            idx++;

            categorize(archive, archive.head.categories);
            tagize(file, archive.head.tags);
            authorize(archive, archive.head.author);
            datelize(archive);
        });
Пример #2
0
        pageFiles.forEach(function(item) {
            //유효한 파일이 아닌 경우
            if(item.indexOf('.swp') != -1) {
                return;    
            }

            stat = fs.statSync(item);

            if (stat.isFile() && item.indexOf('.markdown') >= 0) {
                page = loadPage(item);
                page._file = item;
                page.html = md.toHtmlSync(page.body);
              
                dir = item.split('/');
                file = dir.pop();
                page._dir = dir.join('/');

                page._path = item.replace(conf.sourceDir +'/pages', '');

                page._path = item.replace(conf.sourceDir +'/pages', '');
                page._path = page._path.replace('.markdown', '.html');
                page._path = page._path.replace('index.html', '');

                page.toc = getTOC(page.body);
                pages[page._path] = page;

            }
        });
Пример #3
0
 authorFiles.forEach(function(file) {
     author = loadAuthor(file);
     author._gravatar = getGravatar(author.head.email);
     author.body = md.toHtmlSync(author.body);
     author.archives = [];
     authors[author.head.name] = author;
 });
Пример #4
0
        getArchiveCutBody: function(id, cut) {
            var archive = archives[id].body.split('\n\n');
            cut = cut || 5;
            archive = archive.slice(0, cut);
            archive = archive.join('\n\n');

            return md.toHtmlSync(archive);
        },
Пример #5
0
 getAuthorIntro: function(id) {
     return md.toHtmlSync(authors[id].body);
 }
Пример #6
0
 getArchiveBody: function(id) {
     return md.toHtmlSync(archives[id].body);
 },
Пример #7
0
Converter.prototype.convertToHTML = function() {
  return markdown.toHtmlSync(this.mkdn_buffer).toString();
}