aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorFrankie B <git@diskfloppy.me>2023-07-28 23:45:33 +0100
committerFrankie B <frankieraybrown@gmail.com>2023-07-29 18:10:50 +0100
commitf82de3956b104d93461517216fc751fdf09f834f (patch)
treeae09024ce0c96ec92589993d78e43e5c9841fedc /resources
parent9a10c8db3ade25b1f9e920d0860063b95bd00dd6 (diff)
Add hlphp & codeblock component
Diffstat (limited to 'resources')
-rw-r--r--resources/views/components/codeblock.blade.php14
-rw-r--r--resources/views/includes/head-hljs.blade.php15
-rw-r--r--resources/views/layouts/default-hljs.blade.php23
3 files changed, 52 insertions, 0 deletions
diff --git a/resources/views/components/codeblock.blade.php b/resources/views/components/codeblock.blade.php
new file mode 100644
index 0000000..8dcebda
--- /dev/null
+++ b/resources/views/components/codeblock.blade.php
@@ -0,0 +1,14 @@
+@php
+$file_path = "code/".$file;
+$file_name = basename($file_path);
+
+$hl = new \Highlight\Highlighter();
+
+$highlighted = $hl->highlight($lang, Storage::disk('local')->get($file_path));
+$file_size = Storage::disk('local')->size($file_path);
+@endphp
+<div class="codeblock"><pre>
+ <h1>{{ $file_name }} <small>{{ $file_size}} bytes</small></h1>
+ <hr>
+ <code class="hljs {{$highlighted->language}}">{!! $highlighted->value !!}</code>
+</pre></div>
diff --git a/resources/views/includes/head-hljs.blade.php b/resources/views/includes/head-hljs.blade.php
new file mode 100644
index 0000000..5011b6e
--- /dev/null
+++ b/resources/views/includes/head-hljs.blade.php
@@ -0,0 +1,15 @@
+ <!-- Global -->
+ <meta charset="utf-8">
+ <meta property="og:type" content="website">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="theme-color" content="#333333">
+ <link rel="stylesheet" href="{{ URL::asset ('css/master.css') }}"/>
+ <link rel="stylesheet" href="{{ URL::asset ('css/highlight.js/tomorrow-night-bright.css') }}"/>
+ <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"/>
+ <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"/>
+
+ <!-- Page-specific -->
+ <title>~floppydisk / @yield('title')</title>
+ <meta property="og:title" content="~floppydisk / @yield('title')">
+ <meta property="og:description" content="@yield('description')">
+ <meta property="og:image" content="/favicon.png">
diff --git a/resources/views/layouts/default-hljs.blade.php b/resources/views/layouts/default-hljs.blade.php
new file mode 100644
index 0000000..a9380b0
--- /dev/null
+++ b/resources/views/layouts/default-hljs.blade.php
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+ @include('includes.head-hljs')
+</head>
+
+<body>
+<div class="page">
+<div class="header">
+ @include('includes.header')
+</div> <!-- header -->
+
+<div id="pagebody">
+ <div id="content">
+@yield('content')
+ </div> <!-- content -->
+ <div id="footer" class="pagefooter">
+ @include('includes.footer')
+ </div> <!-- footer -->
+</div> <!-- pagebody -->
+</div> <!-- page -->
+</body>
+</html>