Skip to content

Commit

Permalink
Enable mutltiple skill
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
Theo-Hafsaoui committed Oct 13, 2024
1 parent 80d0c84 commit 4014157
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
6 changes: 4 additions & 2 deletions cv/eng/skill.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Languages
## Java, Python, Ruby, Golang, SQL, JavaScript, HTML/CSS
**Languages**
- Java, Python, Ruby, Golang, SQL, JavaScript, HTML/CSS
**Library**
- a bo0k
6 changes: 4 additions & 2 deletions cv/fr/skill.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Langages
## Langage A, Langage B, Langage C, Langage D, Langage E, Langage F, Langage G/H
**Langage**
- Langage A, Langage B, Langage C, Langage D, Langage E, Langage F, Langage G/H

**Librarie**
- Librarie A, Librarie B, Librarie C, Librarie D, Librarie E, Librarie F, Librarie G/H
25 changes: 22 additions & 3 deletions internal/markup_languages/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,35 @@ func (s Section) String() string {
}

/*
Parse parses a Markdown-like `paragraph` into a `Section`, extracting headings and description based on the number of leading hashtags. Returns an error if the format is invalid.
Parse parses a Markdown-like `paragraph` into a `Section`,
extracting headings and description based on the number of leading hashtags or stars.
Returns an error if the format is invalid.
*/
func Parse(paragraph string) (Section,error){
section := Section{}
if len(strings.Split(paragraph, "\n\n")) > 1{
return section, errors.New("Tried to parse mutiple paragraph into a single section")
}
r, _ := regexp.Compile("^#+")
hashtag_regex, _ := regexp.Compile("^#+")
wasASkill := false
for _, line := range strings.Split(strings.TrimRight(paragraph, "\n"), "\n") {
nb_hashtag := len(r.FindString(line))
nb_hashtag := len(hashtag_regex.FindString(line))

if len(line) == 0{
continue
}

if wasASkill {
wasASkill = false
section.second= strings.TrimLeft(line,"- ")
}

if nb_hashtag == 0 && string(line[0])=="*" && len(strings.Trim(line,"*")) == len(line) - 4 {//Trim should **tt** -> tt
section.first= strings.Trim(line,"*")
wasASkill = true
}


switch{
case nb_hashtag>0 && line[nb_hashtag] != ' ':
return section, errors.New("Err: cannot parse this md line{"+line+"} # should be followed by space")
Expand Down

0 comments on commit 4014157

Please sign in to comment.