- commit
- 5fff1d0
- parent
- 468667e
- author
- Eric Bower
- date
- 2021-07-23 04:26:27 +0000 UTC
move articles to json file
2 files changed,
+97,
-89
+71,
-0
1@@ -0,0 +1,71 @@
2+{
3+ "articles": [
4+ {
5+ "text": "nvim lua guide",
6+ "url": "https://github.com/nanotee/nvim-lua-guide",
7+ "desc": "A guide to using Lua in Neovim",
8+ "tags": ["meta"],
9+ "media": "https://opengraph.githubassets.com/bf01b0af4a6d4814fae6c35808e0d542bee8ce8b4449d2b64f2b40f4efc81562/nanotee/nvim-lua-guide"
10+ },
11+ {
12+ "text": "What is the benefit of writing plugins in lua?",
13+ "url": "https://www.reddit.com/r/neovim/comments/mg5ip7/what_is_the_benefit_of_writing_plugins_in_lua",
14+ "desc": "I hear that Lua is a first-class language for neovim but I'm not really sure what that means. Can someone explain what neovim-specific benefits there are to writing your plugin in Lua?",
15+ "date": "2021-03-21",
16+ "tags": ["plugins"]
17+ },
18+ {
19+ "text": "How to write neovim plugins in lua",
20+ "url": "https://www.2n.pl/blog/how-to-write-neovim-plugins-in-lua",
21+ "media": "https://www.2n.pl/system/blog_posts/photos/000/000/019/original/whid.png?1617885408",
22+ "date": "2021-05-02",
23+ "tags": ["plugins"],
24+ "desc": "One of goals which neovim devs set for themselves, was making lua the first-class scripting language alternative to viml. Since version 0.4 its' interpreter along with 'stdlib' have been already built into the editor."
25+ },
26+ {
27+ "text": "From init.vim to init.lua",
28+ "url": "https://teukka.tech/luanvim.html",
29+ "tags": ["config"],
30+ "desc": "I want to illustrate the process of learning how to take advantage of the powerful scripting capabilities that are available in the Neovim runtime.",
31+ "date": "2021-07-22"
32+ },
33+ {
34+ "text": "How to make UI for neovim plugins in Lua",
35+ "url": "https://dev.to/2nit/how-to-make-ui-for-neovim-plugins-in-lua-3b6e",
36+ "tags": ["plugins"],
37+ "desc": "Let's create a simple plugin that will show us last opened files in handy side navigation.",
38+ "media": "https://res.cloudinary.com/practicaldev/image/fetch/s--AqStf1TN--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/i/p1vusfl4dhivlv7hb559.png"
39+ },
40+ {
41+ "text": "Neovim 0.5 features and the switch to init.lua",
42+ "url": "https://oroques.dev/notes/neovim-init",
43+ "tags": ["config"],
44+ "desc": "This post will help you write a very basic init.lua which include all these new features.",
45+ "media": "https://raw.githubusercontent.com/ojroques/nvim-lspfuzzy/main/demo.gif",
46+ "date": "2021-07-18"
47+ },
48+ {
49+ "text": "Learn Lua in Y minutes",
50+ "url": "https://learnxinyminutes.com/docs/lua/",
51+ "tags": ["learn"],
52+ "desc": "A brief introduction into the lua programming language",
53+ "date": "2021-07-22"
54+ },
55+ {
56+ "text": "Learn lua quick guide",
57+ "tags": ["learn"],
58+ "url": "https://github.com/medwatt/Notes/blob/main/Lua/Lua_Quick_Guide.ipynb",
59+ "media": "https://opengraph.githubassets.com/6c6bc0166cc8b9679b671ca24b9a16329977677ef1130f81d939a14e22fc9a9e/medwatt/Notes",
60+ "desc": "This guide is also a good resource for getting started quickly",
61+ "date": "2021-07-22"
62+ },
63+ {
64+ "text": "Lua interactive tutorial",
65+ "tags": ["learn"],
66+ "url": "https://www.luascript.dev/learn",
67+ "desc": "New to lua? Start with us and learn!",
68+ "date": "2021-07-22",
69+ "media": "/lua-script.png"
70+ }
71+ ]
72+}
+26,
-89
1@@ -1,6 +1,5 @@
2-<script lang="ts">
3- import Nav from '$lib/nav.svelte';
4- import Tag from '$lib/tag.svelte';
5+<script context="module" lang="ts">
6+ import * as data from '$lib/articles.json';
7
8 interface Article {
9 text: string;
10@@ -11,101 +10,39 @@
11 tags: string[];
12 }
13
14- const zero = (num: number) => (num < 10 ? `0${num}` : `${num}`);
15- const format = (date: Date) => {
16- return `${date.getFullYear()}-${zero(date.getMonth())}-${zero(date.getDate())}`;
17- };
18-
19- const createArticle = (article: Partial<Article> = {}): Article => {
20+ const createArticle = (article: Partial<Article & { date: string }> = {}): Article => {
21 return {
22 text: '',
23 desc: '',
24 url: '',
25 media: '',
26 tags: [],
27- date: new Date(),
28 ...article,
29+ date: article.date ? new Date(article.date) : new Date(),
30 };
31 };
32
33- const links = [
34- createArticle({
35- text: 'nvim lua guide',
36- url: 'https://github.com/nanotee/nvim-lua-guide',
37- desc: 'A guide to using Lua in Neovim',
38- tags: ['meta'],
39- media:
40- 'https://opengraph.githubassets.com/bf01b0af4a6d4814fae6c35808e0d542bee8ce8b4449d2b64f2b40f4efc81562/nanotee/nvim-lua-guide',
41- }),
42- createArticle({
43- text: 'What is the benefit of writing plugins in lua?',
44- url:
45- 'https://www.reddit.com/r/neovim/comments/mg5ip7/what_is_the_benefit_of_writing_plugins_in_lua',
46- desc:
47- "I hear that Lua is a first-class language for neovim but I'm not really sure what that means. Can someone explain what neovim-specific benefits there are to writing your plugin in Lua?",
48- date: new Date('2021-03-21'),
49- tags: ['plugins'],
50- }),
51- createArticle({
52- text: 'How to write neovim plugins in lua',
53- url: 'https://www.2n.pl/blog/how-to-write-neovim-plugins-in-lua',
54- media: 'https://www.2n.pl/system/blog_posts/photos/000/000/019/original/whid.png?1617885408',
55- date: new Date('2021-05-02'),
56- tags: ['plugins'],
57- desc:
58- "One of goals which neovim devs set for themselves, was making lua the first-class scripting language alternative to viml. Since version 0.4 its' interpreter along with 'stdlib' have been already built into the editor.",
59- }),
60- createArticle({
61- text: 'From init.vim to init.lua',
62- url: 'https://teukka.tech/luanvim.html',
63- tags: ['config'],
64- desc:
65- 'I want to illustrate the process of learning how to take advantage of the powerful scripting capabilities that are available in the Neovim runtime.',
66- date: new Date('2021-07-22'),
67- }),
68- createArticle({
69- text: 'How to make UI for neovim plugins in Lua',
70- url: 'https://dev.to/2nit/how-to-make-ui-for-neovim-plugins-in-lua-3b6e',
71- tags: ['plugins'],
72- desc:
73- "Let's create a simple plugin that will show us last opened files in handy side navigation.",
74- media:
75- 'https://res.cloudinary.com/practicaldev/image/fetch/s--AqStf1TN--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/i/p1vusfl4dhivlv7hb559.png',
76- }),
77- createArticle({
78- text: 'Neovim 0.5 features and the switch to init.lua',
79- url: 'https://oroques.dev/notes/neovim-init',
80- tags: ['config'],
81- desc:
82- 'This post will help you write a very basic init.lua which include all these new features.',
83- media: 'https://raw.githubusercontent.com/ojroques/nvim-lspfuzzy/main/demo.gif',
84- date: new Date('2021-07-18'),
85- }),
86- createArticle({
87- text: 'Learn Lua in Y minutes',
88- url: 'https://learnxinyminutes.com/docs/lua/',
89- tags: ['learn'],
90- desc: 'A brief introduction into the lua programming language',
91- date: new Date('2021-07-22'),
92- }),
93- createArticle({
94- text: 'Learn lua quick guide',
95- tags: ['learn'],
96- url: 'https://github.com/medwatt/Notes/blob/main/Lua/Lua_Quick_Guide.ipynb',
97- media:
98- 'https://opengraph.githubassets.com/6c6bc0166cc8b9679b671ca24b9a16329977677ef1130f81d939a14e22fc9a9e/medwatt/Notes',
99- desc: 'This guide is also a good resource for getting started quickly',
100- date: new Date('2021-07-22'),
101- }),
102- createArticle({
103- text: 'Lua interactive tutorial',
104- tags: ['learn'],
105- url: 'https://www.luascript.dev/learn',
106- desc: 'New to lua? Start with us and learn!',
107- date: new Date('2021-07-22'),
108- media: '/lua-script.png',
109- }),
110- ].sort((a, b) => b.date.getTime() - a.date.getTime());
111+ export async function load() {
112+ const articles = data.articles as any;
113+
114+ return {
115+ props: {
116+ articles: articles.map(createArticle).sort((a, b) => b.date.getTime() - a.date.getTime()),
117+ },
118+ };
119+ }
120+</script>
121+
122+<script lang="ts">
123+ import Nav from '$lib/nav.svelte';
124+ import Tag from '$lib/tag.svelte';
125+
126+ const zero = (num: number) => (num < 10 ? `0${num}` : `${num}`);
127+ const format = (date: Date) => {
128+ return `${date.getFullYear()}-${zero(date.getMonth())}-${zero(date.getDate())}`;
129+ };
130+
131+ export let articles: Article[];
132 </script>
133
134 <Nav />
135@@ -116,7 +53,7 @@
136 <p>
137 I've been compiling a list of guides that help people build and use lua plugins for neovim.
138 </p>
139- {#each links as link}
140+ {#each articles as link}
141 <div class="article">
142 {#if link.media}
143 <a href={link.url} target="_blank">