diff options
| author | Féry Mathieu (Mathius) <ferymathieuy@gmail.com> | 2022-04-18 17:20:47 +0200 |
|---|---|---|
| committer | Féry Mathieu (Mathius) <ferymathieuy@gmail.com> | 2022-05-18 23:45:47 +0200 |
| commit | 2e195575a62886d2492e9c505d7bc283b7f60097 (patch) | |
| tree | 45c775d627672f6201232ffdfb7414160bf8c31f /src | |
| parent | 28efeaa4f2cd3c3d13e0d865dc50a2ec0be8e054 (diff) | |
| download | invidious-2e195575a62886d2492e9c505d7bc283b7f60097.tar.gz invidious-2e195575a62886d2492e9c505d7bc283b7f60097.tar.bz2 invidious-2e195575a62886d2492e9c505d7bc283b7f60097.zip | |
Rename uriMatch to urlMatch inside comments.cr
This refactor update text_to_parsed_content method
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/comments.cr | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index c1bcc0a6..199e4be3 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -566,12 +566,12 @@ def text_to_parsed_content(text : String) : JSON::Any currentNodes = [] of JSON::Any initialNode = {"text" => line} currentNodes << (JSON.parse(initialNode.to_json)) - line.scan(/https?:\/\/[^ ]*/).each do |uriMatch| + line.scan(/https?:\/\/[^ ]*/).each do |urlMatch| lastNode = currentNodes[currentNodes.size - 1].as_h - splittedLastNode = lastNode["text"].as_s.split(uriMatch[0]) + splittedLastNode = lastNode["text"].as_s.split(urlMatch[0]) lastNode["text"] = JSON.parse(splittedLastNode[0].to_json) currentNodes[currentNodes.size - 1] = JSON.parse(lastNode.to_json) - currentNode = {"text" => uriMatch[0], "navigationEndpoint" => {"urlEndpoint" => {"url" => uriMatch[0]}}} + currentNode = {"text" => urlMatch[0], "navigationEndpoint" => {"urlEndpoint" => {"url" => urlMatch[0]}}} currentNodes << (JSON.parse(currentNode.to_json)) afterNode = {"text" => splittedLastNode.size > 0 ? splittedLastNode[1] : ""} currentNodes << (JSON.parse(afterNode.to_json)) |
