<commit_before>const { stripIndent, source } = require('common-tags')

function template7({ profile, schools, jobs, skills, projects }) {
  return stripIndent`
    ${generateHeader()}
    ${generateProfileSection(profile)}
    \\begin{document}
    ${profile ? '\\makecvtitle' : ''}
    ${generateEducationSection(schools)}
    ${generateExperienceSection(jobs)}

    \\section{Skills}
    \\cvitem{Languages}{Java, JavaScript, Ruby, Python, \\LaTeX, HTML, CSS}
    \\cvitem{Frameworks}{Node.js, Koa, Express, React, Redux, Sinatra}

    \\section{Projects}
    \\cventry{}{LaTeX Resume Generator}{}{\\textit{Node.js, Koa, React, Redux}}{}{A webapp for generating LaTeX resumes from form data (including this one).\\\\https://latexresu.me}

    \\vspace{2mm}

    \\cventry{}{Flow Timer}{}{\\textit{Node.js, Koa, React, Redux}}{}{A modern speedcubing app with a scrambler, timer, and analyzer for cubing statistics.\\\\https://flowtimer.com}

    \\vspace{2mm}

    \\cventry{}{Reddit Image Scraper}{}{\\textit{Ruby, Sinatra}}{}{A web app that lets you view a collage of images/videos from a subreddit.\\\\reddit-image-scraper.herokuapp.com}

    \\end{document}
  `
}

function generateProfileSection(profile = {}) {
  const { fullName, email, phoneNumber, address, link } = profile

  return stripIndent`
    % Profile
    \\name{${fullName || ''}}{}
    \\address{${address || ''}}
    ${phoneNumber ? `\\phone[mobile]{${phoneNumber}}` : ''}
    ${email ? `\\email{${email || ''}}` : ''}
    ${link ? `\\homepage{${link || ''}}` : ''}
  `
}

function generateEducationSection(schools) {
  if (!schools) {
    return ''
  }

  return source`
    \\section{Education}
    ${schools.map((school) => {
      const { name, degree, major, gpa, location, graduationDate } = school

      let degreeLine = ''

      if (degree && major) {
        degreeLine = `${degree} in ${major}`
      } else if (degree || major) {
        degreeLine = degree || major
      }

      return stripIndent`
        \\cventry
          {${graduationDate || ''}}
          {${degreeLine}}
          {${name || ''}}
          {${gpa ? `GPA: ${gpa}` : ''}}
          {\\textit{${location || ''}}}
          {}
      `
    })}
  `
}

function generateExperienceSection(jobs) {
  if (!jobs) {
    return ''
  }

  return source`
    \\section{Experience}
    ${jobs.map((job) => {
      const { name, title, location, startDate, endDate, duties } = job

      let dateRange = ''
      let dutyLines = ''

      if (startDate && endDate) {
        dateRange = `${startDate} -- ${endDate}`
      } else if (startDate) {
        dateRange = `${startDate} -- Present`
      } else {
        dateRange = endDate
      }

      if (duties) {
        dutyLines = source`
          \\begin{itemize}%
            ${duties.map(duty => `\\item ${duty}`)}
          \\end{itemize}
        `
      }

      return stripIndent`
        \\cventry
          {${dateRange}}
          {${title || ''}}
          {${name || ''}}
          {${location || ''}}
          {}
          {${dutyLines}}
      `
    })}
  `
}

function generateHeader() {
  return stripIndent`
    %% start of file 'template.tex'.
    %% Copyright 2006-2013 <NAME> (<EMAIL>).
    %
    % This work may be distributed and/or modified under the<commit_msg>add skills section to template7<commit_after>const { stripIndent, source } = require('common-tags')

function template7({ profile, schools, jobs, skills, projects }) {
  return stripIndent`
    ${generateHeader()}
    ${generateProfileSection(profile)}
    \\begin{document}
    ${profile ? '\\makecvtitle' : ''}
    ${generateEducationSection(schools)}
    ${generateExperienceSection(jobs)}
    ${generateSkillsSection(skills)}

    \\section{Projects}
    \\cventry{}{LaTeX Resume Generator}{}{\\textit{Node.js, Koa, React, Redux}}{}{A webapp for generating LaTeX resumes from form data (including this one).\\\\https://latexresu.me}

    \\vspace{2mm}

    \\cventry{}{Flow Timer}{}{\\textit{Node.js, Koa, React, Redux}}{}{A modern speedcubing app with a scrambler, timer, and analyzer for cubing statistics.\\\\https://flowtimer.com}

    \\vspace{2mm}

    \\cventry{}{Reddit Image Scraper}{}{\\textit{Ruby, Sinatra}}{}{A web app that lets you view a collage of images/videos from a subreddit.\\\\reddit-image-scraper.herokuapp.com}

    \\end{document}
  `
}

function generateProfileSection(profile = {}) {
  const { fullName, email, phoneNumber, address, link } = profile

  return stripIndent`
    % Profile
    \\name{${fullName || ''}}{}
    \\address{${address || ''}}
    ${phoneNumber ? `\\phone[mobile]{${phoneNumber}}` : ''}
    ${email ? `\\email{${email || ''}}` : ''}
    ${link ? `\\homepage{${link || ''}}` : ''}
  `
}

function generateEducationSection(schools) {
  if (!schools) {
    return ''
  }

  return source`
    \\section{Education}
    ${schools.map((school) => {
      const { name, degree, major, gpa, location, graduationDate } = school

      let degreeLine = ''

      if (degree && major) {
        degreeLine = `${degree} in ${major}`
      } else if (degree || major) {
        degreeLine = degree || major
      }

      return stripIndent`
        \\cventry
          {${graduationDate || ''}}
          {${degreeLine}}
          {${name || ''}}
          {${gpa ? `GPA: ${gpa}` : ''}}
          {\\textit{${location || ''}}}
          {}
      `
    })}
  `
}

function generateExperienceSection(jobs) {
  if (!jobs) {
    return ''
  }

  return source`
    \\section{Experience}
    ${jobs.map((job) => {
      const { name, title, location, startDate, endDate, duties } = job

      let dateRange = ''
      let dutyLines = ''

      if (startDate && endDate) {
        dateRange = `${startDate} -- ${endDate}`
      } else if (startDate) {
        dateRange = `${startDate} -- Present`
      } else {
        dateRange = endDate
      }

      if (duties) {
        dutyLines = source`
          \\begin{itemize}%
            ${duties.map(duty => `\\item ${duty}`)}
          \\end{itemize}
        `
      }

      return stripIndent`
        \\cventry
          {${dateRange}}
          {${title || ''}}
          {${name || ''}}
          {${location || ''}}
          {}
          {${dutyLines}}
      `
    })}
  `
}

function generateSkillsSection(skills) {
  if (!skills) {
    return ''
  }

  return source`
    \\section{Skills}
    ${skills.map(skill => `\\cvitem{${skill.name || ''}}{${skill.details || ''}}`)}
  `
}

function generateHeader() {
  return stripIndent`
    %% start of file 'template.tex'.
    %% Copyright 2006-2013 <NAME> (<EMAIL>).
    %
    % This work may be distributed and/or modified under the
{'fraction_non_alphanumeric': 0.18132692885019513, 'fraction_numerical': 0.003452416691684179, 'mean_word_length': 2.4309989701338828, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1081879', 'n_tokens_mistral': 2179, 'n_tokens_neox': 2096, 'n_words': 453}