Refactor + Bugs fixes on Strings + Gestion de la génération des images

This commit is contained in:
2022-02-14 14:02:49 +01:00
parent 11a40305dd
commit 5dd2340a11
76 changed files with 1878 additions and 704 deletions

View File

@@ -7,35 +7,33 @@
import Foundation
extension Strings {
class Section {
let name: String // OnBoarding
var definitions = [Definition]()
init(name: String) {
self.name = name
class Section {
let name: String // OnBoarding
var definitions = [Definition]()
init(name: String) {
self.name = name
}
static func match(_ line: String) -> Section? {
guard line.range(of: "\\[\\[(.*?)]]$", options: .regularExpression, range: nil, locale: nil) != nil else {
return nil
}
static func match(_ line: String) -> Section? {
guard line.range(of: "\\[\\[(.*?)]]", options: .regularExpression, range: nil, locale: nil) != nil else {
return nil
let sectionName = line
.replacingOccurrences(of: ["[", "]"], with: "")
.removeLeadingTrailingWhitespace()
return Section(name: sectionName)
}
func hasOneOrMoreMatchingTags(tags: [String]) -> Bool {
let allTags = definitions.flatMap { $0.tags }
for tag in tags {
if allTags.contains(tag) {
return true
}
let sectionName = line
.replacingOccurrences(of: ["[", "]"], with: "")
.removeLeadingTrailingWhitespace()
return Section(name: sectionName)
}
func hasOneOrMoreMatchingTags(tags: [String]) -> Bool {
let allTags = definitions.flatMap { $0.tags }
for tag in tags {
if allTags.contains(tag) {
return true
}
}
return false
}
return false
}
}