Skip to content

Commit 748082e

Browse files
committed
import configs and display their names with prefixed instance url
1 parent e884a8f commit 748082e

File tree

11 files changed

+259
-23
lines changed

11 files changed

+259
-23
lines changed

.github/workflows/gh-pages.yml

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
bundle config path vendor/bundle
3333
bundle config --global frozen 1
3434
bundle install --jobs 4 --retry 3
35+
make update
3536
bundle exec jekyll build
3637
3738
- name: deploy

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ _site
44
.jekyll-metadata
55
vendor
66
node_modules/
7+
_data/configs.yml

.rubocop.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
AllCops:
2+
NewCops: enable
3+
TargetRubyVersion: 2.6
4+
DisplayCopNames: true
5+
6+
Style/DoubleNegation:
7+
Exclude:
8+
- bin/data-update

Gemfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ source 'https://rubygems.org'
44
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
55

66
gem 'jekyll', '~> 4.1.0'
7-
# This is the default theme for new Jekyll sites. You may change this to anything you like.
8-
gem 'minima', '~> 2.5'
7+
gem 'just-the-docs'
8+
9+
gem 'html2rss', git: 'https://github.com/gildesmarais/html2rss.git'
10+
gem 'html2rss-configs', git: 'https://github.com/gildesmarais/html2rss-configs.git'
911

1012
group :jekyll_plugins do
1113
gem 'jekyll-feed', '~> 0.12'

Gemfile.lock

+70-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,57 @@
1+
GIT
2+
remote: https://github.com/gildesmarais/html2rss-configs.git
3+
revision: 3419feaab324a559ed00903eccac8d1cc758466c
4+
specs:
5+
html2rss-configs (0.2.0)
6+
7+
GIT
8+
remote: https://github.com/gildesmarais/html2rss.git
9+
revision: 5cdc59a82704626fec2c020c36ce7f9bd267ea70
10+
specs:
11+
html2rss (0.9.0)
12+
activesupport (>= 5, < 7)
13+
addressable (~> 2.7)
14+
builder
15+
faraday (~> 1.0)
16+
faraday_middleware
17+
kramdown
18+
mime-types (> 3.0)
19+
nokogiri (>= 1.10, < 2.0)
20+
reverse_markdown (~> 2.0)
21+
sanitize (~> 5.0)
22+
to_regexp
23+
zeitwerk
24+
125
GEM
226
remote: https://rubygems.org/
327
specs:
28+
activesupport (6.0.3.2)
29+
concurrent-ruby (~> 1.0, >= 1.0.2)
30+
i18n (>= 0.7, < 2)
31+
minitest (~> 5.1)
32+
tzinfo (~> 1.1)
33+
zeitwerk (~> 2.2, >= 2.2.2)
434
addressable (2.7.0)
535
public_suffix (>= 2.0.2, < 5.0)
636
ast (2.4.1)
37+
builder (3.2.4)
738
colorator (1.1.0)
839
concurrent-ruby (1.1.6)
40+
crass (1.0.6)
941
em-websocket (0.5.1)
1042
eventmachine (>= 0.12.9)
1143
http_parser.rb (~> 0.6.0)
1244
eventmachine (1.2.7)
45+
faraday (1.0.1)
46+
multipart-post (>= 1.2, < 3)
47+
faraday_middleware (1.0.0)
48+
faraday (~> 1.0)
1349
ffi (1.13.1)
1450
forwardable-extended (2.6.0)
1551
http_parser.rb (0.6.0)
1652
i18n (1.8.3)
1753
concurrent-ruby (~> 1.0)
18-
jekyll (4.1.0)
54+
jekyll (4.1.1)
1955
addressable (~> 2.4)
2056
colorator (~> 1.0)
2157
em-websocket (~> 0.5)
@@ -30,7 +66,7 @@ GEM
3066
rouge (~> 3.0)
3167
safe_yaml (~> 1.0)
3268
terminal-table (~> 1.8)
33-
jekyll-feed (0.13.0)
69+
jekyll-feed (0.14.0)
3470
jekyll (>= 3.7, < 5.0)
3571
jekyll-loading-lazy (0.1.1)
3672
jekyll (>= 3.0, < 5.0)
@@ -46,6 +82,10 @@ GEM
4682
nokogiri (~> 1.10)
4783
jekyll-watch (2.2.1)
4884
listen (~> 3.0)
85+
just-the-docs (0.3.0)
86+
jekyll (>= 3.8.5)
87+
jekyll-seo-tag (~> 2.0)
88+
rake (>= 12.3.1, < 13.1.0)
4989
kramdown (2.2.1)
5090
rexml
5191
kramdown-parser-gfm (1.1.0)
@@ -55,55 +95,72 @@ GEM
5595
rb-fsevent (~> 0.10, >= 0.10.3)
5696
rb-inotify (~> 0.9, >= 0.9.10)
5797
mercenary (0.4.0)
98+
mime-types (3.3.1)
99+
mime-types-data (~> 3.2015)
100+
mime-types-data (3.2020.0512)
58101
mini_portile2 (2.4.0)
59-
minima (2.5.1)
60-
jekyll (>= 3.5, < 5.0)
61-
jekyll-feed (~> 0.9)
62-
jekyll-seo-tag (~> 2.1)
102+
minitest (5.14.1)
103+
multipart-post (2.1.1)
63104
nokogiri (1.10.9)
64105
mini_portile2 (~> 2.4.0)
65-
parallel (1.19.1)
66-
parser (2.7.1.3)
67-
ast (~> 2.4.0)
106+
nokogumbo (2.0.2)
107+
nokogiri (~> 1.8, >= 1.8.4)
108+
parallel (1.19.2)
109+
parser (2.7.1.4)
110+
ast (~> 2.4.1)
68111
pathutil (0.16.2)
69112
forwardable-extended (~> 2.6)
70113
public_suffix (4.0.5)
71114
rainbow (3.0.0)
115+
rake (13.0.1)
72116
rb-fsevent (0.10.4)
73117
rb-inotify (0.10.1)
74118
ffi (~> 1.0)
75119
regexp_parser (1.7.1)
120+
reverse_markdown (2.0.0)
121+
nokogiri
76122
rexml (3.2.4)
77123
rouge (3.20.0)
78-
rubocop (0.85.1)
124+
rubocop (0.86.0)
79125
parallel (~> 1.10)
80126
parser (>= 2.7.0.1)
81127
rainbow (>= 2.2.2, < 4.0)
82128
regexp_parser (>= 1.7)
83129
rexml
84-
rubocop-ast (>= 0.0.3)
130+
rubocop-ast (>= 0.0.3, < 1.0)
85131
ruby-progressbar (~> 1.7)
86132
unicode-display_width (>= 1.4.0, < 2.0)
87-
rubocop-ast (0.0.3)
133+
rubocop-ast (0.1.0)
88134
parser (>= 2.7.0.1)
89135
ruby-progressbar (1.10.1)
90136
safe_yaml (1.0.5)
137+
sanitize (5.2.1)
138+
crass (~> 1.0.2)
139+
nokogiri (>= 1.8.0)
140+
nokogumbo (~> 2.0)
91141
sassc (2.4.0)
92142
ffi (~> 1.9)
93143
terminal-table (1.8.0)
94144
unicode-display_width (~> 1.1, >= 1.1.1)
145+
thread_safe (0.3.6)
146+
to_regexp (0.2.1)
147+
tzinfo (1.2.7)
148+
thread_safe (~> 0.1)
95149
unicode-display_width (1.7.0)
150+
zeitwerk (2.3.0)
96151

97152
PLATFORMS
98153
ruby
99154

100155
DEPENDENCIES
156+
html2rss!
157+
html2rss-configs!
101158
jekyll (~> 4.1.0)
102159
jekyll-feed (~> 0.12)
103160
jekyll-loading-lazy
104161
jekyll-sitemap
105162
jekyll-target-blank
106-
minima (~> 2.5)
163+
just-the-docs
107164
rubocop (~> 0.85)
108165
tzinfo (~> 1.2)
109166
tzinfo-data

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ default: setup clean fix serve
33
setup:
44
yarn check || yarn
55
bundle check || bundle
6+
make update
67

78
fix:
89
prettier --write --no-semi "**/*.yml" "**/*.md" "**/*.scss" "**/*.rb" "assets/**/*.js" "**/*.mdx"
@@ -13,8 +14,11 @@ clean:
1314
find . -type d -empty -delete
1415
find . -type f -empty -delete
1516

16-
serve:
17-
bundle check || bundle
17+
update:
18+
bundle update html2rss-configs
19+
bin/data-update
20+
21+
serve: setup
1822
open http://127.0.0.1:4000/
1923
bundle exec jekyll s --drafts --trace
2024

_config.yml

+10-6
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ permalink: /blog/:year/:title
88

99
title: html2rss
1010

11-
twitter_username: ""
12-
github_username: ""
13-
1411
description: |
15-
html2rss brings back RSS. It is an open source project with decentralised
16-
instances. These instances provide RSS feeds for websites which do not offer
12+
html2rss brings back RSS. It's an open source project with decentralised
13+
instances. These instances generate RSS feeds for websites which do not offer
1714
them.
1815
19-
theme: minima
16+
github_username: "html2rss"
17+
18+
theme: just-the-docs
19+
20+
header_pages:
21+
- configs/index.html
2022

2123
sass:
2224
style: compressed
@@ -34,9 +36,11 @@ exclude:
3436
- .gitignore
3537
- .jekyll-cache/
3638
- .nvmrc
39+
- .rubocop.yml
3740
- .ruby-version
3841
- .sass-cache/
3942
- .stylelintrc.json
43+
- bin/
4044
- Gemfile
4145
- Gemfile.lock
4246
- gemfiles/

_includes/head_custom.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<meta name="apple-mobile-web-app-capable" content="yes">
2+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
3+
<meta name="referrer" content="no-referrer" />
4+
<meta
5+
name="robots"
6+
content="{% if page.noindex %}noindex, noarchive, follow{% else %}index, follow{% endif %}"
7+
/>

assets/js/configs/index.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
;(function() {
2+
"use strict"
3+
4+
const instanceEl = document.querySelector('input[name="instance"]')
5+
6+
function instanceUrl() {
7+
const url = instanceEl.value
8+
9+
return url.substr(-1) === "/" ? url : `${url}/`
10+
}
11+
12+
function onChangeInstanceUrl() {
13+
const url = instanceUrl()
14+
15+
Array.from(document.querySelectorAll(".instance")).forEach(function(el) {
16+
el.innerText = url
17+
})
18+
}
19+
20+
function onShowClick(event) {
21+
event.target.href = [instanceUrl(), event.target.dataset.path].join("")
22+
return false
23+
}
24+
25+
// init
26+
document.querySelector("#configs").addEventListener("click", event => {
27+
if (event.target.dataset.bindClick === "show") {
28+
return onShowClick(event)
29+
}
30+
})
31+
32+
instanceEl.addEventListener("keydown", event => {
33+
onChangeInstanceUrl()
34+
})
35+
onChangeInstanceUrl()
36+
})()

bin/data-update

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require 'rubygems'
5+
require 'bundler/setup'
6+
7+
require 'html2rss'
8+
require 'html2rss/configs'
9+
require 'yaml'
10+
11+
file_names = Html2rss::Configs.file_names.sort
12+
13+
def valid_url(url)
14+
!!URI(url)
15+
rescue StandardError
16+
false
17+
end
18+
19+
output = file_names.map do |file_name|
20+
config = YAML.safe_load(File.open(file_name), symbolize_names: false)
21+
22+
file_name_splits = file_name.split('/')
23+
24+
{
25+
'domain' => file_name_splits[-2..-2].join,
26+
'name' => File.basename(file_name_splits[-1..].join, '.*'),
27+
'valid_channel_url' => valid_url(config['channel']['url']),
28+
'channel' => config['channel']
29+
}
30+
end
31+
32+
config_file = File.join(__dir__, '..', '_data/configs.yml')
33+
File.write(config_file, output.to_yaml)

0 commit comments

Comments
 (0)