Browse Source

Added HTML

Piotr Czajkowski 3 years ago
parent
commit
8729f93d02
3 changed files with 27 additions and 0 deletions
  1. 1 0
      detectLanguage.go
  2. 1 0
      detectLanguage_test.go
  3. 25 0
      testFiles/html.txt

+ 1 - 0
detectLanguage.go

@@ -12,6 +12,7 @@ func init() {
 	checks["c"] = []string{"printf(", "malloc(", "realloc(", "free(", "#include", "#define", "sizeof", "typeof"}
 	checks["go"] = []string{"fmt.", "package ", ":= range", "make(map[", "if err != nil"}
 	checks["csharp"] = []string{"using", "namespace", ".Where(", ".Select(", "public ", "private ", "readonly ", "List<", " async ", "await "}
+	checks["html"] = []string{"html>", "head>", "body>", "title>", "script>", "div>"}
 }
 
 func removeString(array []string, index int) []string {

+ 1 - 0
detectLanguage_test.go

@@ -18,6 +18,7 @@ func init() {
 		{"c", "testFiles/c.txt", 0.4},
 		{"csharp", "testFiles/csharp.txt", 0.6},
 		{"go", "testFiles/go.txt", 0.5},
+		{"html", "testFiles/html.txt", 0.6},
 	}
 }
 

+ 25 - 0
testFiles/html.txt

@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+	<head>
+		<meta charset="utf-8">
+		<script async src="https://cdn.ampproject.org/v0.js"></script>
+		<title>Something went wrong</title>
+		<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
+		<script type="application/ld+json">
+			{
+				"@context": "http://schema.org",
+				"@type": "NewsArticle",
+				"headline": "Open-source framework for publishing content",
+				"datePublished": "2015-10-07T12:02:41Z",
+				"image": [
+				"logo.jpg"
+				]
+			}
+		</script>
+		<link rel="stylesheet" href="https://newcss.net/lite.css">
+		<link rel="stylesheet" href="https://newcss.net/theme/night.css">
+	</head>
+	<body>
+		<div>{{.}}</div>
+	</body>
+</html>