Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
org-static
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stephen D
org-static
Commits
5464bbc5
Commit
5464bbc5
authored
2 years ago
by
Stephen D
Browse files
Options
Downloads
Patches
Plain Diff
allow custom syntaxes
parent
a5bd291a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/assets/style.css
+7
-0
7 additions, 0 deletions
src/assets/style.css
src/blog.rs
+2
-0
2 additions, 0 deletions
src/blog.rs
src/parser.rs
+8
-5
8 additions, 5 deletions
src/parser.rs
src/post.rs
+5
-5
5 additions, 5 deletions
src/post.rs
with
22 additions
and
10 deletions
src/assets/style.css
+
7
−
0
View file @
5464bbc5
...
...
@@ -58,3 +58,10 @@ th, td {
.page-link
{
padding-left
:
1em
;
}
code
{
font-size
:
87.5%
;
color
:
#e83e8c
;
word-break
:
break-word
;
}
This diff is collapsed.
Click to expand it.
src/blog.rs
+
2
−
0
View file @
5464bbc5
...
...
@@ -69,6 +69,8 @@ impl TryFrom<Blog> for RenderedBlog {
fn
try_from
(
mut
b
:
Blog
)
->
Result
<
Self
,
Error
>
{
let
mut
pages
=
HashMap
::
new
();
// TODO throw an error if we attempt to insert the same URL more than once
for
p
in
&
b
.posts
{
let
body
=
dress_page
(
&
p
.title
,
&
p
.html
()
?
,
&
b
.pages
);
...
...
This diff is collapsed.
Click to expand it.
src/parser.rs
+
8
−
5
View file @
5464bbc5
...
...
@@ -40,18 +40,21 @@ pub struct CustomHtmlHandler {
theme
:
Theme
,
}
impl
Default
for
CustomHtmlHandler
{
fn
default
()
->
Self
{
impl
CustomHtmlHandler
{
pub
fn
new
()
->
anyhow
::
Result
<
Self
>
{
let
mut
ts
=
ThemeSet
::
load_defaults
();
let
mut
ps
=
SyntaxSet
::
load_defaults_newlines
()
.into_builder
();
ps
.add_from_folder
(
"assets/syntaxes"
,
true
)
?
;
let
ps
=
ps
.build
();
Self
{
Ok
(
Self
{
fallback
:
Default
::
default
(),
ps
:
SyntaxSet
::
load_defaults_newlines
()
,
ps
,
theme
:
ts
.themes
.remove
(
"base16-eighties.dark"
)
.expect
(
"Could not load theme"
),
}
}
)
}
}
...
...
This diff is collapsed.
Click to expand it.
src/post.rs
+
5
−
5
View file @
5464bbc5
...
...
@@ -82,7 +82,7 @@ impl Loadable for Post {
let
url
=
slugify
(
&
format!
(
"/{slug_prefix}/{file_name}"
));
parse
(
PostParser
::
new
(
url
),
&
fs
::
read_to_string
(
path
)
?
)
parse
(
PostParser
::
new
(
url
)
?
,
&
fs
::
read_to_string
(
path
)
?
)
}
}
...
...
@@ -113,14 +113,14 @@ struct PostParser {
}
impl
PostParser
{
fn
new
(
url
:
String
)
->
Self
{
Self
{
fn
new
(
url
:
String
)
->
anyhow
::
Result
<
Self
>
{
Ok
(
Self
{
title
:
None
,
date
:
None
,
url
,
content
:
vec!
[],
handler
:
CustomHtmlHandler
::
default
(),
}
handler
:
CustomHtmlHandler
::
new
()
?
,
}
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment