mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-04 05:17:08 +01:00
Improve XML encoding for Word docs.
Fix various encoding errors.
This commit is contained in:
@ -9,6 +9,7 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
||||
|
||||
var MD = require('marked')
|
||||
, H2W = require('../utils/html-to-wpml')
|
||||
, XML = require('xml-escape')
|
||||
, moment = require('moment')
|
||||
, _ = require('underscore');
|
||||
|
||||
@ -33,10 +34,12 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
||||
wpml: function( txt, inline ) {
|
||||
if(!txt) return '';
|
||||
inline = (inline && !inline.hash) || false;
|
||||
txt = XML(txt.trim());
|
||||
txt = inline ?
|
||||
MD(txt.trim()).replace(/^\s*<p>|<\/p>\s*$/gi, '') :
|
||||
MD(txt.trim());
|
||||
txt = H2W( txt.trim() );
|
||||
MD(txt).replace(/^\s*<p>|<\/p>\s*$/gi, '') :
|
||||
MD(txt);
|
||||
txt = H2W( txt );
|
||||
console.log(txt);
|
||||
return txt;
|
||||
},
|
||||
|
||||
|
@ -35,8 +35,13 @@ Definition of the HandlebarsGenerator class.
|
||||
|
||||
// Compile and run the Handlebars template.
|
||||
var template = HANDLEBARS.compile(jst);
|
||||
|
||||
var encData = json;
|
||||
( format === 'html' || format === 'pdf' ) && (encData = json.markdownify());
|
||||
( format === 'doc' ) && (encData = json.xmlify());
|
||||
|
||||
return template({
|
||||
r: format === 'html' || format === 'pdf' || format === 'png' ? json.markdownify() : json,
|
||||
r: encData,
|
||||
RAW: json,
|
||||
filt: opts.filters,
|
||||
cssInfo: cssInfo,
|
||||
|
Reference in New Issue
Block a user