jekyll-theme-paperwiki 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1896b6de7d51495d6bdf12f3cc9aac56bb2573fcf80ce429725fee3593762b91
4
- data.tar.gz: 18e1e6d0a06dffaff1f3ab69f29464186573086d0ade1df15cea4b45085cf568
3
+ metadata.gz: ccafbae2594b3e26ca40574057a535540860cdfab82ad62d47cbeed13ccc3427
4
+ data.tar.gz: ef2323e18fe4d2f3819459bcfb0866ed38366c1d92da8cd010f48e2fbd266180
5
5
  SHA512:
6
- metadata.gz: 894e88cf0db6b281bd2ab322009df722df6859da06b9e6471c8088ebb80e4e500ef58b6ea6bc78e8a0d3d5eac35c92a5f22147de733c255e00fb9e17f42b1947
7
- data.tar.gz: daa223a3bea9974c308e1fa6c726fee01e64d494586f827ef30d58c7d964ce8c24c0a523acb4969bc4cb5e1054d0eb397c2f8970ed2f1ef9ede4b63e910672de
6
+ metadata.gz: c31c58b6e6a115360b9561cec521815ba98036eeb37d0fcf0873808f29b8e6563ebfa9ef4d56e171c67c377d89b7d195612eb03088c3bde1d8eb77584f4735bc
7
+ data.tar.gz: 8b540673b1a01905b6259c47c73677737cb76373f3e20526896b724a8c2c858a66777b5239ecd3576deb85df2113cb33ce94b06c85e62ead2904cf0a88fecfc8
data/README.md CHANGED
@@ -1,38 +1,21 @@
1
1
  # jekyll-theme-paperwiki
2
2
 
3
- ![](/assets/images/homepage.png)
3
+ ![A screenshot of the PaperWiki homepage.](/assets/images/homepage.png)
4
4
 
5
5
  For storing your worldbuilding notes! The intent of this theme is to get all the code out of the way and to allow you to write Markdown articles; the best way to do that is to install the theme as a gem. However, if you want to tinker with the code, just download this repository.
6
6
 
7
7
  For the easiest starting point, I have uploaded a [sample site](https://github.com/pomeloshark/paperwiki-example) that you can download with everything preconfigured, so if you're unfamiliar with Jekyll you can bypass all the setup and get right to it. See that repo for instructions.
8
8
 
9
- I've tried to adhere to accessible and easy to read design principles while retaining the look and layout of a classic wiki that we're all familiar with - I've aped some elements of Wikipedia's organizational system and layout while trying to make it as clean and user friendly as possible.
10
-
11
- This theme is not mobile friendly, as I personally do absolutely no work on mobile and thus my development skills are lacking. I stuck in a couple CSS breakpoints, so it'll be mostly legible on a medium-sized tablet, but don't expect great results on a phone. There is also no dark mode or other alternate colour scheme, but please feel free to fork this project and add whatever functionality you're looking for.
12
-
13
9
  This theme is not really intended for blogging, but you could add in the functionality easily enough by creating a `_posts` collection and setting a default post layout in the config file, as there is a dedicated `post` layout, as well as a `blog.md` which will list all of your blog posts on one page. If you have no need for it you can delete this file.
14
10
 
15
11
 
16
12
 
17
- ## Usage
18
-
19
- In case you're unfamiliar with it, a basic Jekyll site includes the following:
20
- + The `_includes` folder contains snippets of HTML that are frequently reused on pages throughout the website. This saves us from having to copy and paste the HTML on multiple pages, and we only have to edit it in one file in order to change every instance of it.
21
- + The `_layouts` folder contains the formatting for different types of pages, meaning that instead of formatting each page individually we can just specify which layout template to use.
22
- + The `_sass` folder contains all the styling for the site, written in SCSS.
23
- + The `_site` folder contains everything that Jekyll outputs when it builds the site. Don't edit anything in this folder, as it will be rewritten the next time you serve the site.
24
- + The `assets` folder contains things like fonts, images, and Javascript files. It also contains a `.scss` file importing all of your SCSS so that Jekyll can convert it to regular CSS.
25
-
26
- This theme comes with all of these prepackaged, so most of what you have to do is edit the `_config.yaml` file. The theme has some default config set already, but you can override these in your own config file if you wish. You can also add any of the above folders to your own project with includes, layouts, or SCSS to override the theme's files. For example, you will want to add your own `assets` folder to store your own images, including one titled `favicon.png` in order to override the placeholder one i've included.
27
-
28
-
29
-
30
13
  ## Installation
31
14
 
32
15
  [Install Jekyll](https://jekyllrb.com/docs/). If you're using the example site linked above, you can skip ahead to the [using the wiki](#using-the-wiki) section. Otherwise, create a new site by running the following in your terminal:
33
16
 
34
17
  ```
35
- $ jekyll new MYSITENAME
18
+ jekyll new SITE_NAME_HERE
36
19
  ```
37
20
 
38
21
  This will give you a very bare bones Jekyll site, with an index page, a folder for blog posts, a config file, and a Gemfile. You'll have to do a little setup to make it usable with this theme. Here's what the directory should look like:
@@ -90,26 +73,7 @@ Navigate to your localhost and...you will see an empty page. This is because the
90
73
  layout: launchpad
91
74
  ```
92
75
 
93
- This will show you the default wiki homepage. The three links - explore, contents, and random page - link to pages that are included with the theme, and consist of pregenerated content based on the wiki articles you've written. Now you can start adding articles in your `_wiki` folder.
94
-
95
-
96
-
97
- ### Using the wiki
98
-
99
- All of your wiki pages should be written in Markdown, and you must begin each `.md` file like so:
100
-
101
- ```
102
- ---
103
- ---
104
- ```
105
-
106
- Between these two lines is where you include *front matter*, such as specifying the layout or the permalink to the page. However, you can leave the front matter blank - wiki pages have layouts and permalinks set by default in the theme's config file, and you only need to specify them if you want to override the defaults. You also do not need to specify a title for the page, as it is automatically taken from the filename. All you absolutely need is the two triple-dashed lines, as Jekyll needs it to know that the front matter is there in order to output the page.
107
-
108
- Caveats:
109
- - If the site won't build due to an error with the random page, make sure you have more than one wiki article for it to draw from
110
- - You may need to specify a permalink and a title if you want to use certain characters that are not allowed in filenames -- say, some IPA characters. Otherwise just title your articles "Article title.md", with spaces, not underscores or hyphens, and the default settings will take care of the rest.
111
-
112
- If you're unfamiliar with Markdown, see [here](https://www.markdownguide.org/).
76
+ This will show you the default wiki homepage. The three links - explore, contents, and random page - link to pages that are included with the theme, and consist of pregenerated content based on the wiki articles you've written. Now you can start adding articles in your `_wiki` folder. See my [guide](https://pomeloshark.github.io/jekyll) for further details.
113
77
 
114
78
 
115
79
 
@@ -0,0 +1,25 @@
1
+ ---
2
+ layout: entry
3
+ ---
4
+
5
+ <article class="entry entry_grammar">
6
+
7
+ <h1>
8
+ {{ page.name | remove: ".md" }}
9
+ </h1>
10
+
11
+ {% if site.entry_tags_top %}
12
+ <section class="entry-tags entry-tags_top">
13
+ {% include entry_tags.html %}
14
+ </section>
15
+ {% endif %}
16
+
17
+ {{ content }}
18
+
19
+ {% if site.entry_tags_top == false %}
20
+ <section class="entry-tags entry-tags_bottom">
21
+ {% include entry_tags.html %}
22
+ </section>
23
+ {% endif %}
24
+
25
+ </article>
data/_layouts/random.html CHANGED
@@ -16,6 +16,8 @@
16
16
  {%- assign docs = docs | concat: site.documents | uniq -%}
17
17
  {%- endif -%}
18
18
 
19
+ <!---Fix this so the collections random links are scoped to only that collection--->
20
+
19
21
  <script type="text/javascript">
20
22
 
21
23
  var urls=[];
@@ -0,0 +1,27 @@
1
+ ---
2
+ layout: entry
3
+ ---
4
+
5
+ <article class="entry entry_work">
6
+
7
+ <h1>
8
+ {{ page.name | remove: ".md" }}
9
+ </h1>
10
+
11
+ {% if site.entry_tags_top %}
12
+ <section class="entry-tags entry-tags_top">
13
+ {% include entry_tags.html %}
14
+ </section>
15
+ {% endif %}
16
+
17
+ {{ content }}
18
+
19
+ {% if site.entry_tags_top == false %}
20
+ <section class="entry-tags entry-tags_bottom">
21
+ {% include entry_tags.html %}
22
+ </section>
23
+ {% endif %}
24
+
25
+ </article>
26
+
27
+ {% include wiki_sidebar.html %}
@@ -14,7 +14,10 @@
14
14
  margin-left: 0;
15
15
  }
16
16
 
17
- .search_result {}
17
+ .search_result {
18
+ text-decoration: none;
19
+ font-weight: bold;
20
+ }
18
21
 
19
22
  .search_result-details {
20
23
  margin-bottom: 0;
@@ -26,3 +29,10 @@
26
29
  .search_result-preview {
27
30
  margin-bottom: 1.75rem;
28
31
  }
32
+
33
+ .search_result-highlight {
34
+ padding: 0.2em 0.3em;
35
+
36
+ background-color: $color-peach;
37
+ border-radius: $border_radius-inline;
38
+ }
data/assets/.DS_Store CHANGED
Binary file
data/assets/js/search.js CHANGED
@@ -1,13 +1,16 @@
1
- // Yoinked in its entirety from https://davidwalsh.name/adding-search-to-your-site-with-javascript
1
+ // Yoinked in its entirety from https://davidwalsh.name/adding-search-to-your-site-with-javascript and https://trackjs.com/blog/site-search-with-javascript-part-2/
2
2
 
3
+ // var lunrFolding = require("lunr-folding")(lunr);
4
+
5
+ // Build the search index
3
6
  var searchIndex = lunr(function() {
4
- // define searchable fields for each page
7
+ // Define searchable fields for each page
5
8
  this.ref("id");
6
- this.field("title", { boost: 10 });
7
- this.field("content");
9
+ this.field("title", { boost: 100 }); // Boost the importance of the title field, prioritizing title matches
10
+ this.field("content", { boost: 10 });
8
11
  this.field("portal");
9
12
  this.field("categories");
10
- for (var key in window.pages) {
13
+ for (var key in window.pages) { // Loop through all pages to add their data to the search index
11
14
  this.add({
12
15
  "id": key,
13
16
  "title": pages[key].title,
@@ -30,21 +33,44 @@ function getQueryVariable(variable) {
30
33
  }
31
34
 
32
35
  var searchTerm = getQueryVariable("q");
33
- // creation of searchIndex from earlier example
34
- var results = searchIndex.search(searchTerm);
36
+ // Create index of search term matches
37
+ var results = searchIndex.search(searchTerm + "*"); // Wildcard by default
35
38
  var resultPages = results.map(function (match) {
36
39
  return pages[match.ref];
37
40
  });
38
41
 
39
42
 
40
43
 
44
+ // Text highlighting
45
+ function formatContent(content, searchTerm) {
46
+ var termIdx = content.toLowerCase().indexOf(searchTerm.toLowerCase());
47
+ if (termIdx >= 0) {
48
+ var startIdx = Math.max(0, termIdx - 140);
49
+ var endIdx = Math.min(content.length, termIdx + searchTerm.length + 140);
50
+ var trimmedContent = (startIdx === 0) ? "" : "&hellip;";
51
+ trimmedContent += content.substring(startIdx, endIdx);
52
+ trimmedContent += (endIdx >= content.length) ? "" : "&hellip;"
53
+
54
+ var highlightedContent = trimmedContent.replace(new RegExp(searchTerm, "ig"), function matcher(match) {
55
+ return "<mark class='search_result-highlight'>" + match + "</mark>";
56
+ });
57
+
58
+ return highlightedContent;
59
+ }
60
+ else {
61
+ var emptyTrimmedString = content.substr(0, 280);
62
+ emptyTrimmedString += (content.length < 280) ? "" : "&hellip;";
63
+ return emptyTrimmedString;
64
+ }
65
+ }
66
+
67
+
41
68
 
42
- // resultPages from previous example
43
69
  resultsString = "";
44
- resultPages.forEach(function (r) {
70
+ resultPages.forEach(function (r) { // Format the output on the search results page
45
71
  resultsString += "<dt class='search_result'>";
46
- resultsString += "<a href='" + r.url + "'>" + r.title + "</a>";
72
+ resultsString += "<a class='search_result' href='" + r.url + "'>" + r.title + "</a>";
47
73
  resultsString += "<span class='search_result-details'>" + r.portal + " ⋅ " + r.categories + "</span></dt>"
48
- resultsString += "<dd class='search_result-preview'>" + r.content.substring(0, 200) + "..." + "</dd>";
74
+ resultsString += "<dd class='search_result-preview'>" + formatContent(r.content, searchTerm) + "" + "</dd>";
49
75
  });
50
76
  document.querySelector("#search-results").innerHTML = resultsString;
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-paperwiki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - pomeloshark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-04 00:00:00.000000000 Z
11
+ date: 2023-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.3'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.3'
26
+ version: '0'
27
27
  description:
28
28
  email:
29
29
  executables: []
@@ -44,6 +44,7 @@ files:
44
44
  - _layouts/collections.html
45
45
  - _layouts/default.html
46
46
  - _layouts/entry.html
47
+ - _layouts/grammar.html
47
48
  - _layouts/launchpad.html
48
49
  - _layouts/page.html
49
50
  - _layouts/portal.html
@@ -53,6 +54,7 @@ files:
53
54
  - _layouts/search.html
54
55
  - _layouts/search_global.html
55
56
  - _layouts/wiki.html
57
+ - _layouts/work.html
56
58
  - _sass/partials/_base.scss
57
59
  - _sass/partials/_blog.scss
58
60
  - _sass/partials/_collections.scss
@@ -100,7 +102,6 @@ files:
100
102
  - assets/fonts/RemixIcon/remixicon.css
101
103
  - assets/fonts/RemixIcon/remixicon.eot
102
104
  - assets/fonts/RemixIcon/remixicon.glyph.json
103
- - assets/fonts/RemixIcon/remixicon.less
104
105
  - assets/fonts/RemixIcon/remixicon.svg
105
106
  - assets/fonts/RemixIcon/remixicon.symbol.svg
106
107
  - assets/fonts/RemixIcon/remixicon.ttf
@@ -2404,5 +2405,5 @@ requirements: []
2404
2405
  rubygems_version: 3.2.15
2405
2406
  signing_key:
2406
2407
  specification_version: 4
2407
- summary: A theme meant for use as a personal wiki.
2408
+ summary: A Jekyll theme meant for use as a personal wiki.
2408
2409
  test_files: []