jekyll-rp_logs 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.themes/default/source/_includes/footer.html +1 -2
- data/.themes/default/source/_includes/rp_line.html +12 -0
- data/.themes/default/source/_sass/_rp.scss +20 -4
- data/.themes/default/source/css/main.scss +1 -0
- data/CHANGELOG.md +19 -0
- data/README.md +63 -60
- data/Rakefile +8 -26
- data/exe/rplogs +33 -0
- data/jekyll-rp_logs.gemspec +3 -1
- data/lib/jekyll/rp_logs.rb +1 -1
- data/lib/jekyll/rp_logs/{parse_irssi_xchat.rb → parsers/irssi_xchat.rb} +0 -0
- data/lib/jekyll/rp_logs/{parse_mirc.rb → parsers/mirc.rb} +0 -0
- data/lib/jekyll/rp_logs/{parse_skype_12hour.rb → parsers/skype_12hour.rb} +0 -0
- data/lib/jekyll/rp_logs/{parse_skype_24hour.rb → parsers/skype_24hour.rb} +0 -0
- data/lib/jekyll/rp_logs/{parse_weechat.rb → parsers/weechat.rb} +0 -0
- data/lib/jekyll/rp_logs/rp_log_converter.rb +49 -33
- data/lib/jekyll/rp_logs/rp_logline.rb +3 -3
- data/lib/jekyll/rp_logs/rp_page.rb +4 -0
- data/lib/jekyll/rp_logs/rp_tasks.rb +3 -42
- data/lib/jekyll/rp_logs/version.rb +1 -1
- data/lib/tasks/rp_logs.rake +82 -0
- metadata +43 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c951a21b0c5b350b1ba6d082873432fdb65ad42
|
4
|
+
data.tar.gz: b2dd0341e66e36f310b17508da6bbdc68a44604b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8403188715e33b12ae311df685cc23d6d649a22ad62c892cad341cde7d7ec87457fd4fb6389975ca4c3cfdd8a9e5f92a89a789d0dba955f038abdb95056942d
|
7
|
+
data.tar.gz: bb681abdba3e83a71c83d19e7ddb27340507fe20baa8729d1bd1995b4438601b070d6fe9b890f8e6653e4b0341071de9bbdeba3f47a67381740537eb2840d877
|
@@ -6,11 +6,10 @@
|
|
6
6
|
|
7
7
|
<div class="footer-col-wrapper">
|
8
8
|
<div class="footer-col footer-col-1">
|
9
|
-
|
9
|
+
<p class="text">Generated by <a href="https://github.com/xiagu/jekyll-rp_logs">jekyll-rp_logs</a> v{{ site.rp_logs_version }}</p>
|
10
10
|
</div>
|
11
11
|
|
12
12
|
<div class="footer-col footer-col-2">
|
13
|
-
|
14
13
|
</div>
|
15
14
|
|
16
15
|
<div class="footer-col footer-col-3">
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{% assign line = include.line %}
|
2
|
+
|
3
|
+
{% if line.base_type == "rp" %}
|
4
|
+
{% capture sender %}{{ line.sender }}{% endcapture %}
|
5
|
+
{% else %}
|
6
|
+
{% capture sender %}<{{ line.mode }}{{ line.sender }}>{% endcapture %}
|
7
|
+
{% endif %}
|
8
|
+
|
9
|
+
{% assign anchor_name = line.timestamp | date: "%Y-%m-%d_%H:%M:%S" %}
|
10
|
+
{% assign anchor_title = line.timestamp | date: "%H:%M:%S %B %-d, %Y" %}
|
11
|
+
{% assign anchor_display = line.timestamp | date: "%H:%M" %}
|
12
|
+
<p class="{{ line.output_type }}"><a name="{{ anchor_name }}" title="{{ anchor_title }}" href="#{{ anchor_name }}">{{ anchor_display }} </a>{{ sender }} {{ line.content }}</p>
|
@@ -57,15 +57,19 @@ li {
|
|
57
57
|
|
58
58
|
/* Undo normal pre styles */
|
59
59
|
#log {
|
60
|
-
|
61
60
|
p {
|
62
61
|
margin: 0;
|
63
62
|
margin-top: 0.5em;
|
64
63
|
}
|
65
64
|
|
66
|
-
.rp {
|
65
|
+
.rp {
|
66
|
+
color: $text-color;
|
67
|
+
& a { color: darken($text-color, 20%); }
|
68
|
+
}
|
67
69
|
.ooc {
|
68
|
-
color:
|
70
|
+
color: $dark-text-color;
|
71
|
+
& a { color: darken($dark-text-color, 20%); }
|
72
|
+
|
69
73
|
white-space: pre-wrap;
|
70
74
|
font-family: monospace;
|
71
75
|
font-size: 80%;
|
@@ -73,7 +77,19 @@ li {
|
|
73
77
|
|
74
78
|
/* timestamps */
|
75
79
|
a {
|
76
|
-
|
80
|
+
/* Set them off to the left */
|
81
|
+
display: inline-block;
|
82
|
+
margin-left: -4rem;
|
83
|
+
/* This is definitely too thin for them but overflow makes it okay */
|
84
|
+
margin-right: 2rem;
|
85
|
+
width: 2rem;
|
86
|
+
|
87
|
+
/* Give it some room to breathe */
|
88
|
+
$laptop-plus: $on-laptop + $base-font-size * 5;
|
89
|
+
@include media-query($laptop-plus) {
|
90
|
+
margin: 0;
|
91
|
+
margin-right: 1rem;
|
92
|
+
}
|
77
93
|
|
78
94
|
&:hover {
|
79
95
|
text-decoration: underline;
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [0.5.0] - 2016-01-29
|
6
|
+
### Added
|
7
|
+
- The default footer has a "Generated by [jekyll-rp_logs](https://github.com/xiagu/jekyll-rp_logs) vX.X.X" blurb in the left column. ([#47])
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
- Parsers live in `lib/jekyll/rp_logs/parsers/` now. This is purely a development-side change.
|
11
|
+
- The default theme's timestamps are in their own column on the left now. They revert to being inline when the page width gets too small. Run `rplogs update` to install this change if you haven't changed the non-custom SASS files. ([#60])
|
12
|
+
- Instead of needing a Rakefile, this gem now exposes an `rplogs` executable to perform tasks like setting up a new site scaffold. ([#63])
|
13
|
+
- The `rplogs` program is also used to update your installed theme, with `rplogs update`. ([#69])
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- `main.scss` no longer has its executable bits set. ([#67])
|
17
|
+
|
5
18
|
## [0.4.0] - 2016-01-11
|
6
19
|
### Added
|
7
20
|
- Tag descriptions can be set in the config file and show up on each tag's page that lists all RPs with that tag. ([#28])
|
@@ -82,6 +95,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
82
95
|
- Set required Ruby version to `~> 2.1` ([#32])
|
83
96
|
|
84
97
|
|
98
|
+
[0.5.0]: https://github.com/xiagu/jekyll-rp_logs/compare/v0.4.0...v0.5.0
|
85
99
|
[0.4.0]: https://github.com/xiagu/jekyll-rp_logs/compare/v0.3.1...v0.4.0
|
86
100
|
[0.3.1]: https://github.com/xiagu/jekyll-rp_logs/compare/v0.3.0...v0.3.1
|
87
101
|
[0.3.0]: https://github.com/xiagu/jekyll-rp_logs/compare/v0.2.1...v0.3.0
|
@@ -110,3 +124,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
110
124
|
[#28]: https://github.com/xiagu/jekyll-rp_logs/issues/28
|
111
125
|
[#59]: https://github.com/xiagu/jekyll-rp_logs/issues/59
|
112
126
|
[#56]: https://github.com/xiagu/jekyll-rp_logs/issues/56
|
127
|
+
[#47]: https://github.com/xiagu/jekyll-rp_logs/issues/47
|
128
|
+
[#57]: https://github.com/xiagu/jekyll-rp_logs/issues/57
|
129
|
+
[#60]: https://github.com/xiagu/jekyll-rp_logs/issues/60
|
130
|
+
[#67]: https://github.com/xiagu/jekyll-rp_logs/issues/67
|
131
|
+
[#69]: https://github.com/xiagu/jekyll-rp_logs/issues/69
|
data/README.md
CHANGED
@@ -7,17 +7,14 @@
|
|
7
7
|
|
8
8
|
This plugin provides support for building prettified versions of raw RP logs. Extra noise is stripped out during the building to keep the process as simple as possible: paste in entire log, add title and tags, and go.
|
9
9
|
|
10
|
-
The result of building all the test files can be seen here
|
10
|
+
The result of building all the test files can be seen here: http://andrew.rs/projects/jekyll-rp_logs/
|
11
11
|
|
12
12
|
## Table of Contents
|
13
13
|
|
14
14
|
* [Features](#features)
|
15
|
-
* [
|
16
|
-
* [Bundler (Recommended)](#bundler-recommended)
|
17
|
-
* [Manually](#manually)
|
15
|
+
* [Quick Start](#quick-start)
|
18
16
|
* [Updating](#updating)
|
19
17
|
* [Usage](#usage)
|
20
|
-
* [Making a new site](#making-a-new-site)
|
21
18
|
* [Adding RPs](#adding-rps)
|
22
19
|
* [YAML Front Matter](#yaml-front-matter)
|
23
20
|
* [Formatting the logs](#formatting-the-logs)
|
@@ -28,6 +25,7 @@ The result of building all the test files can be seen here. http://andrew.rs/pro
|
|
28
25
|
* [Contributing](#contributing)
|
29
26
|
|
30
27
|
## Features
|
28
|
+
|
31
29
|
* Link to a specific post by its timestamp
|
32
30
|
* Show and hide OOC chatter at will
|
33
31
|
* Responsive layout is readable even on phones
|
@@ -38,40 +36,62 @@ The result of building all the test files can be seen here. http://andrew.rs/pro
|
|
38
36
|
* Tagging and a tag implication/alias system
|
39
37
|
* Tag descriptions
|
40
38
|
|
41
|
-
##
|
39
|
+
## Quick Start
|
42
40
|
|
43
|
-
|
41
|
+
Install the gem with
|
44
42
|
|
45
|
-
|
43
|
+
gem install jekyll-rp_logs
|
46
44
|
|
47
|
-
|
45
|
+
(Installing on Windows will require the [Ruby DevKit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit) to build some of the dependencies.)
|
48
46
|
|
49
|
-
|
47
|
+
Create a new bare-bones Jekyll site to run the RpLogs plugin from:
|
50
48
|
|
51
|
-
|
49
|
+
rplogs init path/to/your/new/site
|
52
50
|
|
53
|
-
|
54
|
-
source 'https://rubygems.org'
|
51
|
+
This will create that directory (it aborts if the given directory is not empty) and set up basic scaffold for your site. After the command finishes running, you should have a structure like this:
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
```
|
54
|
+
path/to/your/new/site
|
55
|
+
├── arcs.html
|
56
|
+
├── _config.yml
|
57
|
+
├── _config.yml.default
|
58
|
+
├── css/
|
59
|
+
│ └── main.scss
|
60
|
+
├── Gemfile
|
61
|
+
├── Gemfile.lock
|
62
|
+
├── _includes/
|
63
|
+
│ ├── footer.html
|
64
|
+
│ ├── header.html
|
65
|
+
│ ├── head.html
|
66
|
+
│ └── rp.html
|
67
|
+
├── index.html
|
68
|
+
├── js/
|
69
|
+
│ └── toggle_ooc.js
|
70
|
+
├── _layouts/
|
71
|
+
│ ├── default.html
|
72
|
+
│ ├── page.html
|
73
|
+
│ ├── post.html
|
74
|
+
│ ├── rp.html
|
75
|
+
│ └── tag_index.html
|
76
|
+
├── _rps/
|
77
|
+
└── _sass/
|
78
|
+
├── _base.scss
|
79
|
+
├── _custom-rules.scss
|
80
|
+
├── _custom-vars.scss
|
81
|
+
├── _layout.scss
|
82
|
+
├── _rp.scss
|
83
|
+
└── _syntax-highlighting.scss
|
59
84
|
```
|
60
85
|
|
61
|
-
|
62
|
-
|
63
|
-
And then execute:
|
64
|
-
|
65
|
-
bundle
|
86
|
+
Edit `_config.yml` and fill in the needed info for your setup.
|
66
87
|
|
67
|
-
|
88
|
+
**Warning:** Don't tell Jekyll to output to a directory that has anything useful in it -- it deletes anything in the `destination` directory whenever you build the site.
|
68
89
|
|
69
|
-
|
70
|
-
Alternatively, install it yourself as:
|
90
|
+
Now you should be ready to build!
|
71
91
|
|
72
|
-
|
92
|
+
bundle exec jekyll build
|
73
93
|
|
74
|
-
|
94
|
+
Building the site should generate an `index.html` in the `destination` directory you configured, along with all the CSS and JS. There won't be any RPs on the index, but it will exist, and have your title and description on it!
|
75
95
|
|
76
96
|
### Updating
|
77
97
|
When a new version of the gem is released, you can update with
|
@@ -80,36 +100,14 @@ When a new version of the gem is released, you can update with
|
|
80
100
|
|
81
101
|
If there were any theme updates that you want to install, you'll have to run
|
82
102
|
|
83
|
-
|
103
|
+
rplogs update
|
84
104
|
|
85
|
-
|
105
|
+
in your site directory. This will overwrite any changes you've made to the default SCSS, includes and index files. `_custom-vars.scss` and `_custom-rules.scss` won't be affected.
|
86
106
|
|
87
107
|
## Usage
|
88
108
|
|
89
|
-
### Making a new site
|
90
|
-
|
91
|
-
To get started with a new site, create a fresh build directory that will be used to hold the Jekyll input files. Here, all of your raw logs, styling, and templates will be stored.
|
92
|
-
|
93
|
-
In this directory, create a file named `Rakefile` and require the gem to get access to its exposed tasks like so:
|
94
|
-
|
95
|
-
echo "require 'jekyll/rp_logs'" > Rakefile
|
96
|
-
|
97
|
-
To set up a Jekyll site skeleton in the current directory, execute:
|
98
|
-
|
99
|
-
rake rp_logs:new
|
100
|
-
|
101
|
-
This will pull in all the necessary files (SASS, `_includes`, default config, etc) for Jekyll to build the site.
|
102
|
-
|
103
|
-
*Important:* To allow Jekyll to actually use the plugin, create a Gemfile as specified above in the [Bundler](#bundler-recommended) section and place it into the build directory.
|
104
|
-
|
105
|
-
Edit `_config.yml` and fill in the needed info for your setup.
|
106
|
-
|
107
|
-
**Warning:** Don't tell Jekyll to output to a directory that has anything useful in it -- it deletes anything in the `destination` directory whenever you build the site.
|
108
|
-
|
109
|
-
Now you should be ready to build!
|
110
|
-
|
111
109
|
### Adding RPs
|
112
|
-
Dump all of the raw logs into the `_rps/` directory of the site.
|
110
|
+
Dump all of the raw logs into the `_rps/` directory of the site. The extension doesn't matter; `.rp` or `.txt` is fine. Don't use `.md` or any other Markdown extension, as that will cause Jekyll to run the file through its Markdown parser (which will take a long time).
|
113
111
|
|
114
112
|
#### YAML Front Matter
|
115
113
|
In order to be picked up and parsed by Jekyll, each file needs a [YAML front matter](http://jekyllrb.com/docs/frontmatter/). One field is required:
|
@@ -123,8 +121,8 @@ These are all optional (they have default values, configurable in `_config.yml`)
|
|
123
121
|
* `complete` - true/false - Whether the RP is finished, or is still incomplete. Incomplete RPs are flagged as such on the index.
|
124
122
|
* `format` - YAML list - What format(s) the logs are in, e.g., `[weechat]`
|
125
123
|
* `rp_tags` - comma separated list - A list of tags that describe the contents, such as characters involved or events that occur.
|
126
|
-
* `start_date` - Any valid YAML date, such as `YYYY-MM-DD
|
127
|
-
* `time_line` - Used to change the order an RP in an Arc is stored in while keeping the displayed start_date correct. Useful if story RPs were done out of order.
|
124
|
+
* `start_date` - Any valid YAML date, such as `YYYY-MM-DD` - Displayed on the RP page, and used to sort in the index. If left blank, will be inferred from the first timestamp.
|
125
|
+
* `time_line` - Any valid YAML date, such as `YYYY-MM-DD` - Used to change the order an RP in an Arc is stored in while keeping the displayed `start_date` correct. Useful if story RPs were done out of order.
|
128
126
|
|
129
127
|
There are also some more options you can toggle. Some are needed for giving the parser more information about oddities in posts, so that it can merge split posts correctly.
|
130
128
|
|
@@ -155,7 +153,7 @@ These flags can be combined.
|
|
155
153
|
### Building the site
|
156
154
|
Run this command:
|
157
155
|
|
158
|
-
|
156
|
+
bundle exec jekyll build
|
159
157
|
|
160
158
|
Optionally, add the `--watch` flag to automatically rebuild if you add more logs. Then get the output to somewhere that's served by a webserver, either by setting your `destination` to something there or by copying it manually.
|
161
159
|
|
@@ -202,18 +200,23 @@ After checking out the repo, run `bin/setup` to install dependencies.
|
|
202
200
|
|
203
201
|
To install this gem onto your local machine, run `rake install`.
|
204
202
|
|
205
|
-
To install the gem and create
|
203
|
+
To install the gem and create a development site to test your changes, run `rake deploy`. This will do a bunch of things:
|
206
204
|
|
207
|
-
* Create the `dev_site
|
208
|
-
*
|
209
|
-
* Run `bundle` and `rake rp_logs:new`
|
205
|
+
* Create the `dev_site/` directory
|
206
|
+
* Run the same task that `rplogs init` calls, setting up a basic site scaffold
|
210
207
|
* Copy test logs from `test/` into the site's `_rps/` directory
|
211
|
-
|
208
|
+
|
209
|
+
To additionally serve it at the same time, run `rake serve`, which will:
|
210
|
+
|
211
|
+
* Run `rake deploy` and do everything mentioned above
|
212
|
+
* Run (in `dev_site/`) `bundle exec jekyll serve` to build and host the site at `localhost:4000` so you can see it!
|
213
|
+
|
214
|
+
You can of course run `bundle exec jekyll serve` yourself if weird stuff starts happening.
|
212
215
|
|
213
216
|
## Contributing
|
214
217
|
|
215
218
|
1. Fork it ( https://github.com/xiagu/jekyll-rp_logs/fork )
|
216
219
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
217
|
-
3. Commit your changes (`git commit -
|
220
|
+
3. Commit your changes (`git commit -av`)
|
218
221
|
4. Push to the branch (`git push origin my-new-feature`)
|
219
222
|
5. Create a new Pull Request
|
data/Rakefile
CHANGED
@@ -1,34 +1,16 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require "jekyll/rp_logs"
|
2
3
|
require "rake/clean"
|
3
4
|
|
4
|
-
|
5
|
+
DEV_SITE_DIR = "dev_site"
|
5
6
|
|
6
|
-
|
7
|
-
File.open(tsk.name, "w") do |f|
|
8
|
-
f << <<-END.gsub(/^\s+\|/, "")
|
9
|
-
|source "https://rubygems.org"
|
10
|
-
|
|
11
|
-
|group :jekyll_plugins do
|
12
|
-
| gem "jekyll-rp_logs"
|
13
|
-
|end
|
14
|
-
END
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
file "dev_site/Rakefile" => "dev_site" do |tsk|
|
19
|
-
File.open(tsk.name, "w") do |f|
|
20
|
-
f << 'require "jekyll/rp_logs"'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
CLEAN.include("dev_site/*")
|
7
|
+
CLEAN.include(DEV_SITE_DIR)
|
25
8
|
|
26
9
|
desc "Create and populate the dev_site directory, ready for building or serving"
|
27
|
-
task deploy:
|
10
|
+
task deploy: %w(clean install) do
|
28
11
|
Bundler.with_clean_env do
|
29
|
-
|
30
|
-
|
31
|
-
sh "bundle exec rake rp_logs:new"
|
12
|
+
Rake::Task["rp_logs:create_new_site"].invoke(DEV_SITE_DIR)
|
13
|
+
Dir.chdir(DEV_SITE_DIR) do
|
32
14
|
# Copy test data in!
|
33
15
|
cp_r "../test/_rps", "."
|
34
16
|
end
|
@@ -36,9 +18,9 @@ task deploy: ["clean", "dev_site", "dev_site/Gemfile", "dev_site/Rakefile", "ins
|
|
36
18
|
end
|
37
19
|
|
38
20
|
desc "Deploys the site to the dev_site directory and serves it for testing"
|
39
|
-
task serve:
|
21
|
+
task serve: :deploy do
|
40
22
|
Bundler.with_clean_env do
|
41
|
-
Dir.chdir(
|
23
|
+
Dir.chdir(DEV_SITE_DIR) do
|
42
24
|
sh "bundle exec jekyll serve --trace --config _config.yml"
|
43
25
|
end
|
44
26
|
end
|
data/exe/rplogs
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "gli"
|
3
|
+
require "jekyll/rp_logs"
|
4
|
+
require "rake"
|
5
|
+
|
6
|
+
# A class to namespace the GLI commands, preventing rake's DSL from conflicting.
|
7
|
+
class RpLogsApp
|
8
|
+
extend GLI::App
|
9
|
+
|
10
|
+
program_desc "Create scaffolding/a skeleton for a Jekyll::RpLogs site"
|
11
|
+
|
12
|
+
version Jekyll::RpLogs::VERSION
|
13
|
+
|
14
|
+
subcommand_option_handling :normal
|
15
|
+
arguments :strict
|
16
|
+
|
17
|
+
desc "Create a scaffold for a new Jekyll::RpLogs site"
|
18
|
+
arg_name "path/to/directory"
|
19
|
+
command :init do |c|
|
20
|
+
c.action do |_, _, args|
|
21
|
+
Rake::Task["rp_logs:create_new_site"].invoke(args[0])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Update the theme of an existing Jekyll::RpLogs site"
|
26
|
+
command :update do |c|
|
27
|
+
c.action do
|
28
|
+
Rake::Task["rp_logs:update_theme"].invoke
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
exit run(ARGV)
|
33
|
+
end
|
data/jekyll-rp_logs.gemspec
CHANGED
@@ -23,13 +23,15 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.add_development_dependency "
|
26
|
+
spec.add_development_dependency "nokogiri", "~> 1.6"
|
27
27
|
spec.add_development_dependency "rspec", "~> 3"
|
28
28
|
spec.add_development_dependency "simplecov", "~> 0.9"
|
29
29
|
spec.add_development_dependency "codeclimate-test-reporter"
|
30
30
|
|
31
|
+
spec.add_runtime_dependency "bundler", "~> 1.8"
|
31
32
|
spec.add_runtime_dependency "jekyll", "~> 2.5"
|
32
33
|
spec.add_runtime_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_runtime_dependency "gli", "~> 2.13"
|
33
35
|
|
34
36
|
spec.required_ruby_version = "~> 2.1"
|
35
37
|
end
|
data/lib/jekyll/rp_logs.rb
CHANGED
@@ -11,7 +11,7 @@ require "jekyll/rp_logs/rp_log_converter"
|
|
11
11
|
require "jekyll/rp_logs/rp_tag_index"
|
12
12
|
|
13
13
|
# Now require all of the parsers
|
14
|
-
Gem.find_files("jekyll/rp_logs/
|
14
|
+
Gem.find_files("jekyll/rp_logs/parsers/*.rb").each { |path| require path }
|
15
15
|
|
16
16
|
# Require the rake tasks
|
17
17
|
require "jekyll/rp_logs/rp_tasks"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -43,6 +43,11 @@ module Jekyll
|
|
43
43
|
def generate(site)
|
44
44
|
return unless site.config["rp_convert"]
|
45
45
|
|
46
|
+
# There doesn't seem to be a better way to add this to all pages than
|
47
|
+
# by modifying the configuration file, which is added onto the `site`
|
48
|
+
# liquid variable.
|
49
|
+
site.config["rp_logs_version"] = RpLogs::VERSION
|
50
|
+
|
46
51
|
main_index, arc_index = extract_indexes(site)
|
47
52
|
|
48
53
|
disable_liquid_rendering(site)
|
@@ -106,49 +111,60 @@ module Jekyll
|
|
106
111
|
# Convert all of the posts to be pretty
|
107
112
|
# Also build up our hash of tags
|
108
113
|
rp_pages.each do |page|
|
109
|
-
|
110
|
-
# Skip if something goes wrong
|
111
|
-
next unless convert_rp(site, page)
|
112
|
-
|
113
|
-
key = page[:canon] ? "canon" : "noncanon"
|
114
|
-
# Add key for canon/noncanon
|
115
|
-
main_index.data["rps"][key] << page
|
116
|
-
# Add tag for canon/noncanon
|
117
|
-
page[:rp_tags] << (Tag.new key)
|
118
|
-
page[:rp_tags].sort!
|
119
|
-
|
120
|
-
arc_name = page[:arc_name]
|
121
|
-
if arc_name && !arc_name.empty?
|
122
|
-
arc_name.each { |n| arcs[n] << page }
|
123
|
-
else
|
124
|
-
no_arc_rps << page
|
125
|
-
end
|
126
|
-
|
127
|
-
Jekyll.logger.debug "Converted #{page.basename}"
|
128
|
-
rescue
|
129
|
-
# Catch all for any other exception encountered when parsing a page
|
130
|
-
skip_page(site, page, "Error parsing #{page.basename}: #{$ERROR_INFO.inspect}")
|
131
|
-
# Raise exception, so Jekyll prints backtrace if run with --trace
|
132
|
-
raise $ERROR_INFO
|
133
|
-
end
|
114
|
+
convert_page(page, site, main_index, arcs, no_arc_rps)
|
134
115
|
end
|
135
116
|
|
136
|
-
Jekyll.logger.info
|
117
|
+
Jekyll.logger.info(
|
118
|
+
"#{site.collections[rp_key].docs.size} RPs converted.")
|
119
|
+
|
120
|
+
sort_arcs(arcs, no_arc_rps, arc_index)
|
121
|
+
sort_chronologically! main_index.data["rps"]["canon"]
|
122
|
+
sort_chronologically! main_index.data["rps"]["noncanon"]
|
123
|
+
end
|
124
|
+
|
125
|
+
def convert_page(page, site, main_index, arcs, no_arc_rps)
|
126
|
+
# Skip if something goes wrong
|
127
|
+
return unless convert_rp(site, page)
|
128
|
+
|
129
|
+
key = page.canon
|
130
|
+
# Add key for canon/noncanon
|
131
|
+
main_index.data["rps"][key] << page
|
132
|
+
# Add tag for canon/noncanon
|
133
|
+
page[:rp_tags] << (Tag.new key)
|
134
|
+
page[:rp_tags].sort!
|
135
|
+
|
136
|
+
arc_name = page[:arc_name]
|
137
|
+
if arc_name && !arc_name.empty?
|
138
|
+
arc_name.each { |n| arcs[n] << page }
|
139
|
+
else
|
140
|
+
no_arc_rps << page
|
141
|
+
end
|
137
142
|
|
143
|
+
Jekyll.logger.debug "Converted #{page.basename}"
|
144
|
+
rescue
|
145
|
+
# Catch all for any other exception encountered when parsing a page
|
146
|
+
skip_page(site, page,
|
147
|
+
"Error parsing #{page.basename}: #{$ERROR_INFO.inspect}")
|
148
|
+
# Raise exception, so Jekyll prints backtrace if run with --trace
|
149
|
+
raise $ERROR_INFO
|
150
|
+
end
|
151
|
+
|
152
|
+
def sort_arcs(arcs, no_arc_rps, arc_index)
|
138
153
|
arcs.each_key { |key| sort_chronologically! arcs[key].rps }
|
139
|
-
|
140
|
-
|
154
|
+
arc_index.data["rps"] = sort_arcs_and_pages(arcs, no_arc_rps)
|
155
|
+
end
|
156
|
+
|
157
|
+
def sort_arcs_and_pages(arcs, no_arc_rps)
|
158
|
+
combined_rps = no_arc_rps.map { |x| ["rp", x] } +
|
159
|
+
arcs.values.map { |x| ["arc", x] }
|
160
|
+
combined_rps.sort_by! do |type, x|
|
141
161
|
case type
|
142
162
|
when "rp"
|
143
163
|
x[:time_line] || x[:start_date]
|
144
164
|
when "arc"
|
145
165
|
x.start_date
|
146
166
|
end
|
147
|
-
|
148
|
-
arc_index.data["rps"] = combined_rps
|
149
|
-
|
150
|
-
sort_chronologically! main_index.data["rps"]["canon"]
|
151
|
-
sort_chronologically! main_index.data["rps"]["noncanon"]
|
167
|
+
end.reverse!
|
152
168
|
end
|
153
169
|
|
154
170
|
def sort_chronologically!(pages)
|
@@ -84,15 +84,15 @@ module Jekyll
|
|
84
84
|
title = @timestamp.strftime("%H:%M:%S %B %-d, %Y")
|
85
85
|
# String actually displayed on page
|
86
86
|
display = @timestamp.strftime("%H:%M")
|
87
|
-
"<a name=\"#{anchor}\" title=\"#{title}\" href=\"##{anchor}\">#{display}</a>"
|
87
|
+
"<a name=\"#{anchor}\" title=\"#{title}\" href=\"##{anchor}\">#{display} </a>"
|
88
88
|
end
|
89
89
|
|
90
90
|
def output_sender
|
91
91
|
case @base_type
|
92
92
|
when :rp
|
93
|
-
return "
|
93
|
+
return "#{@sender}"
|
94
94
|
when :ooc
|
95
|
-
return "
|
95
|
+
return "<#{@mode}#{@sender}>"
|
96
96
|
else
|
97
97
|
# Explode.
|
98
98
|
fail "No known type: #{@base_type}"
|
@@ -2,52 +2,13 @@ require "rake"
|
|
2
2
|
|
3
3
|
module Jekyll
|
4
4
|
module RpLogs
|
5
|
+
##
|
6
|
+
# Loads the gem's built-in rake tasks from tasks/rp_logs.rake
|
5
7
|
class RpTasks
|
6
8
|
include Rake::DSL if defined? Rake::DSL
|
7
9
|
|
8
|
-
def copy_unless_exist(from, to, message = nil)
|
9
|
-
unless File.exist?(to)
|
10
|
-
puts message if message
|
11
|
-
cp from, to
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# Octopress
|
16
|
-
def get_stdin(message)
|
17
|
-
print message
|
18
|
-
STDIN.gets.chomp
|
19
|
-
end
|
20
|
-
|
21
|
-
# Octopress
|
22
|
-
def ask(message, valid_options)
|
23
|
-
if valid_options
|
24
|
-
answer = get_stdin("#{message} #{valid_options.to_s.gsub(/"/, '').gsub(/, /, '/')} ") until valid_options.include?(answer)
|
25
|
-
else
|
26
|
-
answer = get_stdin(message)
|
27
|
-
end
|
28
|
-
answer
|
29
|
-
end
|
30
|
-
|
31
10
|
def install_tasks
|
32
|
-
|
33
|
-
directory "_rps"
|
34
|
-
|
35
|
-
desc "Create a new Jekyll site for RP logs, with the default theme"
|
36
|
-
task :new do
|
37
|
-
if File.directory?("_sass")
|
38
|
-
abort("rake aborted!") if ask("A theme is already installed, proceeding will overwrite existing non-custom files. Are you sure?", ['y', 'n']) == 'n'
|
39
|
-
end
|
40
|
-
|
41
|
-
Rake::Task[:_rps].invoke
|
42
|
-
# allow directory specification
|
43
|
-
|
44
|
-
gem_root = Gem::Specification.find_by_name("jekyll-rp_logs").gem_dir
|
45
|
-
cp_r Dir["#{gem_root}/.themes/default/source/*"], "./"
|
46
|
-
copy_unless_exist("_config.yml.default", "_config.yml")
|
47
|
-
touch "_sass/_custom-vars.scss"
|
48
|
-
touch "_sass/_custom-rules.scss"
|
49
|
-
end
|
50
|
-
end
|
11
|
+
load "tasks/rp_logs.rake"
|
51
12
|
end
|
52
13
|
end
|
53
14
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
Y_OR_N = %w(y n)
|
2
|
+
NO = "n"
|
3
|
+
|
4
|
+
def copy_unless_exist(from, to, message = nil)
|
5
|
+
return if File.exist?(to)
|
6
|
+
puts message if message
|
7
|
+
cp from, to
|
8
|
+
end
|
9
|
+
|
10
|
+
# Octopress
|
11
|
+
def get_stdin(message)
|
12
|
+
print message
|
13
|
+
STDIN.gets.chomp
|
14
|
+
end
|
15
|
+
|
16
|
+
# Octopress
|
17
|
+
def ask(message, valid_options = Y_OR_N)
|
18
|
+
if valid_options
|
19
|
+
valid_str = valid_options.to_s.delete('"').gsub(/, /, "/")
|
20
|
+
answer = get_stdin("#{message} #{valid_str} ") until valid_options.include?(answer)
|
21
|
+
else
|
22
|
+
answer = get_stdin(message)
|
23
|
+
end
|
24
|
+
answer
|
25
|
+
end
|
26
|
+
|
27
|
+
namespace :rp_logs do
|
28
|
+
desc "Create a new Jekyll site for RP logs, with the default theme"
|
29
|
+
task :create_new_site, [:dir] => [:site_dir] do |_task, args|
|
30
|
+
Dir.chdir(args[:dir]) do
|
31
|
+
Rake::Task["rp_logs:bundler"].invoke
|
32
|
+
Rake::Task["rp_logs:copy_theme"].invoke
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
task :site_dir, [:dir] do |_task, args|
|
37
|
+
if Dir.exist? args[:dir]
|
38
|
+
if (Dir.entries(args[:dir]) - %w(. ..)).empty?
|
39
|
+
puts "Using empty directory #{args[:dir]}"
|
40
|
+
else
|
41
|
+
fail "Directory #{args[:dir]} already exists, and is non-empty. Won't overwrite."
|
42
|
+
end
|
43
|
+
else
|
44
|
+
mkdir_p args[:dir]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
directory "_rps"
|
49
|
+
|
50
|
+
file "Gemfile" do |tsk|
|
51
|
+
File.open(tsk.name, "w") do |f|
|
52
|
+
f << <<-END.gsub(/^\s+\|/, "")
|
53
|
+
|source "https://rubygems.org"
|
54
|
+
|
|
55
|
+
|group :jekyll_plugins do
|
56
|
+
| gem "jekyll-rp_logs"
|
57
|
+
|end
|
58
|
+
END
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
task bundler: "Gemfile" do
|
63
|
+
sh "bundle"
|
64
|
+
end
|
65
|
+
|
66
|
+
task copy_theme: :_rps do
|
67
|
+
gem_root = Gem::Specification.find_by_name("jekyll-rp_logs").gem_dir
|
68
|
+
cp_r Dir["#{gem_root}/.themes/default/source/*"], "./"
|
69
|
+
copy_unless_exist("_config.yml.default", "_config.yml")
|
70
|
+
touch "_sass/_custom-vars.scss"
|
71
|
+
touch "_sass/_custom-rules.scss"
|
72
|
+
end
|
73
|
+
|
74
|
+
task :update_theme do
|
75
|
+
if !File.exist?("_config.yml")
|
76
|
+
abort("Didn't install theme.") if ask("No _config.yml found. This may not be a Jekyll site directory. Install theme anyway?") == NO
|
77
|
+
elsif File.exist?("_sass")
|
78
|
+
abort("Kept existing theme.") if ask("A theme is already installed. Overwrite existing non-custom files?") == NO
|
79
|
+
end
|
80
|
+
Rake::Task["rp_logs:copy_theme"].invoke
|
81
|
+
end
|
82
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-rp_logs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anrodger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.6'
|
20
20
|
type: :development
|
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: '1.
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.8'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.8'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: jekyll
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,10 +108,25 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '10.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: gli
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.13'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.13'
|
97
125
|
description:
|
98
126
|
email:
|
99
127
|
- me@andrew.rs
|
100
|
-
executables:
|
128
|
+
executables:
|
129
|
+
- rplogs
|
101
130
|
extensions: []
|
102
131
|
extra_rdoc_files: []
|
103
132
|
files:
|
@@ -111,6 +140,7 @@ files:
|
|
111
140
|
- ".themes/default/source/_includes/head.html"
|
112
141
|
- ".themes/default/source/_includes/header.html"
|
113
142
|
- ".themes/default/source/_includes/rp.html"
|
143
|
+
- ".themes/default/source/_includes/rp_line.html"
|
114
144
|
- ".themes/default/source/_layouts/default.html"
|
115
145
|
- ".themes/default/source/_layouts/page.html"
|
116
146
|
- ".themes/default/source/_layouts/post.html"
|
@@ -132,13 +162,14 @@ files:
|
|
132
162
|
- Rakefile
|
133
163
|
- bin/console
|
134
164
|
- bin/setup
|
165
|
+
- exe/rplogs
|
135
166
|
- jekyll-rp_logs.gemspec
|
136
167
|
- lib/jekyll/rp_logs.rb
|
137
|
-
- lib/jekyll/rp_logs/
|
138
|
-
- lib/jekyll/rp_logs/
|
139
|
-
- lib/jekyll/rp_logs/
|
140
|
-
- lib/jekyll/rp_logs/
|
141
|
-
- lib/jekyll/rp_logs/
|
168
|
+
- lib/jekyll/rp_logs/parsers/irssi_xchat.rb
|
169
|
+
- lib/jekyll/rp_logs/parsers/mirc.rb
|
170
|
+
- lib/jekyll/rp_logs/parsers/skype_12hour.rb
|
171
|
+
- lib/jekyll/rp_logs/parsers/skype_24hour.rb
|
172
|
+
- lib/jekyll/rp_logs/parsers/weechat.rb
|
142
173
|
- lib/jekyll/rp_logs/rp_arcs.rb
|
143
174
|
- lib/jekyll/rp_logs/rp_log_converter.rb
|
144
175
|
- lib/jekyll/rp_logs/rp_logline.rb
|
@@ -149,6 +180,7 @@ files:
|
|
149
180
|
- lib/jekyll/rp_logs/rp_tags.rb
|
150
181
|
- lib/jekyll/rp_logs/rp_tasks.rb
|
151
182
|
- lib/jekyll/rp_logs/version.rb
|
183
|
+
- lib/tasks/rp_logs.rake
|
152
184
|
homepage: https://github.com/xiagu/jekyll-rp_logs
|
153
185
|
licenses:
|
154
186
|
- MIT
|