From e2c502ad544b0dbcdd8bcde3a5f1159951dd706d Mon Sep 17 00:00:00 2001 From: mudassir0909 Date: Thu, 22 Dec 2016 22:29:01 +1100 Subject: [PATCH] Migrate to pugjs --- .gitignore | 1 + index.js | 4 ++-- index.jade => index.pug | 10 +++++----- jade/background-card.jade | 15 --------------- package.json | 16 ++++++++-------- pug/background-card.pug | 15 +++++++++++++++ .../about.jade => pug/background/about.pug | 0 .../awards.jade => pug/background/awards.pug | 2 +- .../background/education.pug | 4 ++-- .../background/interests.pug | 4 ++-- .../background/publications.pug | 2 +- .../background/references.pug | 2 +- .../skills.jade => pug/background/skills.pug | 4 ++-- .../background/volunteer-work.pug | 4 ++-- .../background/work-experience.pug | 4 ++-- jade/floating-nav.jade => pug/floating-nav.pug | 2 +- jade/profile-card.jade => pug/profile-card.pug | 2 +- jade/scripts.jade => pug/scripts.pug | 0 jade/stylesheets.jade => pug/stylesheets.pug | 0 serve.js | 7 ++++--- 20 files changed, 50 insertions(+), 48 deletions(-) rename index.jade => index.pug (65%) delete mode 100644 jade/background-card.jade create mode 100644 pug/background-card.pug rename jade/background/about.jade => pug/background/about.pug (100%) rename jade/background/awards.jade => pug/background/awards.pug (93%) rename jade/background/education.jade => pug/background/education.pug (91%) rename jade/background/interests.jade => pug/background/interests.pug (81%) rename jade/background/publications.jade => pug/background/publications.pug (93%) rename jade/background/references.jade => pug/background/references.pug (91%) rename jade/background/skills.jade => pug/background/skills.pug (87%) rename jade/background/volunteer-work.jade => pug/background/volunteer-work.pug (91%) rename jade/background/work-experience.jade => pug/background/work-experience.pug (92%) rename jade/floating-nav.jade => pug/floating-nav.pug (88%) rename jade/profile-card.jade => pug/profile-card.pug (98%) rename jade/scripts.jade => pug/scripts.pug (100%) rename jade/stylesheets.jade => pug/stylesheets.pug (100%) diff --git a/.gitignore b/.gitignore index ab1643fb..043aff04 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/* resume.json build/* *.DS_Store +public/ diff --git a/index.js b/index.js index 7c68e45c..c1b1c948 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ var fs = require('fs'); -var jade = require('jade'); +var pug = require('pug'); var _ = require('underscore'); var utils = require('jsonresume-themeutils'); var moment = require('moment'); @@ -169,7 +169,7 @@ function render(resume) { reference_info.reference = convertMarkdown(reference_info.reference); }); - return jade.renderFile(__dirname + '/index.jade', { + return pug.renderFile(__dirname + '/index.pug', { resume: resume, floating_nav_items: getFloatingNavItems(resume), css: css, diff --git a/index.jade b/index.pug similarity index 65% rename from index.jade rename to index.pug index 198abbeb..b72fbee1 100644 --- a/index.jade +++ b/index.pug @@ -5,13 +5,13 @@ html(lang="en") meta(http-equiv="X-UA-Compatible", content="IE=edge") meta(name="viewport", content="width=device-width, initial-scale=1") title= resume.basics.name - include jade/stylesheets + include pug/stylesheets.pug body(itemscope, itemtype="http://schema.org/Person") .container-fluid .row.main.clearfix - include jade/floating-nav - include jade/profile-card - include jade/background-card + include pug/floating-nav.pug + include pug/profile-card.pug + include pug/background-card.pug - include jade/scripts + include pug/scripts.pug diff --git a/jade/background-card.jade b/jade/background-card.jade deleted file mode 100644 index 68b3ea1a..00000000 --- a/jade/background-card.jade +++ /dev/null @@ -1,15 +0,0 @@ -section.col-md-9.card-wrapper.pull-right - .card.background-card - h4.text-uppercase Background - hr - - .background-details - include background/about - include background/work-experience - include background/skills - include background/education - include background/awards - include background/volunteer-work - include background/publications - include background/interests - include background/references diff --git a/package.json b/package.json index 1e8aa272..5caae771 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jsonresume-theme-elegant", - "version": "1.6.10", + "version": "1.7.11", "description": "Elegant theme for jsonresume", "main": "index.js", "scripts": { @@ -24,22 +24,22 @@ "dependencies": { "gravatar": "^1.0.6", "handlebars": "^2.0.0-alpha.4", - "jade": "^1.11.0", "jsonresume-themeutils": "^1.3.2", "markdown-it": "^6.0.1", "markdown-it-abbr": "^1.0.3", "moment": "^2.8.1", - "resume-schema": "0.0.15", + "pug": "^2.0.0-beta6", + "resume-schema": "0.0.16", "tarball-extract": "0.0.3", "underscore": "^1.6.0" }, "devDependencies": { "grunt": "^0.4.5", - "grunt-contrib-less": "^0.11.4", - "grunt-contrib-watch": "^0.6.1", - "grunt-exec": "^0.4.6", - "grunt-contrib-copy": "0.4.x", + "less": "^1.7.5", "grunt-contrib-clean": "0.5.x", - "less": "^1.7.5" + "grunt-contrib-copy": "0.4.x", + "grunt-contrib-less": "^1.4.0", + "grunt-contrib-watch": "^0.6.1", + "grunt-exec": "^0.4.6" } } diff --git a/pug/background-card.pug b/pug/background-card.pug new file mode 100644 index 00000000..a926a8de --- /dev/null +++ b/pug/background-card.pug @@ -0,0 +1,15 @@ +section.col-md-9.card-wrapper.pull-right + .card.background-card + h4.text-uppercase Background + hr + + .background-details + include background/about.pug + include background/work-experience.pug + include background/skills.pug + include background/education.pug + include background/awards.pug + include background/volunteer-work.pug + include background/publications.pug + include background/interests.pug + include background/references.pug diff --git a/jade/background/about.jade b/pug/background/about.pug similarity index 100% rename from jade/background/about.jade rename to pug/background/about.pug diff --git a/jade/background/awards.jade b/pug/background/awards.pug similarity index 93% rename from jade/background/awards.jade rename to pug/background/awards.pug index 6a9c2831..1c6e3ed9 100644 --- a/jade/background/awards.jade +++ b/pug/background/awards.pug @@ -9,7 +9,7 @@ unless _.isEmpty(resume.awards) .content ul.list-unstyled.clear-margin - - each award in resume.awards + each award in resume.awards li.card.card-nested .content p.clear-margin(itemprop="award") diff --git a/jade/background/education.jade b/pug/background/education.pug similarity index 91% rename from jade/background/education.jade rename to pug/background/education.pug index daf4990e..aec40fe0 100644 --- a/jade/background/education.jade +++ b/pug/background/education.pug @@ -9,7 +9,7 @@ unless _.isEmpty(resume.education) .content ul.list-unstyled.clear-margin - - each education_info in resume.education + each education_info in resume.education li.card.card-nested .content p.clear-margin.relative @@ -31,5 +31,5 @@ unless _.isEmpty(resume.education) unless _.isEmpty(education_info.courses) .space-top.labels - - each course in education_info.courses + each course in education_info.courses span.label.label-keyword= course diff --git a/jade/background/interests.jade b/pug/background/interests.pug similarity index 81% rename from jade/background/interests.jade rename to pug/background/interests.pug index cf9397e6..325be431 100644 --- a/jade/background/interests.jade +++ b/pug/background/interests.pug @@ -9,12 +9,12 @@ unless _.isEmpty(resume.interests) .content ul.list-unstyled.clear-margin - - each interest in resume.interests + each interest in resume.interests li.card.card-nested p strong= interest.name unless _.isEmpty(interest.keywords) .space-top.labels - - each keyword in interest.keywords + each keyword in interest.keywords span.label.label-keyword= keyword diff --git a/jade/background/publications.jade b/pug/background/publications.pug similarity index 93% rename from jade/background/publications.jade rename to pug/background/publications.pug index ca3ef38b..6ae4dc3d 100644 --- a/jade/background/publications.jade +++ b/pug/background/publications.pug @@ -10,7 +10,7 @@ unless _.isEmpty(resume.publications) .content ul.list-unstyled.clear-margin - - each publication in resume.publications + each publication in resume.publications li.card.card-nested .content p.clear-margin diff --git a/jade/background/references.jade b/pug/background/references.pug similarity index 91% rename from jade/background/references.jade rename to pug/background/references.pug index 8615e069..5b3365dc 100644 --- a/jade/background/references.jade +++ b/pug/background/references.pug @@ -9,7 +9,7 @@ unless _.isEmpty(resume.references) .content ul.list-unstyled.clear-margin - - each reference_info in resume.references + each reference_info in resume.references li.card.card-nested if reference_info.website a(href=reference_info.website, target="_blank")= reference_info.name diff --git a/jade/background/skills.jade b/pug/background/skills.pug similarity index 87% rename from jade/background/skills.jade rename to pug/background/skills.pug index d4368dbe..8ee95107 100644 --- a/jade/background/skills.jade +++ b/pug/background/skills.pug @@ -9,7 +9,7 @@ unless _.isEmpty(resume.skills) .content ul.list-unstyled.clear-margin - - each skill in resume.skills + each skill in resume.skills li.card.card-nested.card-skills if skill.display_progress_bar .skill-level(data-toggle="tooltip", title=skill.level, data-placement="left") @@ -20,5 +20,5 @@ unless _.isEmpty(resume.skills) unless _.isEmpty(skill.keywords) .space-top.labels - - each keyword in skill.keywords + each keyword in skill.keywords span.label.label-keyword= keyword diff --git a/jade/background/volunteer-work.jade b/pug/background/volunteer-work.pug similarity index 91% rename from jade/background/volunteer-work.jade rename to pug/background/volunteer-work.pug index 81d09d07..692682cc 100644 --- a/jade/background/volunteer-work.jade +++ b/pug/background/volunteer-work.pug @@ -9,7 +9,7 @@ unless _.isEmpty(resume.volunteer) .content ul.list-unstyled.clear-margin - - each volunteer_info in resume.volunteer + each volunteer_info in resume.volunteer li.card.card-nested .content p.clear-margin.relative @@ -34,5 +34,5 @@ unless _.isEmpty(resume.volunteer) unless _.isEmpty(volunteer_info.highlights) ul - - each highlight in volunteer_info.highlights + each highlight in volunteer_info.highlights li.mop-wrapper!= highlight diff --git a/jade/background/work-experience.jade b/pug/background/work-experience.pug similarity index 92% rename from jade/background/work-experience.jade rename to pug/background/work-experience.pug index 672acf73..43bc60c3 100644 --- a/jade/background/work-experience.jade +++ b/pug/background/work-experience.pug @@ -8,7 +8,7 @@ unless _.isEmpty(resume.work) h4.title.text-uppercase Work Experience ul.list-unstyled.clear-margin - - each experience in resume.work + each experience in resume.work li.card.card-nested.clearfix .content p.clear-margin.relative @@ -39,5 +39,5 @@ unless _.isEmpty(resume.work) unless _.isEmpty(experience.highlights) ul - - each highlight in experience.highlights + each highlight in experience.highlights li.mop-wrapper!= highlight diff --git a/jade/floating-nav.jade b/pug/floating-nav.pug similarity index 88% rename from jade/floating-nav.jade rename to pug/floating-nav.pug index c7579e8c..5c73aefc 100644 --- a/jade/floating-nav.jade +++ b/pug/floating-nav.pug @@ -10,5 +10,5 @@ a(href="#").js-floating-nav-trigger.floating-nav-trigger nav.floating-nav.js-floating-nav ul.list-unstyled - - each nav_item in floating_nav_items + each nav_item in floating_nav_items +make_nav_link(nav_item) diff --git a/jade/profile-card.jade b/pug/profile-card.pug similarity index 98% rename from jade/profile-card.jade rename to pug/profile-card.pug index 97d203f8..1d2b58e5 100644 --- a/jade/profile-card.jade +++ b/pug/profile-card.pug @@ -9,7 +9,7 @@ mixin profile_card_detail(icon, info, itemprop, icon_title) |#{info} mixin render_links(profiles) - - each profile in profiles + each profile in profiles a.fs-2x.social-link( href=profile.url, target="_blank", diff --git a/jade/scripts.jade b/pug/scripts.pug similarity index 100% rename from jade/scripts.jade rename to pug/scripts.pug diff --git a/jade/stylesheets.jade b/pug/stylesheets.pug similarity index 100% rename from jade/stylesheets.jade rename to pug/stylesheets.pug diff --git a/serve.js b/serve.js index 8fbe782f..ac622fa9 100644 --- a/serve.js +++ b/serve.js @@ -7,14 +7,15 @@ // var http = require("http"); -var resume = require("resume-schema").resumeJson; +var fs = require("fs"); +var resume = JSON.parse(fs.readFileSync('node_modules/resume-schema/resume.json', 'utf8')); var theme = require("./index.js"); var path = require("path"); -var fs = require("fs"); var port = 8888; http.createServer(function(req, res) { - var picture = resume.basics.picture.replace(/^\//, ""); + var picture = resume.basics.picture && resume.basics.picture.replace(/^\//, ""); + if (picture && req.url.replace(/^\//, "") === picture.replace(/^.\//, "")) { var format = path.extname(picture); try {