From 99667caac84d295512b3e89338139b120ea8fca8 Mon Sep 17 00:00:00 2001 From: maddiebaka Date: Tue, 15 Aug 2023 14:35:52 -0400 Subject: [PATCH] Add rudimentary theming, checks for .directory-listing-ok file --- Gemfile.lock | 2 - lib/skeksis.rb | 31 +++++- lib/skeksis/htmlize.rb | 5 +- style/nord.css | 231 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 263 insertions(+), 6 deletions(-) create mode 100644 style/nord.css diff --git a/Gemfile.lock b/Gemfile.lock index c2071e9..4aad841 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,7 +67,6 @@ GEM rubocop-performance (~> 1.18.0) unicode-display_width (2.4.2) webrick (1.8.1) - yaml (0.2.1) PLATFORMS arm64-darwin-22 @@ -78,7 +77,6 @@ DEPENDENCIES rspec (~> 3.0) skeksis! standard (~> 1.3) - yaml BUNDLED WITH 2.4.15 diff --git a/lib/skeksis.rb b/lib/skeksis.rb index b1fb2e1..b8b46e0 100644 --- a/lib/skeksis.rb +++ b/lib/skeksis.rb @@ -9,9 +9,21 @@ require_relative "skeksis/htmlize" module Skeksis #class Error < StandardError; end Header = <<~HTML - + + Gembridge +

Directory Listing

@@ -56,13 +68,28 @@ module Skeksis private + def load_style + "" + end + + def create_dir_listing(path, env) http = URI.parse(env['REQUEST_URI']) + + unless Dir.each_child(path).include?('.directory-listing-ok') + return nil + end listing = Dir.each_child(path).map do |i| + if i == ".directory-listing-ok" + next + end + path = Pathname.new(env['PATH_INFO']).join(i) uri = URI::HTTP.build(host: http.host, port: http.port, path: path.to_s) - "#{i}
" + "#{i}
" end.join("\n") [Header + listing + Footer] end diff --git a/lib/skeksis/htmlize.rb b/lib/skeksis/htmlize.rb index af69810..9e8d788 100644 --- a/lib/skeksis/htmlize.rb +++ b/lib/skeksis/htmlize.rb @@ -1,7 +1,8 @@ module Skeksis class IR Header = <<~HTML - + + Gembridge @@ -34,7 +35,7 @@ module Skeksis case entry[:type] when :blank - "
" + "
" when :header level = entry[:level] "#{text}" diff --git a/style/nord.css b/style/nord.css new file mode 100644 index 0000000..e492c4f --- /dev/null +++ b/style/nord.css @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2016-present Sven Greb + * This source code is licensed under the MIT license found in the license file. + */ + +/* + * References: + * 1. https://www.w3.org/TR/css-variables + * 2. https://www.w3.org/TR/selectors/#root-pseudo + * 3. https://drafts.csswg.org/css-variables + * 4. https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables + * 5. https://warpspire.com/kss + * 6. https://github.com/kss-node/kss-node + */ + +/* +An arctic, north-bluish color palette. +Created for the clean- and minimal flat design pattern to achieve a optimal focus and readability for code syntax +highlighting and UI. +It consists of a total of sixteen, carefully selected, dimmed pastel colors for a eye-comfortable, but yet colorful +ambiance. + +Styleguide Nord +*/ + +:root { + /* + Base component color of "Polar Night". + + Used for texts, backgrounds, carets and structuring characters like curly- and square brackets. + + Markup: +
+ + Styleguide Nord - Polar Night + */ + --nord0: #2e3440; + + /* + Lighter shade color of the base component color. + + Used as a lighter background color for UI elements like status bars. + + Markup: +
+ + Styleguide Nord - Polar Night + */ + --nord1: #3b4252; + + /* + Lighter shade color of the base component color. + + Used as line highlighting in the editor. + In the UI scope it may be used as selection- and highlight color. + + Markup: +
+ + Styleguide Nord - Polar Night + */ + --nord2: #434c5e; + + /* + Lighter shade color of the base component color. + + Used for comments, invisibles, indent- and wrap guide marker. + In the UI scope used as pseudoclass color for disabled elements. + + Markup: +
+ + Styleguide Nord - Polar Night + */ + --nord3: #4c566a; + + /* + Base component color of "Snow Storm". + + Main color for text, variables, constants and attributes. + In the UI scope used as semi-light background depending on the theme shading design. + + Markup: +
+ + Styleguide Nord - Snow Storm + */ + --nord4: #d8dee9; + + /* + Lighter shade color of the base component color. + + Used as a lighter background color for UI elements like status bars. + Used as semi-light background depending on the theme shading design. + + Markup: +
+ + Styleguide Nord - Snow Storm + */ + --nord5: #e5e9f0; + + /* + Lighter shade color of the base component color. + + Used for punctuations, carets and structuring characters like curly- and square brackets. + In the UI scope used as background, selection- and highlight color depending on the theme shading design. + + Markup: +
+ + Styleguide Nord - Snow Storm + */ + --nord6: #eceff4; + + /* + Bluish core color. + + Used for classes, types and documentation tags. + + Markup: +
+ + Styleguide Nord - Frost + */ + --nord7: #8fbcbb; + + /* + Bluish core accent color. + + Represents the accent color of the color palette. + Main color for primary UI elements and methods/functions. + + Can be used for + - Markup quotes + - Markup link URLs + + Markup: +
+ + Styleguide Nord - Frost + */ + --nord8: #88c0d0; + + /* + Bluish core color. + + Used for language-specific syntactic/reserved support characters and keywords, operators, tags, units and + punctuations like (semi)colons,commas and braces. + + Markup: +
+ + Styleguide Nord - Frost + */ + --nord9: #81a1c1; + + /* + Bluish core color. + + Used for markup doctypes, import/include/require statements, pre-processor statements and at-rules (`@`). + + Markup: +
+ + Styleguide Nord - Frost + */ + --nord10: #5e81ac; + + /* + Colorful component color. + + Used for errors, git/diff deletion and linter marker. + + Markup: +
+ + Styleguide Nord - Aurora + */ + --nord11: #bf616a; + + /* + Colorful component color. + + Used for annotations. + + Markup: +
+ + Styleguide Nord - Aurora + */ + --nord12: #d08770; + + /* + Colorful component color. + + Used for escape characters, regular expressions and markup entities. + In the UI scope used for warnings and git/diff renamings. + + Markup: +
+ + Styleguide Nord - Aurora + */ + --nord13: #ebcb8b; + + /* + Colorful component color. + + Main color for strings and attribute values. + In the UI scope used for git/diff additions and success visualizations. + + Markup: +
+ + Styleguide Nord - Aurora + */ + --nord14: #a3be8c; + + /* + Colorful component color. + + Used for numbers. + + Markup: +
+ + Styleguide Nord - Aurora + */ + --nord15: #b48ead; +}