jekyll-rp_logs 0.1.3

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.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.gitmodules +3 -0
  4. data/.themes/default/source/_config.yml.default +51 -0
  5. data/.themes/default/source/_includes/footer.html +23 -0
  6. data/.themes/default/source/_includes/head.html +13 -0
  7. data/.themes/default/source/_includes/header.html +27 -0
  8. data/.themes/default/source/_includes/rp.html +19 -0
  9. data/.themes/default/source/_layouts/default.html +20 -0
  10. data/.themes/default/source/_layouts/page.html +14 -0
  11. data/.themes/default/source/_layouts/post.html +15 -0
  12. data/.themes/default/source/_layouts/rp.html +32 -0
  13. data/.themes/default/source/_layouts/tag_index.html +9 -0
  14. data/.themes/default/source/_sass/_base.scss +204 -0
  15. data/.themes/default/source/_sass/_layout.scss +236 -0
  16. data/.themes/default/source/_sass/_rp.scss +142 -0
  17. data/.themes/default/source/_sass/_syntax-highlighting.scss +67 -0
  18. data/.themes/default/source/arcs.html +22 -0
  19. data/.themes/default/source/css/main.scss +64 -0
  20. data/.themes/default/source/index.html +23 -0
  21. data/.themes/default/source/js/toggle_ooc.js +93 -0
  22. data/Gemfile +4 -0
  23. data/LICENSE +22 -0
  24. data/README.md +92 -0
  25. data/Rakefile +8 -0
  26. data/bin/console +14 -0
  27. data/bin/setup +7 -0
  28. data/jekyll-rp_logs.gemspec +30 -0
  29. data/lib/jekyll/rp_logs/parse_irssi_xchat.rb +47 -0
  30. data/lib/jekyll/rp_logs/parse_weechat.rb +46 -0
  31. data/lib/jekyll/rp_logs/rp_arcs.rb +69 -0
  32. data/lib/jekyll/rp_logs/rp_log_converter.rb +202 -0
  33. data/lib/jekyll/rp_logs/rp_parser.rb +114 -0
  34. data/lib/jekyll/rp_logs/rp_tag_index.rb +56 -0
  35. data/lib/jekyll/rp_logs/rp_tags.rb +107 -0
  36. data/lib/jekyll/rp_logs/rp_tasks.rb +57 -0
  37. data/lib/jekyll/rp_logs/version.rb +5 -0
  38. data/lib/jekyll/rp_logs.rb +18 -0
  39. metadata +123 -0
@@ -0,0 +1,142 @@
1
+ @mixin transition($transition-property, $transition-time, $method) {
2
+ -webkit-transition: $transition-property $transition-time $method;
3
+ -moz-transition: $transition-property $transition-time $method;
4
+ -ms-transition: $transition-property $transition-time $method;
5
+ -o-transition: $transition-property $transition-time $method;
6
+ transition: $transition-property $transition-time $method;
7
+ }
8
+
9
+ // Temporary fix until baseline is back to normal
10
+ li {
11
+ list-style: none;
12
+ }
13
+
14
+ .rp-list li {
15
+ margin-bottom: 15px;
16
+ }
17
+
18
+ .rp-entry-container {
19
+ align-items: baseline;
20
+ display: flex;
21
+ flex-wrap: wrap;
22
+ margin-bottom: .2em;
23
+ width: 100%;
24
+ }
25
+
26
+ .rp-entry {
27
+ flex: 1 1 auto;
28
+ max-width: 450px;
29
+ }
30
+
31
+ .rp-title {
32
+ margin-bottom: 0px;
33
+ }
34
+
35
+ .rp-metadata-container {
36
+ // Basis so that content wraps afterwards
37
+ flex: 1 0 auto;
38
+ text-align: right;
39
+
40
+ .rp-completion {
41
+ font-size: 1.125em;
42
+ text-align: center;
43
+ width: 1.5em;
44
+ }
45
+ }
46
+
47
+ .rp-complete { color: $light-green; }
48
+ .rp-incomplete { color: $light-red; }
49
+
50
+ // Styling for when the screen is too small
51
+ // @include media-query($on-palm) {
52
+ // .rp-entry {
53
+ // flex-basis: $on-palm;
54
+ // }
55
+ // }
56
+
57
+ /* Undo normal pre styles */
58
+ #log {
59
+
60
+ p {
61
+ margin: 0;
62
+ margin-top: 0.5em;
63
+ }
64
+
65
+ .rp { color: #DCDCCC; }
66
+ .ooc {
67
+ color: #A0A090;
68
+ white-space: pre-wrap;
69
+ font-family: monospace;
70
+ font-size: 80%;
71
+ }
72
+
73
+ /* timestamps */
74
+ a {
75
+ color: inherit;
76
+
77
+ &:hover {
78
+ text-decoration: underline;
79
+ }
80
+ }
81
+ }
82
+
83
+ /* OOC toggling menu */
84
+ .scroll-nav {
85
+ background: #222;
86
+ display: block;
87
+ @include transition(all, 0.25s, ease-in-out);
88
+ left: 0;
89
+ right: 0;
90
+ top: -2.5em;
91
+ line-height: 2.5em;
92
+ position: fixed;
93
+ text-align: center;
94
+
95
+ &.shown {
96
+ top: 0;
97
+ }
98
+
99
+ a,
100
+ #ooc_label {
101
+ padding: 0.5em;
102
+ }
103
+ }
104
+
105
+ #ooc_toggle {
106
+ vertical-align: middle;
107
+ }
108
+
109
+
110
+ a.rp-tag {
111
+ background-color: #333;
112
+ // border: 1px solid $text-color;
113
+ box-shadow: 0 0 2px 0px darken($text-color, 25%);
114
+ color: inherit;
115
+ display: inline-block;
116
+ margin-bottom: 0.25em;
117
+ padding: 0 0.25em;
118
+ white-space: nowrap;
119
+
120
+ &.rp-tag-character {
121
+ background-color: $dark-green;
122
+ // border: 1px solid $light-green;
123
+ box-shadow: 0 0 2px 0px darken($light-green, 25%);
124
+ color: $light-green;
125
+ }
126
+
127
+ &.rp-tag-meta {
128
+ background-color: $dark-red;
129
+ // border: 1px solid $light-red;
130
+ box-shadow: 0 0 2px 0px darken($light-red, 25%);
131
+ color: $light-red;
132
+ }
133
+
134
+ &:hover {
135
+
136
+ }
137
+ }
138
+
139
+ // Undo a styling for RP and arc titles
140
+ .arc-title>a {
141
+ color: inherit;
142
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Syntax highlighting styles
3
+ */
4
+ .highlight {
5
+ background: #fff;
6
+ @extend %vertical-rhythm;
7
+
8
+ .c { color: #998; font-style: italic } // Comment
9
+ .err { color: #a61717; background-color: #e3d2d2 } // Error
10
+ .k { font-weight: bold } // Keyword
11
+ .o { font-weight: bold } // Operator
12
+ .cm { color: #998; font-style: italic } // Comment.Multiline
13
+ .cp { color: #999; font-weight: bold } // Comment.Preproc
14
+ .c1 { color: #998; font-style: italic } // Comment.Single
15
+ .cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special
16
+ .gd { color: #000; background-color: #fdd } // Generic.Deleted
17
+ .gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific
18
+ .ge { font-style: italic } // Generic.Emph
19
+ .gr { color: #a00 } // Generic.Error
20
+ .gh { color: #999 } // Generic.Heading
21
+ .gi { color: #000; background-color: #dfd } // Generic.Inserted
22
+ .gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific
23
+ .go { color: #888 } // Generic.Output
24
+ .gp { color: #555 } // Generic.Prompt
25
+ .gs { font-weight: bold } // Generic.Strong
26
+ .gu { color: #aaa } // Generic.Subheading
27
+ .gt { color: #a00 } // Generic.Traceback
28
+ .kc { font-weight: bold } // Keyword.Constant
29
+ .kd { font-weight: bold } // Keyword.Declaration
30
+ .kp { font-weight: bold } // Keyword.Pseudo
31
+ .kr { font-weight: bold } // Keyword.Reserved
32
+ .kt { color: #458; font-weight: bold } // Keyword.Type
33
+ .m { color: #099 } // Literal.Number
34
+ .s { color: #d14 } // Literal.String
35
+ .na { color: #008080 } // Name.Attribute
36
+ .nb { color: #0086B3 } // Name.Builtin
37
+ .nc { color: #458; font-weight: bold } // Name.Class
38
+ .no { color: #008080 } // Name.Constant
39
+ .ni { color: #800080 } // Name.Entity
40
+ .ne { color: #900; font-weight: bold } // Name.Exception
41
+ .nf { color: #900; font-weight: bold } // Name.Function
42
+ .nn { color: #555 } // Name.Namespace
43
+ .nt { color: #000080 } // Name.Tag
44
+ .nv { color: #008080 } // Name.Variable
45
+ .ow { font-weight: bold } // Operator.Word
46
+ .w { color: #bbb } // Text.Whitespace
47
+ .mf { color: #099 } // Literal.Number.Float
48
+ .mh { color: #099 } // Literal.Number.Hex
49
+ .mi { color: #099 } // Literal.Number.Integer
50
+ .mo { color: #099 } // Literal.Number.Oct
51
+ .sb { color: #d14 } // Literal.String.Backtick
52
+ .sc { color: #d14 } // Literal.String.Char
53
+ .sd { color: #d14 } // Literal.String.Doc
54
+ .s2 { color: #d14 } // Literal.String.Double
55
+ .se { color: #d14 } // Literal.String.Escape
56
+ .sh { color: #d14 } // Literal.String.Heredoc
57
+ .si { color: #d14 } // Literal.String.Interpol
58
+ .sx { color: #d14 } // Literal.String.Other
59
+ .sr { color: #009926 } // Literal.String.Regex
60
+ .s1 { color: #d14 } // Literal.String.Single
61
+ .ss { color: #990073 } // Literal.String.Symbol
62
+ .bp { color: #999 } // Name.Builtin.Pseudo
63
+ .vc { color: #008080 } // Name.Variable.Class
64
+ .vg { color: #008080 } // Name.Variable.Global
65
+ .vi { color: #008080 } // Name.Variable.Instance
66
+ .il { color: #099 } // Literal.Number.Integer.Long
67
+ }
@@ -0,0 +1,22 @@
1
+ ---
2
+ layout: page
3
+ title: Arc Index
4
+ rp_arcs: true
5
+ ---
6
+
7
+ <ul class="rp-list">
8
+ {% for x in page['rps'] %}
9
+ {% assign type = x[0] %}
10
+ {% assign rp = x[1] %}
11
+ {% if type == 'arc' %}
12
+ <h3 class="arc-title"><a name="{{ rp.name | slugify }}" href="#{{ rp.name | slugify }}">{{ rp.name }}</a></h3>
13
+ <ul class="arc-rp-list">
14
+ {% for arc_rp in rp.rps %}
15
+ {% include rp.html rp=arc_rp %}
16
+ {% endfor %}
17
+ </ul>
18
+ {% else %}
19
+ {% include rp.html rp=rp %}
20
+ {% endif %}
21
+ {% endfor %}
22
+ </ul>
@@ -0,0 +1,64 @@
1
+ ---
2
+ # Only the main Sass file needs front matter (the dashes are enough)
3
+ layout: nil
4
+ ---
5
+ @charset "utf-8";
6
+
7
+
8
+
9
+ // Our variables
10
+ $base-font-family: Helvetica, Arial, sans-serif;
11
+ $base-font-size: 16px;
12
+ $small-font-size: $base-font-size * 0.875;
13
+ $base-line-height: 1.5;
14
+
15
+ $spacing-unit: 30px;
16
+
17
+ $text-color: #dcdccc;
18
+ $background-color: #3f3f3f;
19
+ $header-color: #303030;
20
+ $brand-color: #8cd0d3;
21
+
22
+ $light-green: #80d4aa;
23
+ $dark-green: #313C36;
24
+ $light-red: #ecbcbc;
25
+ $dark-red: #41363c;
26
+
27
+ $link-hover: #c0bed1;
28
+ $link-visited: #8c8cbc;
29
+
30
+ $grey-color: #8f8f8f;
31
+ // swapped because of dark theme
32
+ $grey-color-light: lighten($grey-color, 25%);
33
+ $grey-color-dark: lighten($grey-color, 40%);
34
+
35
+ // Width of the content area
36
+ $content-width: 800px;
37
+
38
+ $on-palm: 600px;
39
+ $on-laptop: 800px;
40
+
41
+
42
+
43
+ // Using media queries with like this:
44
+ // @include media-query($on-palm) {
45
+ // .wrapper {
46
+ // padding-right: $spacing-unit / 2;
47
+ // padding-left: $spacing-unit / 2;
48
+ // }
49
+ // }
50
+ @mixin media-query($device) {
51
+ @media screen and (max-width: $device) {
52
+ @content;
53
+ }
54
+ }
55
+
56
+
57
+
58
+ // Import partials from `sass_dir` (defaults to `_sass`)
59
+ @import
60
+ "base",
61
+ "layout",
62
+ "syntax-highlighting",
63
+ "rp"
64
+ ;
@@ -0,0 +1,23 @@
1
+ ---
2
+ layout: page
3
+ title: All RPs
4
+ rp_index: true
5
+ ---
6
+
7
+ {% if page['rps']['canon'].size > 0 then %}
8
+ <h2 class="arc-title"><a name="canon" href="#canon">Canon</a></h2>
9
+ <ul class="rp-list">
10
+ {% for rp in page['rps']['canon'] %}
11
+ {% include rp.html rp=rp %}
12
+ {% endfor %}
13
+ </ul>
14
+ {% endif %}
15
+
16
+ {% if page['rps']['noncanon'].size > 0 %}
17
+ <h2 class="arc-title"><a name="non-canon" href="#non-canon">Non-Canon</a></h2>
18
+ <ul class="rp-list">
19
+ {% for rp in page['rps']['noncanon'] %}
20
+ {% include rp.html rp=rp %}
21
+ {% endfor %}
22
+ </ul>
23
+ {% endif %}
@@ -0,0 +1,93 @@
1
+ (function() {
2
+ "use strict";
3
+ var fixedMenu = $("#fixed_menu");
4
+ var oocButton = $("#ooc_label");
5
+ // get window
6
+ var win = $(window);
7
+ // use vars to short circuit doing work again
8
+ var shown = false;
9
+ var canClose = false;
10
+
11
+ var lastScroll = 0;
12
+ var minScroll = 200; // how far down in order to show it
13
+
14
+ var timeout;
15
+ var closeableTimeout;
16
+
17
+ var hideMenu = function() {
18
+ shown = false;
19
+ fixedMenu.removeClass('shown');
20
+ clearHideTimer();
21
+ };
22
+
23
+ var showMenu = function() {
24
+ shown = true;
25
+ fixedMenu.addClass('shown');
26
+ resetHideTimer();
27
+ };
28
+
29
+ var allowMenuClose = function() {
30
+ canClose = true;
31
+ };
32
+
33
+ var resetHideTimer = function() {
34
+ clearTimeout(timeout);
35
+ clearTimeout(closeableTimeout);
36
+ canClose = false;
37
+ timeout = setTimeout(hideMenu, 2000);
38
+ closeableTimeout = setTimeout(allowMenuClose, 500);
39
+ };
40
+
41
+ var clearHideTimer = function() {
42
+ clearTimeout(timeout);
43
+ };
44
+
45
+ win.on("scroll", function() {
46
+ var curScroll = win.scrollTop();
47
+ if (!shown && curScroll > minScroll && curScroll < lastScroll) {
48
+ showMenu();
49
+ } else if (shown && canClose && (curScroll > lastScroll || curScroll < minScroll)) {
50
+ // keep it from closing early
51
+ // have some min time before closing
52
+ hideMenu();
53
+ }
54
+
55
+ lastScroll = curScroll;
56
+ });
57
+
58
+ win.on("click", function(e) {
59
+ // Don't hide the button if user clicked a real link or the label
60
+ if (e.target.tagName === "A" || e.originalEvent.passedThroughFixedMenu) return;
61
+
62
+ if (!shown) {
63
+ showMenu();
64
+ } else if (shown) {
65
+ hideMenu();
66
+ }
67
+ });
68
+
69
+ fixedMenu.click(function(e) {
70
+ resetHideTimer();
71
+ e.originalEvent.passedThroughFixedMenu = true;
72
+ });
73
+
74
+ var toggleOOC = function(e) {
75
+ // var topPost = $("p.rp").withinViewportTop().first();
76
+ // var topPost = $("p.rp").not(":above-the-top").first();
77
+ var originalScroll = $(window).scrollTop();
78
+ var topPost = $("p.rp").filter(function(index, elem) {
79
+ return $(elem).offset().top >= originalScroll;
80
+ }).first();
81
+
82
+ var originalOffset = topPost.offset();
83
+
84
+ // checked == show; not checked == hide
85
+ var visible = $("#ooc_toggle").is(":checked");
86
+ $(".ooc").toggle(visible);
87
+
88
+ $(window).scrollTop(originalScroll + (topPost.offset().top - originalOffset.top));
89
+ };
90
+ toggleOOC();
91
+
92
+ $("#ooc_toggle").change(toggleOOC);
93
+ })();
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jekyll-rp_logs.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Andrew Rodgers-Schatz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # Jekyll::RpLogs
2
+
3
+ ## Installation
4
+
5
+ ### Bundler
6
+ Add these lines to your application's Gemfile:
7
+
8
+ ```ruby
9
+ group :jekyll_plugins do
10
+ gem 'jekyll-rp_logs'
11
+ end
12
+ ```
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ The Gemfile group will tell Jekyll to load the gem, and let you keep it up to date easily with Bundler.
18
+
19
+ ### Manually
20
+ Alternatively, install it yourself as:
21
+
22
+ $ gem install jekyll-rp_logs
23
+
24
+ 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.
25
+
26
+ ## Usage
27
+
28
+ ### Making a new site
29
+ Require the gem in your Rakefile to get access to its exposed tasks:
30
+
31
+ echo "require 'jekyll/rp_logs'" >> Rakefile
32
+
33
+ To set up a new site in the current directory, execute:
34
+
35
+ rake rp_logs:new
36
+
37
+ Then edit `_config.yml` and fill in the needed info for your setup.
38
+
39
+ **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.
40
+
41
+ ### Building the site
42
+ Run this command:
43
+
44
+ jekyll build
45
+
46
+ 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.
47
+
48
+ **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.
49
+
50
+ ### Adding RPs
51
+ Dump all of them into the `_rps/` directory of the site.
52
+
53
+ All joins, parts, and quits are stripped, so you don't have to bother pulling those out. All lines that are emotes (`/me`) are RP, and all other lines are OOC by default. Consecutive posts from the same person with timestamps less than a few seconds apart are merged together.
54
+
55
+ To flag an OOC line as RP, or vice versa, use
56
+
57
+ * `!RP ` before the timestamp to manually flag the line as RP
58
+ * `!OOC ` before the timestamp to manually flag the line as OOC
59
+
60
+ #### YAML Front Matter
61
+ 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:
62
+
63
+ * `title` - The name of the RP, as shown on its page and in the index
64
+
65
+ These are all optional (they have default values, configurable in `_config.yml`):
66
+
67
+ * `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.
68
+ * `canon` - true/false - Whether the RP is considered canonical (whatever that means to you). Sorts RPs into one of two categories in the index.
69
+ * `complete` - true/false - Whether the RP is finished, or is still incomplete. Incomplete RPs are flagged as such on the index.
70
+ * `format` - YAML list - What format(s) the logs are in, e.g., `[weechat]`
71
+ * `rp_tags` - comma separated list - A list of tags that describe the contents, such as characters involved or events that occur.
72
+ * `arc_name` - YAML list - names of story arcs that the RP belongs to
73
+
74
+ There are also some more options you can toggle:
75
+
76
+ * `strict_ooc` - true/false - If true, only lines beginning with `(` are considered OOC by default.
77
+ * `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).
78
+ * `infer_char_tags` - true/false - If false, don't infer the characters in the RP by the nicks who do emotes.
79
+
80
+ ## Development
81
+
82
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
83
+
84
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
85
+
86
+ ## Contributing
87
+
88
+ 1. Fork it ( https://github.com/[my-github-username]/jekyll-rp_logs/fork )
89
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
90
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
91
+ 4. Push to the branch (`git push origin my-new-feature`)
92
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :setup do |t, args|
4
+ mkdir_p "_rps"
5
+ cp_n "_config.yml.default" "_config.yml"
6
+ cp_n "_sass/_custom-vars.scss.default" "_sass/_custom-vars.scss"
7
+ cp_n "_sass/_custom-rules.scss.default" "_sass/_custom-rules.scss"
8
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jekyll/rp_logs"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jekyll/rp_logs/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jekyll-rp_logs"
8
+ spec.version = Jekyll::RpLogs::VERSION
9
+ spec.authors = ["anrodger"]
10
+ spec.email = ["me@andrew.rs"]
11
+
12
+ if spec.respond_to?(:metadata)
13
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
14
+ end
15
+
16
+ spec.summary = %q{Jekyll plugin to turn raw IRC RP logs into pretty pages.}
17
+ # spec.description = %q{TODO: Write a longer description or delete this line.}
18
+ spec.homepage = "https://github.com/xiagu/jekyll-rp_logs"
19
+ spec.license = "MIT"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.8"
27
+
28
+ spec.add_runtime_dependency "jekyll", "~> 2.5"
29
+ spec.add_runtime_dependency "rake", "~> 10.0"
30
+ end
@@ -0,0 +1,47 @@
1
+ module Jekyll
2
+ module RpLogs
3
+
4
+ class IrssiXChatParser < RpLogs::Parser
5
+
6
+ # Add this class to the parsing dictionary
7
+ FORMAT_STR = 'irssi-xchat'
8
+ RpLogs::RpLogGenerator.add self
9
+
10
+ # Stuff
11
+ class << self
12
+ MODE = /([+%@&~!]?)/
13
+ NICK = /([\w\-\\\[\]\{\}\^\`\|]+)/
14
+ DATE_REGEXP = /(\d\d:\d\d)/
15
+
16
+ FLAGS = /((?:![A-Z]+ )*)/
17
+ # TODO: Update to match join/part/quit format
18
+ JUNK = /#{DATE_REGEXP}\t<?-->?\t.*$/
19
+ EMOTE = /^#{FLAGS}#{DATE_REGEXP} {16}\* \| #{NICK}\s+([^\n]*)$/
20
+ TEXT = /^#{FLAGS}#{DATE_REGEXP} < *#{MODE}#{NICK}> \| ([^\n]*)$/
21
+
22
+ TIMESTAMP_FORMAT = '%H:%M'
23
+
24
+ def parse_line(line, options = {})
25
+ case line
26
+ when JUNK
27
+ return nil
28
+ when EMOTE
29
+ date = DateTime.strptime($2, TIMESTAMP_FORMAT)
30
+ return Parser::LogLine.new(date, options, sender: $3, contents: $4, \
31
+ flags: $1, type: :rp)
32
+ when TEXT
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
41
+ end
42
+ end
43
+
44
+ end
45
+
46
+ end
47
+ end