From e7ee46722c055edb1f9d693ed7b3f9340a79ebaf Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 31 Jul 2018 19:15:52 +0200 Subject: [PATCH] Web stuff --- requirements.txt | 1 + static/nryg.less | 788 ++++++++++++++++---------------- static/pygments.css | 70 +++ templates/base.html | 1 + templates/components/event.html | 2 +- webserver.py | 2 +- 6 files changed, 475 insertions(+), 389 deletions(-) create mode 100644 static/pygments.css diff --git a/requirements.txt b/requirements.txt index ae9497aa..dbb21185 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ async_timeout raven bcrypt markdown2 +pygments \ No newline at end of file diff --git a/static/nryg.less b/static/nryg.less index 873b6c67..578db248 100644 --- a/static/nryg.less +++ b/static/nryg.less @@ -180,15 +180,6 @@ nav { } } -//Dirtiest hack ever -.game-panels { - font-size: 0; - - .game-panel { - font-size: medium; - } -} - .game-panel { display: inline-block; margin: 4px; @@ -232,423 +223,432 @@ nav { } } -.osu { - font-family: 'Exo 2', 'Helvetica Neue', 'Arial', sans-serif; - font-style: italic; - border: 8px solid #ffffff; - color: #ffffff; - padding: 10px; - grid-row-gap: 5px; - grid-template-columns: 25% 25% 25% 25%; +//Dirtiest hack ever +.game-panels { + font-size: 0; - .background-image { - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; - background-image: url("https://osu.ppy.sh/images/layout/nav-backgrounds/triangles-combined.png"); - z-index: -2; + .game-panel { + font-size: medium; } - .background-color { - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; - background-color: rgba(187, 17, 119, 0.9); - z-index: -1; - } - - .player { - grid-row: 1; - grid-column-start: 1; - grid-column-end: 4; - - .player-image { - border-radius: 16px; - } - - .player-name { - color: #ffffff; - } - } - - .game-title { - font-style: normal; - } - - .standard { - grid-column: 1; - } - - .taiko { - grid-column: 2; - } - - .catch { - grid-column: 3; - } - - .mania { - grid-column: 4; - } - - .number { - font-size: large; - } - - .pp { - font-size: x-small; - } -} - -.rl { - background-image: linear-gradient(to bottom,rgba(35,91,139,.5),rgba(16,54,84,.5)), - linear-gradient(to right,rgba(35,91,139,.7),rgba(16,54,84,.7)); - grid-template-columns: 25% 25% 25% 25%; - padding: 18px; - grid-row-gap: 5px; - - .player { - grid-row: 1; - grid-column-start: 1; - grid-column-end: 4; - - .player-name { - color: #ffffff; - text-shadow: 2px 2px 8px #359ef2, -2px 2px 8px #359ef2, 2px -2px 8px #359ef2, -2px -2px 8px #359ef2; - } - } - - .game-title { - text-align: center; - color: #41abfa; - text-shadow: 2px 2px 8px #235b8b, -2px 2px 8px #235b8b, 2px -2px 8px #235b8b, -2px -2px 8px #235b8b; - } - - .game-score img { - height: 36px; - display: block; - margin: auto; - } - - .duel { - grid-column: 1; - } - - .doubles { - grid-column: 2; - } - - .standard { - grid-column: 3; - } - - .solostd { - grid-column: 4; - } - -} - -.dota { - padding: 15px; - border: 3px solid #000000; - grid-row-gap: 5px; - grid-template-columns: 25% 75%; - font-family: "Radiance", sans-serif; - background-image: linear-gradient(to bottom, #440b0b, #631013); - color: #ffffff; - - .player { - grid-row: 1; - grid-column-start: 1; - grid-column-end: 3; - - .player-name { - color: #ffffff; - } - } - - .game-score.wins { - font-size: x-large; - } - - .wins { - grid-column: 1; - text-align: center; - } - - .rank { - grid-column: 2; - grid-row-start: 2; - grid-row-end: 4; - margin-top: auto; - margin-bottom: auto; - - img { - vertical-align: middle; - } - - img.stars { - position: relative; - height: 60px; - left: -60px; - margin-right: -60px; - z-index: 1; - } - - img.medal { - height: 60px; - } - } -} - -.lol { - font-family: "BeaufortLoL", "Times New Roman", serif; - padding: 15px; - color: #c9aa71; - border: 3px solid #463714; - background-color: #010a13; - grid-row-gap: 5px; - grid-template-columns: 40% 20% 20% 20%; - - .player { - grid-row: 1; - grid-column-start: 1; - grid-column-end: 4; - - .player-image { - border-radius: 16px; - } - } - - .level { - grid-column: 1; - } - - .game-score.level { - font-size: x-large; - } - - .soloq { - grid-column: 2; - } - - .flexq { - grid-column: 3; - } - - .twtrq { - grid-column: 4; - } - - .game-title { - text-align: center; - } - - .game-score { - text-align: center; - margin: auto; - } - - .rank { - height: 40px; - } -} - -.steam { - font-family: "Motiva Sans", sans-serif; - padding: 18px; - background: url("https://steamstore-a.akamaihd.net/public/images/v6/colored_body_top2.png?v=2") center; - - .player .player-name { - grid-row: 1; - grid-column: 1; + .osu { + font-family: 'Exo 2', 'Helvetica Neue', 'Arial', sans-serif; + font-style: italic; + border: 8px solid #ffffff; color: #ffffff; - } + padding: 10px; + grid-row-gap: 5px; + grid-template-columns: 25% 25% 25% 25%; - .buttons { - grid-row: 2; - grid-column-start: 1; - grid-column-end: 3; - } + .background-image { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + background-image: url("https://osu.ppy.sh/images/layout/nav-backgrounds/triangles-combined.png"); + z-index: -2; + } - .game-banner { - grid-row: 1; - grid-column: 2; - text-align: right; + .background-color { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + background-color: rgba(187, 17, 119, 0.9); + z-index: -1; + } - img { - height: 58px; - border-radius: 4px; + .player { + grid-row: 1; + grid-column-start: 1; + grid-column-end: 4; + + .player-image { + border-radius: 16px; + } + + .player-name { + color: #ffffff; + } + } + + .game-title { + font-style: normal; + } + + .standard { + grid-column: 1; + } + + .taiko { + grid-column: 2; + } + + .catch { + grid-column: 3; + } + + .mania { + grid-column: 4; + } + + .number { + font-size: large; + } + + .pp { + font-size: x-small; } } - a { - text-decoration: none; - display: inline-block; + .rl { + background-image: linear-gradient(to bottom, rgba(35, 91, 139, .5), rgba(16, 54, 84, .5)), + linear-gradient(to right, rgba(35, 91, 139, .7), rgba(16, 54, 84, .7)); + grid-template-columns: 25% 25% 25% 25%; + padding: 18px; + grid-row-gap: 5px; + + .player { + grid-row: 1; + grid-column-start: 1; + grid-column-end: 4; + + .player-name { + color: #ffffff; + text-shadow: 2px 2px 8px #359ef2, -2px 2px 8px #359ef2, 2px -2px 8px #359ef2, -2px -2px 8px #359ef2; + } + } + + .game-title { + text-align: center; + color: #41abfa; + text-shadow: 2px 2px 8px #235b8b, -2px 2px 8px #235b8b, 2px -2px 8px #235b8b, -2px -2px 8px #235b8b; + } + + .game-score img { + height: 36px; + display: block; + margin: auto; + } + + .duel { + grid-column: 1; + } + + .doubles { + grid-column: 2; + } + + .standard { + grid-column: 3; + } + + .solostd { + grid-column: 4; + } + } - .button { - background-color: rgba(0,0,0,0.4); - color: #9e9d9b; - width: 32px; - height: 32px; - border-radius: 4px; - text-align: center; - display: flex; - justify-content: center; - align-items: center; - } - - .button:hover, .button:active { - background-color: rgba(102,192,244,0.4); + .dota { + padding: 15px; + border: 3px solid #000000; + grid-row-gap: 5px; + grid-template-columns: 25% 75%; + font-family: "Radiance", sans-serif; + background-image: linear-gradient(to bottom, #440b0b, #631013); color: #ffffff; - } -} -.ow { - padding: 16px; - font-family: "FuturaNo2D", sans-serif; - background-color: #371b00; - border: 2px solid #ff9c00; - grid-row-gap: 5px; - grid-template-columns: 25% 75%; - color: #ffffff; - text-transform: uppercase; + .player { + grid-row: 1; + grid-column-start: 1; + grid-column-end: 3; - .player { - grid-row: 1; - grid-column-start: 1; - grid-column-end: 3; - - .player-image { - border-radius: 2px; - vertical-align: middle; + .player-name { + color: #ffffff; + } } - .player-name { + .game-score.wins { + font-size: x-large; + } + + .wins { + grid-column: 1; + text-align: center; + } + + .rank { + grid-column: 2; + grid-row-start: 2; + grid-row-end: 4; + margin-top: auto; + margin-bottom: auto; + + img { + vertical-align: middle; + } + + img.stars { + position: relative; + height: 60px; + left: -60px; + margin-right: -60px; + z-index: 1; + } + + img.medal { + height: 60px; + } + } + } + + .lol { + font-family: "BeaufortLoL", "Times New Roman", serif; + padding: 15px; + color: #c9aa71; + border: 3px solid #463714; + background-color: #010a13; + grid-row-gap: 5px; + grid-template-columns: 40% 20% 20% 20%; + + .player { + grid-row: 1; + grid-column-start: 1; + grid-column-end: 4; + + .player-image { + border-radius: 16px; + } + } + + .level { + grid-column: 1; + } + + .game-score.level { + font-size: x-large; + } + + .soloq { + grid-column: 2; + } + + .flexq { + grid-column: 3; + } + + .twtrq { + grid-column: 4; + } + + .game-title { + text-align: center; + } + + .game-score { + text-align: center; + margin: auto; + } + + .rank { + height: 40px; + } + } + + .steam { + font-family: "Motiva Sans", sans-serif; + padding: 18px; + background: url("https://steamstore-a.akamaihd.net/public/images/v6/colored_body_top2.png?v=2") center; + + .player .player-name { + grid-row: 1; + grid-column: 1; color: #ffffff; } - } - .game-title { - color: #ff9c00; - } + .buttons { + grid-row: 2; + grid-column-start: 1; + grid-column-end: 3; + } - .game-score.level { - font-size: x-large; - } + .game-banner { + grid-row: 1; + grid-column: 2; + text-align: right; - .level { - grid-column: 1; - text-align: center; - } + img { + height: 58px; + border-radius: 4px; + } + } - .rank { - grid-column: 2; - grid-row-start: 2; - grid-row-end: 4; - margin-top: auto; - margin-bottom: auto; - - .icon { - background-color: rgba(0, 0, 0, 0.1); - border-radius: 8px; - height: 60px; - width: 60px; + a { + text-decoration: none; display: inline-block; - vertical-align: middle; - margin-right: 8px; } - .ranked.text { + .button { + background-color: rgba(0, 0, 0, 0.4); + color: #9e9d9b; + width: 32px; + height: 32px; + border-radius: 4px; + text-align: center; + display: flex; + justify-content: center; + align-items: center; + } + + .button:hover, .button:active { + background-color: rgba(102, 192, 244, 0.4); + color: #ffffff; + } + } + + .ow { + padding: 16px; + font-family: "FuturaNo2D", sans-serif; + background-color: #371b00; + border: 2px solid #ff9c00; + grid-row-gap: 5px; + grid-template-columns: 25% 75%; + color: #ffffff; + text-transform: uppercase; + + .player { + grid-row: 1; + grid-column-start: 1; + grid-column-end: 3; + + .player-image { + border-radius: 2px; + vertical-align: middle; + } + + .player-name { + color: #ffffff; + } + } + + .game-title { + color: #ff9c00; + } + + .game-score.level { + font-size: x-large; + } + + .level { + grid-column: 1; + text-align: center; + } + + .rank { + grid-column: 2; + grid-row-start: 2; + grid-row-end: 4; + margin-top: auto; + margin-bottom: auto; + + .icon { + background-color: rgba(0, 0, 0, 0.1); + border-radius: 8px; + height: 60px; + width: 60px; + display: inline-block; + vertical-align: middle; + margin-right: 8px; + } + + .ranked.text { + font-size: x-large; + } + } + } + + .ryg { + background-color: rgba(red(@accent-color), green(@accent-color), blue(@accent-color), 0.1); + padding: 18px; + grid-template-columns: 80% 20%; + + .player { + grid-row: 1; + grid-column-start: 1; + grid-column-end: 3; + font-weight: bold; + } + + .member-status { + grid-column: 1; + grid-row-start: 2; + grid-row-end: 4; + font-size: x-large; + margin-top: auto; + margin-bottom: auto; + } + + .fiorygi { + grid-column: 2; + } + + .fiorygi.game-score { font-size: x-large; } } -} -.ryg { - background-color: rgba(red(@accent-color), green(@accent-color), blue(@accent-color), 0.1); - padding: 18px; - grid-template-columns: 80% 20%; - - .player { - grid-row: 1; - grid-column-start: 1; - grid-column-end: 3; - font-weight: bold; - } - - .member-status { - grid-column: 1; - grid-row-start: 2; - grid-row-end: 4; - font-size: x-large; - margin-top: auto; - margin-bottom: auto; - } - - .fiorygi { - grid-column: 2; - } - - .fiorygi.game-score { - font-size: x-large; - } -} - -.telegram { - font-family: "Lucida Sans Unicode", sans-serif; - background-color: #32afed; - border: 6px solid white; - padding: 12px; - color: black; - - a, a:hover, a:active, a:visited { + .telegram { + font-family: "Lucida Sans Unicode", sans-serif; + background-color: #32afed; + border: 6px solid white; + padding: 12px; color: black; + + a, a:hover, a:active, a:visited { + color: black; + } + + .player { + font-weight: bold; + } + + .useless-stuff { + grid-column: 1; + } } - .player { - font-weight: bold; - } - - .useless-stuff { - grid-column: 1; - } -} - -.discord { - background-color: #7289da; - padding: 18px; - color: white; - font-family: "Whitney", sans-serif; - grid-template-columns: 50% 50%; - - a, a:hover, a:active, a:visited { + .discord { + background-color: #7289da; + padding: 18px; color: white; - } + font-family: "Whitney", sans-serif; + grid-template-columns: 50% 50%; - .player-image { - border-radius: 16px; - } + a, a:hover, a:active, a:visited { + color: white; + } - .game-score { - overflow: hidden; - } + .player-image { + border-radius: 16px; + } - .last-video { - grid-column: 1 - } + .game-score { + overflow: hidden; + } - .fav-video { - grid-column: 2; - } + .last-video { + grid-column: 1 + } - .none { - color: rgba(255, 255, 255, 0.3); + .fav-video { + grid-column: 2; + } + + .none { + color: rgba(255, 255, 255, 0.3); + } } } @@ -670,6 +670,20 @@ nav { padding: 0; } } + + //Text generated by the Markdown extension + .codehilite { + border-radius: 4px; + padding: 4px; + + pre { + margin: 0; + } + + code { + font-family: "Consolas", "Source Code Pro", monospace; + } + } } .entry { diff --git a/static/pygments.css b/static/pygments.css new file mode 100644 index 00000000..9b74abbd --- /dev/null +++ b/static/pygments.css @@ -0,0 +1,70 @@ +.codehilite .hll { background-color: #ffffcc } +.codehilite { background: #002f52; color: #ffffff; background-color: #002f52 } +.codehilite .c { color: #0088ff; font-style: italic; background-color: #002f52 } /* Comment */ +.codehilite .err { color: #ffffff; background-color: #002f52 } /* Error */ +.codehilite .g { color: #ffffff; background-color: #002f52 } /* Generic */ +.codehilite .k { color: #F6AA11; background-color: #002f52 } /* Keyword */ +.codehilite .l { color: #ffffff; background-color: #002f52 } /* Literal */ +.codehilite .n { color: #ffffff; background-color: #002f52 } /* Name */ +.codehilite .o { color: #ffffff; background-color: #002f52 } /* Operator */ +.codehilite .x { color: #ffffff; background-color: #002f52 } /* Other */ +.codehilite .p { color: #ffffff; background-color: #002f52 } /* Punctuation */ +.codehilite .cm { color: #0088ff; font-style: italic; background-color: #002f52 } /* Comment.Multiline */ +.codehilite .cp { color: #F6AA11; background-color: #002f52 } /* Comment.Preproc */ +.codehilite .c1 { color: #0088ff; font-style: italic; background-color: #002f52 } /* Comment.Single */ +.codehilite .cs { color: #0088ff; font-style: italic; background-color: #002f52 } /* Comment.Special */ +.codehilite .gd { color: #ffffff; background-color: #002f52 } /* Generic.Deleted */ +.codehilite .ge { color: #ffffff; text-decoration: underline; background-color: #002f52 } /* Generic.Emph */ +.codehilite .gr { color: #ffffff; background-color: #002f52 } /* Generic.Error */ +.codehilite .gh { color: #ffffff; font-weight: bold; background-color: #002f52 } /* Generic.Heading */ +.codehilite .gi { color: #ffffff; background-color: #002f52 } /* Generic.Inserted */ +.codehilite .go { color: #242b50; background-color: #002f52 } /* Generic.Output */ +.codehilite .gp { color: #ffffff; background-color: #002f52 } /* Generic.Prompt */ +.codehilite .gs { color: #ffffff; background-color: #002f52 } /* Generic.Strong */ +.codehilite .gu { color: #ffffff; font-weight: bold; background-color: #002f52 } /* Generic.Subheading */ +.codehilite .gt { color: #f8f8f8; background-color: #800f00 } /* Generic.Traceback */ +.codehilite .kc { color: #F6AA11; background-color: #002f52 } /* Keyword.Constant */ +.codehilite .kd { color: #F6AA11; background-color: #002f52 } /* Keyword.Declaration */ +.codehilite .kn { color: #F6AA11; background-color: #002f52 } /* Keyword.Namespace */ +.codehilite .kp { color: #F6AA11; background-color: #002f52 } /* Keyword.Pseudo */ +.codehilite .kr { color: #F6AA11; background-color: #002f52 } /* Keyword.Reserved */ +.codehilite .kt { color: #ffdd00; background-color: #002f52 } /* Keyword.Type */ +.codehilite .ld { color: #ffffff; background-color: #002f52 } /* Literal.Date */ +.codehilite .m { color: #ff628c; font-style: italic; background-color: #002f52 } /* Literal.Number */ +.codehilite .s { color: #3ad900; background-color: #002f52 } /* Literal.String */ +.codehilite .na { color: #ffdd00; background-color: #002f52 } /* Name.Attribute */ +.codehilite .nb { color: #ffffff; background-color: #002f52 } /* Name.Builtin */ +.codehilite .nc { color: #ffffff; background-color: #002f52 } /* Name.Class */ +.codehilite .no { color: #ff628c; font-style: italic; background-color: #002f52 } /* Name.Constant */ +.codehilite .nd { color: #ffffff; background-color: #002f52 } /* Name.Decorator */ +.codehilite .ni { color: #ffffff; background-color: #002f52 } /* Name.Entity */ +.codehilite .ne { color: #ffffff; background-color: #002f52 } /* Name.Exception */ +.codehilite .nf { color: #ffdd00; background-color: #002f52 } /* Name.Function */ +.codehilite .nl { color: #3ad900; background-color: #002f52 } /* Name.Label */ +.codehilite .nn { color: #ffffff; background-color: #002f52 } /* Name.Namespace */ +.codehilite .nx { color: #ffffff; background-color: #002f52 } /* Name.Other */ +.codehilite .py { color: #ffffff; background-color: #002f52 } /* Name.Property */ +.codehilite .nt { color: #F6AA11; background-color: #002f52 } /* Name.Tag */ +.codehilite .nv { color: #F6F080; background-color: #002f52 } /* Name.Variable */ +.codehilite .ow { color: #F6AA11; background-color: #002f52 } /* Operator.Word */ +.codehilite .w { color: #ffffff; background-color: #002f52 } /* Text.Whitespace */ +.codehilite .mf { color: #ff628c; font-style: italic; background-color: #002f52 } /* Literal.Number.Float */ +.codehilite .mh { color: #ff628c; font-style: italic; background-color: #002f52 } /* Literal.Number.Hex */ +.codehilite .mi { color: #ff628c; font-style: italic; background-color: #002f52 } /* Literal.Number.Integer */ +.codehilite .mo { color: #ff628c; font-style: italic; background-color: #002f52 } /* Literal.Number.Oct */ +.codehilite .sb { color: #3ad900; background-color: #002f52 } /* Literal.String.Backtick */ +.codehilite .sc { color: #3ad900; background-color: #002f52 } /* Literal.String.Char */ +.codehilite .sd { color: #3ad900; background-color: #002f52 } /* Literal.String.Doc */ +.codehilite .s2 { color: #3ad900; background-color: #002f52 } /* Literal.String.Double */ +.codehilite .se { color: #3ad900; background-color: #002f52 } /* Literal.String.Escape */ +.codehilite .sh { color: #3ad900; background-color: #002f52 } /* Literal.String.Heredoc */ +.codehilite .si { color: #3ad900; background-color: #002f52 } /* Literal.String.Interpol */ +.codehilite .sx { color: #3ad900; background-color: #002f52 } /* Literal.String.Other */ +.codehilite .sr { color: #3ad900; background-color: #002f52 } /* Literal.String.Regex */ +.codehilite .s1 { color: #3ad900; background-color: #002f52 } /* Literal.String.Single */ +.codehilite .ss { color: #3ad900; background-color: #002f52 } /* Literal.String.Symbol */ +.codehilite .bp { color: #ffffff; background-color: #002f52 } /* Name.Builtin.Pseudo */ +.codehilite .vc { color: #F6F080; background-color: #002f52 } /* Name.Variable.Class */ +.codehilite .vg { color: #F6F080; background-color: #002f52 } /* Name.Variable.Global */ +.codehilite .vi { color: #F6F080; background-color: #002f52 } /* Name.Variable.Instance */ +.codehilite .il { color: #ff628c; font-style: italic; background-color: #002f52 } /* Literal.Number.Integer.Long */ diff --git a/templates/base.html b/templates/base.html index 2e1f6d99..1769f4fb 100644 --- a/templates/base.html +++ b/templates/base.html @@ -6,6 +6,7 @@ {% block prehead %}{% endblock %} {% block pagetitle %}{% endblock %} - Royal Games + {% block posthead %}{% endblock %} diff --git a/templates/components/event.html b/templates/components/event.html index 1b81437a..ed31f3e4 100644 --- a/templates/components/event.html +++ b/templates/components/event.html @@ -15,6 +15,6 @@ di {{ event.author.username }}
- {{ (escape(event.description)).replace("\n", "
"|safe) }} + {{ (escape(event.description)).replace("\n", "
"|safe) }}
\ No newline at end of file diff --git a/webserver.py b/webserver.py index e44ed415..84fb91c4 100644 --- a/webserver.py +++ b/webserver.py @@ -221,7 +221,7 @@ def page_wiki(key: str): if wiki_page is None: return render_template("wiki.html", key=key, config=config) converted_md = Markup(markdown2.markdown(wiki_page.content.replace("<", "<"), - extras=["spoiler", "tables"])) + extras=["spoiler", "tables", "smarty-pants", "fenced-code-blocks"])) return render_template("wiki.html", key=key, wiki_page=wiki_page, converted_md=converted_md, wiki_log=wiki_latest_edit, config=config) elif request.method == "POST":