This commit is contained in:
Morgan Bazalgette
2017-01-14 18:42:10 +01:00
parent 41ee4c90b3
commit 3961e310b1
444 changed files with 179208 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
Copyright (c) 2016 Morgan Bazalgette
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1 @@
https://godoc.org/git.zxq.co/ripple/semantic-icons-ugc

View File

@@ -0,0 +1,5 @@
// Package semanticiconsugc provides semantic UI icons that are deemed to be safe to be accepted
// from user generated content.
package semanticiconsugc
//go:generate go run generate.go

View File

@@ -0,0 +1,109 @@
// +build ignore
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
"github.com/aymerick/douceur/parser"
"os"
)
const fileHeader = `// THIS FILE WAS AUTOMATICALLY GENERATED BY A TOOL
// Use ` + "`go generate`" + ` to generate this.
package semanticiconsugc
// SaneIcons are the icons that are deemed to be safe to be accepted from user
// generated content.
var SaneIcons = []string{
`
func main() {
resp, err := http.Get("https://raw.githubusercontent.com/Semantic-Org/Semantic-UI/master/dist/components/icon.css")
if err != nil {
panic(err)
}
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
s := strings.Replace(string(b), "-webkit-", "", -1)
data, err := parser.Parse(s)
if err != nil {
panic(err)
}
f, err := os.Create("sane.go")
defer f.Close()
if err != nil {
panic(err)
}
f.WriteString(fileHeader)
blacklist := [...]string{
"icons",
"icon:first-child",
"\\35 00px", // seems like a semantic bug
"fitted",
"hover",
"active",
"emphasized",
"icons",
"link",
"circular",
"bordered",
"miny",
"tiny",
"small",
"large",
"big",
"huge",
"massive",
"corner",
}
written := make([]string, 0, 500)
// four nested for-ranges! jesus h. christ!
for _, r := range data.Rules {
if r == nil {
continue
}
for _, s := range r.Selectors {
s = strings.TrimPrefix(s, "i.")
s = strings.TrimSuffix(s, ":before")
s = strings.TrimSuffix(s, ".icon")
if s == "" {
continue
}
classes := strings.Split(s, ".")
for _, p := range classes {
var b bool
for _, bi := range blacklist {
if bi == p {
b = true
break
}
}
if b {
break
}
for _, w := range written {
if w == p {
b = true
break
}
}
if b {
continue
}
written = append(written, p)
fmt.Fprintf(f, "\t%q,\n", p)
}
}
}
f.WriteString("}\n")
}

View File

@@ -0,0 +1,703 @@
// THIS FILE WAS AUTOMATICALLY GENERATED BY A TOOL
// Use `go generate` to generate this.
package semanticiconsugc
// SaneIcons are the icons that are deemed to be safe to be accepted from user
// generated content.
var SaneIcons = []string{
"icon",
"loading",
"disabled",
"flipped",
"horizontally",
"vertically",
"rotated",
"right",
"clockwise",
"left",
"counterclockwise",
"inverted",
"red",
"orange",
"yellow",
"olive",
"green",
"teal",
"blue",
"violet",
"purple",
"pink",
"brown",
"grey",
"black",
"mini",
"icons ",
"search",
"mail",
"outline",
"signal",
"setting",
"home",
"inbox",
"browser",
"tag",
"tags",
"image",
"calendar",
"comment",
"shop",
"comments",
"external",
"privacy",
"settings",
"trophy",
"payment",
"feed",
"alarm",
"tasks",
"cloud",
"lab",
"dashboard",
"sitemap",
"idea",
"terminal",
"code",
"protect",
"ticket",
"square",
"bug",
"history",
"options",
"text",
"telephone",
"find",
"wifi",
"mute",
"copyright",
"at",
"eyedropper",
"paint",
"brush",
"heartbeat",
"mouse",
"pointer",
"hourglass",
"empty",
"start",
"half",
"end",
"full",
"hand",
"trademark",
"registered",
"creative",
"commons",
"add",
"to",
"remove",
"from",
"delete",
"checked",
"industry",
"shopping",
"bag",
"basket",
"hashtag",
"percent",
"wait",
"download",
"repeat",
"refresh",
"lock",
"bookmark",
"print",
"write",
"adjust",
"theme",
"edit",
"share",
"ban",
"forward",
"expand",
"compress",
"unhide",
"hide",
"random",
"retweet",
"sign",
"out",
"pin",
"in",
"upload",
"call",
"unlock",
"configure",
"filter",
"wizard",
"undo",
"exchange",
"reply",
"all",
"erase",
"alternate",
"archive",
"translate",
"recycle",
"send",
"cart",
"user",
"object",
"group",
"ungroup",
"clone",
"talk",
"help",
"circle",
"info",
"warning",
"announcement",
"birthday",
"users",
"doctor",
"handicap",
"student",
"child",
"spy",
"female",
"male",
"woman",
"man",
"non",
"binary",
"transgender",
"intergender",
"lesbian",
"gay",
"heterosexual",
"other",
"gender",
"vertical",
"horizontal",
"neuter",
"genderless",
"universal",
"access",
"wheelchair",
"blind",
"audio",
"description",
"volume",
"control",
"phone",
"braille",
"asl",
"assistive",
"listening",
"systems",
"deafness",
"language",
"low",
"vision",
"block",
"layout",
"grid",
"list",
"zoom",
"resize",
"maximize",
"crop",
"cocktail",
"road",
"flag",
"book",
"gift",
"leaf",
"fire",
"plane",
"magnet",
"lemon",
"world",
"travel",
"shipping",
"money",
"legal",
"lightning",
"umbrella",
"treatment",
"suitcase",
"bar",
"checkered",
"puzzle",
"extinguisher",
"rocket",
"anchor",
"bullseye",
"sun",
"moon",
"fax",
"life",
"ring",
"bomb",
"soccer",
"calculator",
"diamond",
"sticky",
"note",
"law",
"peace",
"rock",
"paper",
"scissors",
"lizard",
"spock",
"tv",
"crosshairs",
"asterisk",
"certificate",
"quote",
"spinner",
"ellipsis",
"cube",
"cubes",
"notched",
"thin",
"checkmark",
"box",
"move",
"minus",
"check",
"plus",
"radio",
"selected",
"toggle",
"off",
"on",
"film",
"sound",
"photo",
"chart",
"camera",
"retro",
"newspaper",
"area",
"pie",
"line",
"arrow",
"down",
"up",
"chevron",
"pointing",
"caret",
"angle",
"double",
"long",
"tablet",
"mobile",
"battery",
"high",
"medium",
"power",
"trash",
"disk",
"desktop",
"laptop",
"game",
"keyboard",
"plug",
"file",
"folder",
"open",
"level",
"pdf",
"word",
"excel",
"powerpoint",
"video",
"qrcode",
"barcode",
"rss",
"fork",
"html5",
"css3",
"openid",
"database",
"server",
"usb",
"bluetooth",
"alternative",
"heart",
"star",
"thumbs",
"smile",
"frown",
"meh",
"music",
"play",
"record",
"step",
"backward",
"fast",
"pause",
"stop",
"eject",
"unmute",
"closed",
"captioning",
"marker",
"coffee",
"food",
"building",
"hospital",
"emergency",
"first",
"aid",
"military",
"h",
"location",
"compass",
"space",
"shuttle",
"university",
"paw",
"spoon",
"car",
"taxi",
"tree",
"bicycle",
"bus",
"ship",
"motorcycle",
"street",
"view",
"hotel",
"train",
"subway",
"map",
"signs",
"table",
"columns",
"sort",
"descending",
"ascending",
"alphabet",
"content",
"numeric",
"font",
"bold",
"italic",
"height",
"width",
"align",
"center",
"justify",
"outdent",
"indent",
"linkify",
"cut",
"copy",
"attach",
"save",
"unordered",
"ordered",
"strikethrough",
"underline",
"paste",
"unlinkify",
"superscript",
"subscript",
"header",
"paragraph",
"cursor",
"euro",
"pound",
"dollar",
"rupee",
"yen",
"ruble",
"won",
"bitcoin",
"lira",
"shekel",
"paypal",
"google",
"wallet",
"visa",
"mastercard",
"discover",
"american",
"express",
"card",
"stripe",
"japan",
"credit",
"bureau",
"diners",
"club",
"twitter",
"facebook",
"linkedin",
"github",
"f",
"pinterest",
"maxcdn",
"youtube",
"xing",
"dropbox",
"stack",
"overflow",
"instagram",
"flickr",
"adn",
"bitbucket",
"tumblr",
"apple",
"windows",
"android",
"linux",
"dribble",
"skype",
"foursquare",
"trello",
"gittip",
"vk",
"weibo",
"renren",
"pagelines",
"vimeo",
"slack",
"wordpress",
"yahoo",
"reddit",
"stumbleupon",
"delicious",
"digg",
"pied",
"piper",
"drupal",
"joomla",
"behance",
"steam",
"spotify",
"deviantart",
"soundcloud",
"vine",
"codepen",
"jsfiddle",
"rebel",
"empire",
"git",
"hacker",
"news",
"tencent",
"qq",
"wechat",
"slideshare",
"twitch",
"yelp",
"lastfm",
"ioxhost",
"angellist",
"meanpath",
"buysellads",
"connectdevelop",
"dashcube",
"forumbee",
"leanpub",
"sellsy",
"shirtsinbulk",
"simplybuilt",
"skyatlas",
"whatsapp",
"viacoin",
"y",
"combinator",
"optinmonster",
"opencart",
"expeditedssl",
"gg",
"tripadvisor",
"odnoklassniki",
"pocket",
"wikipedia",
"safari",
"chrome",
"firefox",
"opera",
"internet",
"explorer",
"contao",
"amazon",
"houzz",
"tie",
"fonticons",
"alien",
"microsoft",
"edge",
"codiepie",
"modx",
"fort",
"awesome",
"product",
"hunt",
"mixcloud",
"scribd",
"gitlab",
"wpbeginner",
"wpforms",
"envira",
"gallery",
"glide",
"g",
"viadeo",
"snapchat",
"ghost",
"hat",
"order",
"yoast",
"themeisle",
"like",
"favorite",
"close",
"cancel",
"x",
"magnify",
"shutdown",
"clock",
"time",
"headphone",
"picture",
"pencil",
"compose",
"point",
"tint",
"signup",
"question",
"dont",
"minimize",
"exclamation",
"attention",
"eye",
"triangle",
"shuffle",
"chat",
"graph",
"key",
"cogs",
"discussions",
"dislike",
"log",
"thumb",
"tack",
"winner",
"hdd",
"bullhorn",
"bell",
"globe",
"wrench",
"briefcase",
"chain",
"flask",
"sidebar",
"bars",
"ul",
"ol",
"numbered",
"magic",
"truck",
"currency",
"dropdown",
"envelope",
"conversation",
"rain",
"clipboard",
"lightbulb",
"ambulance",
"medkit",
"fighter",
"jet",
"beer",
"computer",
"gamepad",
"broken",
"eraser",
"microphone",
"slash",
"shield",
"target",
"eur",
"gbp",
"usd",
"inr",
"cny",
"rmb",
"jpy",
"rouble",
"rub",
"krw",
"btc",
"gratipay",
"zip",
"dot",
"try",
"graduation",
"sliders",
"weixin",
"tty",
"teletype",
"binoculars",
"cord",
"wi-fi",
"amex",
"cc",
"sheqel",
"ils",
"detective",
"venus",
"mars",
"mercury",
"intersex",
"homosexual",
"stroke",
"asexual",
"official",
"times",
"bed",
"yc",
"ycombinator",
"four",
"three",
"quarters",
"two",
"one",
"quarter",
"zero",
"i",
"jcb",
"balance",
"grab",
"victory",
"tm",
"r",
"television",
"five",
"hundred",
"pixels",
"factory",
"commenting",
"ms",
"beginner",
"forms",
"devices",
"als",
"ald",
"interpreting",
"deaf",
"hard",
"of",
"hearing",
"signing",
"new",
"isle",
"fa",
}