Skip to content

Commit

Permalink
Merge pull request #228 from ngmgit/fix/hyperlink
Browse files Browse the repository at this point in the history
fix: hyperlink: urls in pdf
  • Loading branch information
ducaale authored Jan 21, 2024
2 parents ff099de + 53d1f63 commit 0274664
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 15 deletions.
6 changes: 4 additions & 2 deletions src/lib/templates/template1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ const generator: Generator = {

const { name, email, phone, location, website } = basics
const address = location?.address || ''
const websiteLine = website ? `\\href{${website}}{${website}}` : ''

let line1 = name ? `{\\Huge \\scshape {${name}}}` : ''
let line2 = [address, email, phone, website]
let line2 = [address, email, phone, websiteLine]
.filter(Boolean)
.join(' $\\cdot$ ')

Expand Down Expand Up @@ -196,7 +197,7 @@ const generator: Generator = {
}
if (url) {
line1 += `\\hfill ${url}`
line1 += `\\hfill \\href{${url}}{${url}}`
}
if (line1) {
Expand Down Expand Up @@ -328,6 +329,7 @@ function template1(values: FormValues) {
\\pagestyle{empty}
\\raggedright
\\usepackage[left=0.8in,right=0.8in,bottom=0.8in,top=0.8in]{geometry}
\\usepackage[hidelinks]{hyperref}
${generator.resumeHeader()}
Expand Down
7 changes: 5 additions & 2 deletions src/lib/templates/template2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const generator: Generator = {
const addressLine = location.address
? `{\\faMapMarker\\ ${location.address}}`
: ''
const websiteLine = website ? `{\\faLink\\ ${website}}` : ''
const websiteLine = website
? `{\\faLink\\ \\href{${website}}{${website}}}`
: ''
const info = [emailLine, phoneLine, addressLine, websiteLine]
.filter(Boolean)
.join(' | ')
Expand Down Expand Up @@ -188,13 +190,14 @@ const generator: Generator = {
\\begin{cventries}
${projects.map((project) => {
const { name, description, keywords = [], url } = project
const urlLine = url ? `\\href{${url}}{${url}}` : ''
return stripIndent`
\\cventry
{${description || ''}}
{${name || ''}}
{${keywords.join(', ') || ''}}
{${url || ''}}
{${urlLine}}
{}
\\vspace{-5mm}
Expand Down
8 changes: 6 additions & 2 deletions src/lib/templates/template3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const generator: Generator = {
}

const { name, email, phone, location = {}, website } = basics
const info = [email, phone, location.address, website]
const websiteLine = website ? `\\href{${website}}{${website}}` : ''

const info = [email, phone, location.address, websiteLine]
.filter(Boolean)
.join(' | ')

Expand Down Expand Up @@ -165,13 +167,14 @@ const generator: Generator = {
const descriptionWithNewline = description
? `\\\\${description}`
: description
const urlLine = url ? `\\href{${url}}{${url}}` : ''
return stripIndent`
\\item[]
\\project
{${name}}
{${keywords.join(', ')}}
{${url}}
{${urlLine}}
{${descriptionWithNewline}}
`
})}
Expand Down Expand Up @@ -229,6 +232,7 @@ const generator: Generator = {
\\usepackage{textcomp}
\\usepackage[utf8]{inputenc}
\\usepackage[T1]{fontenc}
\\usepackage[hidelinks]{hyperref}
%-----------------------------------------------------------
Expand Down
8 changes: 6 additions & 2 deletions src/lib/templates/template5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const generator: Omit<Generator, 'resumeHeader'> = {
}

const { name, email, phone, location = {}, website } = basics
const info = [email, phone, location.address, website]
const websiteLine = website ? `\\href{${website}}{${website}}` : ''

const info = [email, phone, location.address, websiteLine]
.filter(Boolean)
.join(' | ')

Expand Down Expand Up @@ -193,7 +195,8 @@ const generator: Omit<Generator, 'resumeHeader'> = {
}
if (url) {
projectLine += projectLine ? `\\\\ ${url}` : url
const urlLine = url ? `\\href{${url}}{${url}}` : ''
projectLine += projectLine ? `\\\\ ${urlLine}` : urlLine
}
if (projectLine) {
Expand Down Expand Up @@ -235,6 +238,7 @@ function template5(values: FormValues) {
\\usepackage{textcomp}
\\usepackage[utf8]{inputenc}
\\usepackage[T1]{fontenc}
\\usepackage[hidelinks]{hyperref}
\\begin{document}
${generator.profileSection(values.basics)}
\\begin{resume}
Expand Down
8 changes: 6 additions & 2 deletions src/lib/templates/template6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const generator: Omit<Generator, 'resumeHeader'> = {
}

const { name = '', email, phone, location = {}, website } = basics
const info = [email, phone, location.address, website].filter(Boolean)
const websiteLine = website ? `\\href{${website}}{${website}}` : ''

const info = [email, phone, location.address, websiteLine].filter(Boolean)

return stripIndent`
\\begin{center}
Expand Down Expand Up @@ -183,12 +185,13 @@ const generator: Omit<Generator, 'resumeHeader'> = {
const descriptionWithNewline = description
? `${description}\\\\`
: description
const urlLine = url ? `\\href{${url}}{${url}}` : ''
return stripIndent`
\\project
{${name}}
{${keywords.join(', ')}}
{${url}}
{${urlLine}}
{${descriptionWithNewline}}
`
})}
Expand Down Expand Up @@ -229,6 +232,7 @@ function template6(values: FormValues) {
return stripIndent`
\\documentclass[10pt]{article}
\\usepackage[english]{babel}
\\usepackage[hidelinks]{hyperref}
\\input{minimal-resume-config}
\\begin{document}
${values.sections
Expand Down
9 changes: 6 additions & 3 deletions src/lib/templates/template8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const generator: Generator = {
}

const { name, email, phone = '', location = {}, website } = basics
const websiteLine = website ? `\\href{${website}}{${website}}` : ''

let addressLine = ''
let contactsLine = ''
Expand All @@ -20,9 +21,9 @@ const generator: Generator = {
}

if (email && website) {
contactsLine = `\\contacts{${email} \\linebreak ${website}}`
contactsLine = `\\contacts{${email} \\linebreak ${websiteLine}}`
} else if (email || website) {
contactsLine = `\\contacts{${email || website}}`
contactsLine = `\\contacts{${email || websiteLine}}`
}

return `
Expand Down Expand Up @@ -175,7 +176,8 @@ const generator: Generator = {
}
if (url) {
line += `(${url}) `
const urlLine = url ? `\\href{${url}}{${url}}` : ''
line += `(${urlLine}) `
}
if (description) {
Expand Down Expand Up @@ -270,6 +272,7 @@ function template8(values: FormValues) {
% For mathematical symbols
\\usepackage{amsmath}
\\usepackage[hidelinks]{hyperref}
${generator.profileSection(values.basics)}
Expand Down
8 changes: 6 additions & 2 deletions src/lib/templates/template9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const generator: Generator = {
}

const { name, email, phone, location = {}, website } = basics
const info = [email, phone, location.address, website]
const websiteLine = website ? `\\href{${website}}{${website}}` : ''

const info = [email, phone, location.address, websiteLine]
.filter(Boolean)
.join(' | ')

Expand Down Expand Up @@ -167,9 +169,10 @@ const generator: Generator = {
${projects.map((project, i) => {
const { name, description, keywords = [], url } = project
const urlLine = url ? `\\href{${url}}{${url}}` : ''
return stripIndent`
\\ProjectEntry{${name || ''}}{${url || ''}}
\\ProjectEntry{${name || ''}}{${urlLine || ''}}
{${keywords.join(', ')}}
{${description || ''}}
${i < lastProjectIndex ? '\\sepspace' : ''}
Expand Down Expand Up @@ -216,6 +219,7 @@ const generator: Generator = {
\\usepackage{url}
\\usepackage{lmodern} % Allow arbitrary font sizes
\\usepackage{textcomp}
\\usepackage[hidelinks]{hyperref}
%% Define a new 'modern' style for the url package that will use a smaller font.
\\makeatletter
Expand Down

0 comments on commit 0274664

Please sign in to comment.