1
0
Fork 0

help translations

This commit is contained in:
sspanak 2024-10-21 16:56:30 +03:00 committed by Dimo Karaivanov
parent 4e5796ea3e
commit c8c7e1546f
11 changed files with 1044 additions and 347 deletions

View file

@ -1,4 +1,10 @@
ext.markdownToHTML = { markdownPath, htmlPath ->
ext.convertHelpDocs = {markdownDir, htmlDir ->
fileTree(markdownDir).getFiles().parallelStream().forEach { File markdownPath ->
markdownToHtml(markdownPath.path, "${htmlDir}/${markdownPath.name.replaceAll("\\.md\$", ".html")}")
}
}
static markdownToHtml(markdownPath, htmlPath) {
def text = new File(markdownPath).text
text = convertHeaders(text)
@ -63,7 +69,7 @@ static convertHeaders(markdown) {
}
def header = line.replaceAll("^#+", "").trim()
def anchor = header.toLowerCase().replaceAll("[^a-z0-9]+", "-").replaceAll("[\\-]+\$", "")
def anchor = header.toLowerCase().replaceAll("[^\\d\\p{L}]+", "-").replaceAll("[\\-]+\$", "")
return "<h${headerNumber} id=\"${anchor}\">${header}</h${headerNumber}>"
} else {