Rosetta Code/Run examples: Difference between revisions
Updated the URL to get page content and updated the regular expression as "lang" has changed to "syntaxhighlight".
(→{{header|Wren}}: Wren script partially rewritten to deal with site changes.) |
(Updated the URL to get page content and updated the regular expression as "lang" has changed to "syntaxhighlight".) |
||
Line 628:
continue
let url = "https://rosettacode.org/
let body = client.getContent(url)
var lang: string
Line 643:
of "go":
lang2 = "Go"
lang3 = """("go"|"Go"|"GO")"""
ext = "go"
of "nim":
lang2 = "Nim"
lang3 = """("nim"|"Nim")"""
ext = "nim"
of "perl":
lang2 = "Perl"
lang3 = """("perl"|"Perl")"""
ext = "pl"
of "python":
lang2 = "Python"
lang3 = """("python"|"Python")"""
ext = "py"
let fileName = "rc_temp." & ext
let
let language = r"lt;syntaxhighlight lang=$#>".format(lang3)
let regex = re(header & r"==.*?&" & language & r"(.*?)</syntaxhighlight>")
var matches: array[2, string]
let idx = body.find(regex, matches)
|