From c958375cacc002d97b7bc48015e1278b8c110470 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 20 Sep 2015 00:24:00 -0500 Subject: [PATCH] Start work on proper CSS support. --- release.py | 7 +++++++ src/main.css | 23 +++++++++++++++++++++++ tfdclerk.js | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 src/main.css diff --git a/release.py b/release.py index f4f0fe3..09b6b8a 100755 --- a/release.py +++ b/release.py @@ -98,6 +98,13 @@ def _do_include(text, include): if text[:text.index(tag)][-2:] == "\n\n" and source.startswith("\n"): source = source[1:] # Remove extra newline + if include.endswith(".css"): + lines = ['"' + line.ljust(75) + '" +' + for line in source.strip().splitlines()] + if lines and lines[-1]: + lines[-1] = lines[-1][:-2] # Strip off last + + source = "\n".join(lines) + return text.replace(tag, source) def _get_script(): diff --git a/src/main.css b/src/main.css new file mode 100644 index 0000000..e4ac5ea --- /dev/null +++ b/src/main.css @@ -0,0 +1,23 @@ +/* @TFDCLERK_HEADER_START@ + +Copyright (C) 2015 Ben Kurtovic + +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. + +@TFDCLERK_HEADER_END@ */ diff --git a/tfdclerk.js b/tfdclerk.js index c2be82f..387f7b9 100644 --- a/tfdclerk.js +++ b/tfdclerk.js @@ -52,6 +52,10 @@ if (is_tfd_page()) { /* Main script starts here */ +mw.util.addCSS( +@TFDCLERK_INCLUDE:main.css@ +); + @TFDCLERK_INCLUDE:main.js@ @TFDCLERK_INCLUDE:util.js@ @TFDCLERK_INCLUDE:tfd.js@