jekyll-rp_logs 0.1.6 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +46 -0
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/.rubocop.yml +2 -0
- data/.themes/default/source/_config.yml.default +13 -3
- data/.travis.yml +9 -0
- data/CHANGELOG.md +55 -0
- data/README.md +85 -32
- data/Rakefile +42 -5
- data/jekyll-rp_logs.gemspec +6 -1
- data/lib/jekyll/rp_logs/parse_irssi_xchat.rb +35 -37
- data/lib/jekyll/rp_logs/parse_mirc.rb +40 -42
- data/lib/jekyll/rp_logs/parse_skype_12hour.rb +33 -45
- data/lib/jekyll/rp_logs/parse_skype_24hour.rb +33 -41
- data/lib/jekyll/rp_logs/parse_weechat.rb +36 -36
- data/lib/jekyll/rp_logs/rp_arcs.rb +13 -16
- data/lib/jekyll/rp_logs/rp_log_converter.rb +140 -117
- data/lib/jekyll/rp_logs/rp_logline.rb +225 -0
- data/lib/jekyll/rp_logs/rp_page.rb +63 -0
- data/lib/jekyll/rp_logs/rp_parser.rb +9 -103
- data/lib/jekyll/rp_logs/rp_tag_index.rb +18 -20
- data/lib/jekyll/rp_logs/rp_tasks.rb +5 -6
- data/lib/jekyll/rp_logs/version.rb +1 -1
- data/lib/jekyll/rp_logs.rb +4 -5
- metadata +53 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b50e2e5ddc01c17271bd3f5fdc368bf2138c0063
|
4
|
+
data.tar.gz: ed204ce52ae1b9b0c117a5de0cd09495d28b1bef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b74f2fbe01956091be2536021c7022031dece3260fac9acfa1dee28d22b6c7a8f7a2758671115650d72c9e99debadb66cc37716dd8680cf63373ef8af91d3ec
|
7
|
+
data.tar.gz: 1b82113c2a20f972992af4d6bcc2966e98379eb44ae4551b3500265d8d623902d5943fda3095b3b0191c6e9cd34e453c00822b2e8e13da13787938f28ca4d9f1
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# This is a sample .codeclimate.yml configured for Engine analysis on Code
|
2
|
+
# Climate Platform. For an overview of the Code Climate Platform, see here:
|
3
|
+
# http://docs.codeclimate.com/article/300-the-codeclimate-platform
|
4
|
+
|
5
|
+
# Under the engines key, you can configure which engines will analyze your repo.
|
6
|
+
# Each key is an engine name. For each value, you need to specify enabled: true
|
7
|
+
# to enable the engine as well as any other engines-specific configuration.
|
8
|
+
|
9
|
+
# For more details, see here:
|
10
|
+
# http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
|
11
|
+
|
12
|
+
# For a list of all available engines, see here:
|
13
|
+
# http://docs.codeclimate.com/article/296-engines-available-engines
|
14
|
+
|
15
|
+
engines:
|
16
|
+
# to turn on an engine, add it here and set enabled to `true`
|
17
|
+
# to turn off an engine, set enabled to `false` or remove it
|
18
|
+
rubocop:
|
19
|
+
enabled: true
|
20
|
+
eslint:
|
21
|
+
enabled: true
|
22
|
+
csslint:
|
23
|
+
enabled: true
|
24
|
+
|
25
|
+
# Engines can analyze files and report issues on them, but you can separately
|
26
|
+
# decide which files will receive ratings based on those issues. This is
|
27
|
+
# specified by path patterns under the ratings key.
|
28
|
+
|
29
|
+
# For more details see here:
|
30
|
+
# http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
|
31
|
+
|
32
|
+
# Note: If the ratings key is not specified, this will result in a 0.0 GPA on your dashboard.
|
33
|
+
|
34
|
+
ratings:
|
35
|
+
paths:
|
36
|
+
- lib/**
|
37
|
+
- "**.rb"
|
38
|
+
- .themes/default/source/_sass/*
|
39
|
+
- .themes/default/source/js/*
|
40
|
+
|
41
|
+
# You can globally exclude files from being analyzed by any engine using the
|
42
|
+
# exclude_paths key.
|
43
|
+
|
44
|
+
exclude_paths:
|
45
|
+
- spec/**/*
|
46
|
+
# - vendor/**/*
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -14,7 +14,7 @@ destination: _site
|
|
14
14
|
|
15
15
|
# Build settings
|
16
16
|
markdown: kramdown
|
17
|
-
exclude:
|
17
|
+
exclude:
|
18
18
|
- LICENSE
|
19
19
|
- README.md
|
20
20
|
- Gemfile
|
@@ -30,10 +30,20 @@ rp_tag_dir: /tags
|
|
30
30
|
rp_tag_index_layout: tag_index
|
31
31
|
rp_tag_title_prefix: "RPs tagged "
|
32
32
|
|
33
|
+
# The max number of seconds between two mergeable lines. Lines further apart
|
34
|
+
# in time than this will not be merged.
|
35
|
+
max_seconds_between_posts: 3
|
36
|
+
|
37
|
+
# All characters that can denote the beginning of an OOC line, for the purposes
|
38
|
+
# of strict_ooc and automatically converting OOC emotes to OOC text.
|
39
|
+
ooc_start_delimiters: "(["
|
40
|
+
|
33
41
|
collections:
|
34
42
|
# The RPs must be in a directory named exactly this, prefixed by an underscore.
|
35
|
-
# So by default: _rps/
|
36
|
-
#
|
43
|
+
# So by default: _rps/
|
44
|
+
# This entry must be the first in the collections map, if you need to add
|
45
|
+
# more collections for some reason. Don't forget to update the `type` down
|
46
|
+
# below if you change this.
|
37
47
|
rps:
|
38
48
|
output: true
|
39
49
|
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
|
5
|
+
## [0.2.0] - 2015-10-26
|
6
|
+
### Added
|
7
|
+
- The RP log directory can now be renamed ([#15])
|
8
|
+
- Two config options to control the inner workings of the plugin: ([#38])
|
9
|
+
- `max_seconds_between_posts` - for the time limit on post merges
|
10
|
+
- `ooc_start_delimiters` - for what characters denote the start of OOC text ([#25])
|
11
|
+
- `splits_by_character` setting to correctly handle clients that don't split by word ([#23])
|
12
|
+
- Informational messages when converting RPs (can be quieted using Jekyll's config settings) ([#31])
|
13
|
+
- Unit tests for most files, making development a lot easier
|
14
|
+
- `time_line` option to allow RPs to be custom sorted inside arcs
|
15
|
+
- Set up code linting with [RuboCop](https://github.com/bbatsov/rubocop)
|
16
|
+
- Set up [Travis CI testing](https://travis-ci.org/xiagu/jekyll-rp_logs) and code coverage + [CodeClimate](https://codeclimate.com/github/xiagu/jekyll-rp_logs) ([#18])
|
17
|
+
- `!MERGE` flag to force lines to merge ([#8])
|
18
|
+
- `!SPLIT` flag to force lines to stay separate ([#7])
|
19
|
+
- Rake task `deploy` to set up a development site ([#4])
|
20
|
+
- Rake task `serve` to deploy and then serve a development site ([#4])
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
- Instead of just `(`, `[` now denotes OOC by default too ([#25])
|
24
|
+
- Warnings when errors are encountered now use Jekyll's logger
|
25
|
+
- Switched to using a wrapper class, `Jekyll::RpLogs::Page`, instead of just raw `Jekyll::Page`
|
26
|
+
- `Parser` now has default values for some regular expression matchers that are commonly used:
|
27
|
+
- `MODE`, `NICKS`, and `FLAGS`
|
28
|
+
- Double quotes are used (nearly) universally
|
29
|
+
|
30
|
+
### Removed
|
31
|
+
- `LogLine` is no longer an inner class of `Parser`. This will break any custom parsers written.
|
32
|
+
- Most methods of `RpLogGenerator` are private now, but this shouldn't break anything unless you were doing naughty things with it.
|
33
|
+
|
34
|
+
### Fixed
|
35
|
+
- Clients who split posts in the middle of words can be handled correctly now ([#23])
|
36
|
+
- The RP log directory is renameable again ([#15])
|
37
|
+
- You can actually turn off conversion now
|
38
|
+
- Special HTML characters are escaped in input text ([#11])
|
39
|
+
- The time difference in merged lines needs to be non-negative
|
40
|
+
- Set required Ruby version to `~> 2.1` ([#32])
|
41
|
+
|
42
|
+
|
43
|
+
[0.2.0]: https://github.com/xiagu/jekyll-rp_logs/compare/v0.1.6...v0.2.0
|
44
|
+
|
45
|
+
[#11]: https://github.com/xiagu/jekyll-rp_logs/issues/11
|
46
|
+
[#15]: https://github.com/xiagu/jekyll-rp_logs/issues/15
|
47
|
+
[#23]: https://github.com/xiagu/jekyll-rp_logs/issues/23
|
48
|
+
[#25]: https://github.com/xiagu/jekyll-rp_logs/issues/25
|
49
|
+
[#31]: https://github.com/xiagu/jekyll-rp_logs/issues/31
|
50
|
+
[#32]: https://github.com/xiagu/jekyll-rp_logs/issues/32
|
51
|
+
[#18]: https://github.com/xiagu/jekyll-rp_logs/issues/18
|
52
|
+
[#38]: https://github.com/xiagu/jekyll-rp_logs/issues/38
|
53
|
+
[#8]: https://github.com/xiagu/jekyll-rp_logs/issues/8
|
54
|
+
[#7]: https://github.com/xiagu/jekyll-rp_logs/issues/7
|
55
|
+
[#4]: https://github.com/xiagu/jekyll-rp_logs/issues/4
|
data/README.md
CHANGED
@@ -1,13 +1,36 @@
|
|
1
1
|
# Jekyll::RpLogs
|
2
2
|
|
3
|
+
[](https://travis-ci.org/xiagu/web-character-sheets)
|
4
|
+
[](https://codeclimate.com/github/xiagu/jekyll-rp_logs/coverage)
|
5
|
+
[](https://codeclimate.com/github/xiagu/jekyll-rp_logs)
|
6
|
+
[](http://badge.fury.io/rb/jekyll-rp_logs)
|
7
|
+
|
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
|
+
|
10
|
+
The result of building all the test files can be seen here. http://andrew.rs/projects/jekyll-rp_logs/
|
11
|
+
|
12
|
+
## Features
|
13
|
+
* Link to a specific post by its timestamp
|
14
|
+
* Show and hide OOC chatter at will
|
15
|
+
* Responsive layout is readable even on phones
|
16
|
+
* Can be extended to support more log formats via custom parsers (pull requests welcome!)
|
17
|
+
* Supports multiple formats per file, for those times where you switched IRC clients in the middle of something. Or moved from IRC to Skype, or vice versa.
|
18
|
+
* Infers characters involved in each RP by the nicks speaking
|
19
|
+
* Generates a static site that can be hosted anywhere, without needing to run anything more than a web server
|
20
|
+
|
3
21
|
## Installation
|
4
22
|
|
5
|
-
### Bundler
|
6
|
-
|
23
|
+
### Bundler (Recommended)
|
24
|
+
|
25
|
+
Install the bundle gem with
|
26
|
+
|
27
|
+
gem install bundle
|
28
|
+
|
29
|
+
Create a file named `Gemfile` with the following contents:
|
7
30
|
|
8
31
|
```ruby
|
9
32
|
source 'https://rubygems.org'
|
10
|
-
|
33
|
+
|
11
34
|
group :jekyll_plugins do
|
12
35
|
gem "jekyll-rp_logs"
|
13
36
|
end
|
@@ -17,50 +40,43 @@ end
|
|
17
40
|
|
18
41
|
And then execute:
|
19
42
|
|
20
|
-
|
43
|
+
bundle
|
21
44
|
|
22
45
|
The Gemfile group will tell Jekyll to load the gem, and let you keep it up to date easily with Bundler.
|
23
46
|
|
24
47
|
### Manually
|
25
48
|
Alternatively, install it yourself as:
|
26
49
|
|
27
|
-
|
50
|
+
gem install jekyll-rp_logs
|
28
51
|
|
29
52
|
In this case you'll need to tell Jekyll to load the gem somehow, such as option 2 on the [Installing a plugin](http://jekyllrb.com/docs/plugins/#installing-a-plugin) instructions.
|
30
53
|
|
31
54
|
## Usage
|
32
55
|
|
33
56
|
### Making a new site
|
34
|
-
Require the gem in your Rakefile to get access to its exposed tasks:
|
35
|
-
|
36
|
-
echo "require 'jekyll/rp_logs'" >> Rakefile
|
37
57
|
|
38
|
-
To
|
58
|
+
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.
|
39
59
|
|
40
|
-
|
60
|
+
In this directory, create a file named `Rakefile` and require the gem to get access to its exposed tasks like so:
|
41
61
|
|
42
|
-
|
62
|
+
echo "require 'jekyll/rp_logs'" > Rakefile
|
43
63
|
|
44
|
-
|
64
|
+
To set up a Jekyll site skeleton in the current directory, execute:
|
45
65
|
|
46
|
-
|
47
|
-
Run this command:
|
48
|
-
|
49
|
-
jekyll build
|
66
|
+
rake rp_logs:new
|
50
67
|
|
51
|
-
|
68
|
+
This will pull in all the necessary files (SASS, `_includes`, default config, etc) for Jekyll to build the site.
|
52
69
|
|
53
|
-
|
70
|
+
*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.
|
54
71
|
|
55
|
-
|
56
|
-
Dump all of them into the `_rps/` directory of the site.
|
72
|
+
Edit `_config.yml` and fill in the needed info for your setup.
|
57
73
|
|
58
|
-
|
74
|
+
**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.
|
59
75
|
|
60
|
-
|
76
|
+
Now you should be ready to build!
|
61
77
|
|
62
|
-
|
63
|
-
|
78
|
+
### Adding RPs
|
79
|
+
Dump all of the raw logs into the `_rps/` directory of the site.
|
64
80
|
|
65
81
|
#### YAML Front Matter
|
66
82
|
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:
|
@@ -69,28 +85,65 @@ In order to be picked up and parsed by Jekyll, each file needs a [YAML front mat
|
|
69
85
|
|
70
86
|
These are all optional (they have default values, configurable in `_config.yml`):
|
71
87
|
|
72
|
-
* `
|
88
|
+
* `arc_name` - YAML list - names of story arcs that the RP belongs to
|
73
89
|
* `canon` - true/false - Whether the RP is considered canonical (whatever that means to you). Sorts RPs into one of two categories in the index.
|
74
90
|
* `complete` - true/false - Whether the RP is finished, or is still incomplete. Incomplete RPs are flagged as such on the index.
|
75
91
|
* `format` - YAML list - What format(s) the logs are in, e.g., `[weechat]`
|
76
92
|
* `rp_tags` - comma separated list - A list of tags that describe the contents, such as characters involved or events that occur.
|
77
|
-
* `
|
93
|
+
* `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.
|
78
94
|
|
79
|
-
There are also some more options you can toggle
|
95
|
+
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.
|
80
96
|
|
81
|
-
* `strict_ooc` - true/false - If true, only lines beginning with `(` are considered OOC by default.
|
82
|
-
* `merge_text_into_rp` - YAML list - A list of nicks whose clients split actions into normal text, like [IRCCloud did for a while](https://twitter.com/XiaguZ/status/590773722593763328).
|
83
97
|
* `infer_char_tags` - true/false - If false, don't infer the characters in the RP by the nicks who do emotes.
|
98
|
+
* `merge_text_into_rp` - YAML list - A list of nicks whose clients split actions into normal text, like [IRCCloud did for a while](https://twitter.com/XiaguZ/status/590773722593763328).
|
99
|
+
* `splits_by_character` - YAML list - A list of nicks whose clients split posts by characters and not by words. (For example, splitting "hello" into "hel" "lo".)
|
100
|
+
* `strict_ooc` - true/false - If true, only lines beginning with `(` are considered OOC by default.
|
101
|
+
|
102
|
+
#### Formatting the logs
|
103
|
+
The goal of this plugin is to make updating logs as easy and painless as possible. The goal is to be able to paste a log in, add trivial metadata at the top, and be good to go. Here's everything the plugin does for you so you don't have to:
|
104
|
+
* All joins, parts, and quits are stripped, so you don't have to bother pulling those out
|
105
|
+
* All lines that are emotes (`/me`) are interpreted as RP, and all other lines are OOC by default
|
106
|
+
* Lines starting with `(` or `[` are interpreted as OOC, even if they're an emote. (These characters are configurable in `_config.yml`.)
|
107
|
+
* Consecutive posts from the same person with timestamps less than or equal to 3 seconds apart are merged together. (The exact amount of time is configurable in `_config.yml`.)
|
108
|
+
|
109
|
+
To flag an OOC line as RP, or vice versa, use
|
110
|
+
|
111
|
+
* `!RP ` before the timestamp to manually flag the line as RP
|
112
|
+
* `!OOC ` before the timestamp to manually flag the line as OOC
|
113
|
+
|
114
|
+
To force a line to be merged, or prevent it from being merged, use
|
115
|
+
|
116
|
+
* `!MERGE ` before the timestamp to force the line to be merged into the previous one, regardless of the time between them
|
117
|
+
* `!SPLIT ` before the timestamp to force the line to be kept separate from the previous one, regardless of the time between them
|
118
|
+
|
119
|
+
These flags can be combined.
|
120
|
+
|
121
|
+
### Building the site
|
122
|
+
Run this command:
|
123
|
+
|
124
|
+
jekyll build
|
125
|
+
|
126
|
+
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.
|
127
|
+
|
128
|
+
**Warning again:** Destination folders are cleaned whenever Jekyll builds the site. Seriously, don't tell Jekyll to output to a directory that has anything useful in it.
|
84
129
|
|
85
130
|
## Development
|
86
131
|
|
87
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
132
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
133
|
+
|
134
|
+
To install this gem onto your local machine, run `rake install`.
|
135
|
+
|
136
|
+
To install the gem and create, then serve a development site to test your changes, run `rake deploy`. This will do a bunch of things:
|
88
137
|
|
89
|
-
|
138
|
+
* Create the `dev_site` directory
|
139
|
+
* Populate it with a `Gemfile` and `Rakefile` as mentioned in the installation instructions
|
140
|
+
* Run `bundle` and `rake rp_logs:new`
|
141
|
+
* Copy test logs from `test/` into the site's `_rps/` directory
|
142
|
+
* Run `jekyll serve` to build and host the site at `localhost:4000` so you can see it!
|
90
143
|
|
91
144
|
## Contributing
|
92
145
|
|
93
|
-
1. Fork it ( https://github.com/
|
146
|
+
1. Fork it ( https://github.com/xiagu/jekyll-rp_logs/fork )
|
94
147
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
95
148
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
96
149
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/Rakefile
CHANGED
@@ -1,8 +1,45 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require "rake/clean"
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
directory "dev_site"
|
5
|
+
|
6
|
+
file "dev_site/Gemfile" => "dev_site" do |tsk|
|
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/*")
|
25
|
+
|
26
|
+
desc "Create and populate the dev_site directory, ready for building or serving"
|
27
|
+
task deploy: ["clean", "dev_site", "dev_site/Gemfile", "dev_site/Rakefile", "install"] do
|
28
|
+
Bundler.with_clean_env do
|
29
|
+
Dir.chdir("dev_site") do
|
30
|
+
sh "bundle --quiet"
|
31
|
+
sh "bundle exec rake rp_logs:new"
|
32
|
+
# Copy test data in!
|
33
|
+
cp_r "../test/_rps", "."
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Deploys the site to the dev_site directory and serves it for testing"
|
39
|
+
task serve: ["deploy"] do
|
40
|
+
Bundler.with_clean_env do
|
41
|
+
Dir.chdir("dev_site") do
|
42
|
+
sh "bundle exec jekyll serve --trace --config _config.yml"
|
43
|
+
end
|
44
|
+
end
|
8
45
|
end
|
data/jekyll-rp_logs.gemspec
CHANGED
@@ -18,13 +18,18 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.homepage = "https://github.com/xiagu/jekyll-rp_logs"
|
19
19
|
spec.license = "MIT"
|
20
20
|
|
21
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|dev_site)/}) }
|
22
22
|
spec.bindir = "exe"
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.8"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3"
|
28
|
+
spec.add_development_dependency "simplecov", "~> 0.9"
|
29
|
+
spec.add_development_dependency "codeclimate-test-reporter"
|
27
30
|
|
28
31
|
spec.add_runtime_dependency "jekyll", "~> 2.5"
|
29
32
|
spec.add_runtime_dependency "rake", "~> 10.0"
|
33
|
+
|
34
|
+
spec.required_ruby_version = "~> 2.1"
|
30
35
|
end
|
@@ -1,47 +1,45 @@
|
|
1
1
|
module Jekyll
|
2
2
|
module RpLogs
|
3
|
-
|
4
3
|
class IrssiXChatParser < RpLogs::Parser
|
5
|
-
|
6
4
|
# Add this class to the parsing dictionary
|
7
|
-
FORMAT_STR =
|
5
|
+
FORMAT_STR = "irssi-xchat"
|
8
6
|
RpLogGenerator.add self
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
date = DateTime.strptime($2, TIMESTAMP_FORMAT)
|
34
|
-
mode = if $3 != '' then $3 else ' ' end
|
35
|
-
return Parser::LogLine.new(date, options, sender: $4, contents: $5, \
|
36
|
-
flags: $1, type: :ooc, mode: mode)
|
37
|
-
else
|
38
|
-
# Only put text and emotes in the log
|
39
|
-
return nil
|
40
|
-
end
|
8
|
+
DATE_REGEXP = /(?<timestamp>\d\d:\d\d)/
|
9
|
+
TIMESTAMP_FORMAT = "%H:%M"
|
10
|
+
|
11
|
+
MSG = /(?<msg>[^\n]*)/
|
12
|
+
|
13
|
+
# TODO: Update to match join/part/quit format
|
14
|
+
JUNK = /#{DATE_REGEXP}\t<?-->?\t.*$/
|
15
|
+
EMOTE = /^#{FLAGS}#{DATE_REGEXP} {16}\* \| #{NICK}\s+#{MSG}$/
|
16
|
+
TEXT = /^#{FLAGS}#{DATE_REGEXP} <#{MODE}? *#{NICK}> \| #{MSG}$/
|
17
|
+
|
18
|
+
def self.parse_line(line, options = {})
|
19
|
+
case line
|
20
|
+
when JUNK
|
21
|
+
return nil
|
22
|
+
when EMOTE
|
23
|
+
type = :rp
|
24
|
+
when TEXT
|
25
|
+
type = :ooc
|
26
|
+
mode = $LAST_MATCH_INFO[:mode]
|
27
|
+
mode = " " if mode == ""
|
28
|
+
else
|
29
|
+
# Only put text and emotes in the log
|
30
|
+
return nil
|
41
31
|
end
|
32
|
+
date = DateTime.strptime($LAST_MATCH_INFO[:timestamp], TIMESTAMP_FORMAT)
|
33
|
+
LogLine.new(
|
34
|
+
date,
|
35
|
+
options,
|
36
|
+
sender: $LAST_MATCH_INFO[:nick],
|
37
|
+
contents: $LAST_MATCH_INFO[:msg],
|
38
|
+
flags: $LAST_MATCH_INFO[:flags],
|
39
|
+
type: type,
|
40
|
+
mode: mode
|
41
|
+
)
|
42
42
|
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
43
|
+
end
|
46
44
|
end
|
47
45
|
end
|
@@ -1,54 +1,52 @@
|
|
1
1
|
module Jekyll
|
2
2
|
module RpLogs
|
3
|
-
|
4
3
|
class MIRCParser < RpLogs::Parser
|
5
|
-
|
6
4
|
# Add this class to the parsing dictionary
|
7
|
-
FORMAT_STR =
|
5
|
+
FORMAT_STR = "MIRC"
|
8
6
|
RpLogGenerator.add self
|
9
7
|
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
# Remember to change this for your date format
|
9
|
+
# For example, this regex is for, mm dd yy[HH:nn] or 06 14 15[18:48]
|
10
|
+
# The default mirc date format is HH:nn
|
11
|
+
DATE_REGEXP = /(?<timestamp>\d\d \d\d \d\d\[\d\d:\d\d\])/
|
12
|
+
# Also make sure to change this - http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html
|
13
|
+
# If you are using the default mirc format, this should be "[%H:%M]"
|
14
|
+
TIMESTAMP_FORMAT = "%m %d %y[%H:%M]"
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
USER_AT_HOST = /\(\w+@[^)]+\)/
|
27
|
-
JUNK = /()?((?=\d{4})(\d\d))?#{DATE_REGEXP} \* #{MODE}#{NICK} (sets mode:|is now known as|(#{USER_AT_HOST} (has joined|Quit|has left))).*$/
|
28
|
-
EMOTE = /^#{FLAGS}()?((?=\d{4})(\d\d))?#{DATE_REGEXP}\s\*\s#{MODE}#{NICK}\s+([^\n]*)$/
|
29
|
-
TEXT = /^#{FLAGS}()?((?=\d{4})(\d\d))?#{DATE_REGEXP}\s<#{MODE}#{NICK}>\s([^\n]*)$/
|
16
|
+
# Crappy but works
|
17
|
+
USER_AT_HOST = /\(\w+@[^)]+\)/
|
18
|
+
MSG = /(?<msg>[^\n]*)/
|
19
|
+
# The ()?((?=\d{4})(\d\d))? bit of code is to remove the and two random numbers in front of lines.
|
20
|
+
# This assumes that you have a two digit date code stating your time stamp.
|
21
|
+
JUNK = /()?((?=\d{4})(\d\d))?#{DATE_REGEXP} \* #{MODE}#{NICK} (sets mode:|is now known as|(#{USER_AT_HOST} (has joined|Quit|has left))).*$/
|
22
|
+
EMOTE = /^#{FLAGS}()?((?=\d{4})(\d\d))?#{DATE_REGEXP}\s\*\s#{MODE}#{NICK}\s+#{MSG}$/
|
23
|
+
TEXT = /^#{FLAGS}()?((?=\d{4})(\d\d))?#{DATE_REGEXP}\s<#{MODE}#{NICK}>\s#{MSG}$/
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
else
|
45
|
-
# Only put text and emotes in the log
|
46
|
-
nil
|
47
|
-
end
|
25
|
+
def self.parse_line(line, options = {})
|
26
|
+
case line
|
27
|
+
when JUNK
|
28
|
+
return nil
|
29
|
+
when EMOTE
|
30
|
+
type = :rp
|
31
|
+
when TEXT
|
32
|
+
type = :ooc
|
33
|
+
mode = $LAST_MATCH_INFO[:mode]
|
34
|
+
mode = " " if mode == ""
|
35
|
+
else
|
36
|
+
# Only put text and emotes in the log
|
37
|
+
return nil
|
48
38
|
end
|
39
|
+
date = DateTime.strptime($LAST_MATCH_INFO[:timestamp], TIMESTAMP_FORMAT)
|
40
|
+
LogLine.new(
|
41
|
+
date,
|
42
|
+
options,
|
43
|
+
sender: $LAST_MATCH_INFO[:nick],
|
44
|
+
contents: $LAST_MATCH_INFO[:msg],
|
45
|
+
flags: $LAST_MATCH_INFO[:flags],
|
46
|
+
type: type,
|
47
|
+
mode: mode
|
48
|
+
)
|
49
49
|
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
50
|
+
end
|
53
51
|
end
|
54
52
|
end
|