jekyll-writeinpublic 0.2.0 → 0.3.0

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
  SHA1:
3
- metadata.gz: 6aa14352e32707cd08e933ae1c525d204a1ad29b
4
- data.tar.gz: 5c0cefc6ccabd654b2c34f4e26534516356cfe0b
3
+ metadata.gz: 9f2758f56573447a4ddf8c05cae16ccaf343d7d5
4
+ data.tar.gz: 187aeb1220ac5a3890b15c7fb7f50e7b361e4090
5
5
  SHA512:
6
- metadata.gz: c0d54580b5072bfe713034054d88518739b1adf0179db4fdd283e18a1999a9684ebfd21240a1c141c29d87d21748afe5b0c10261f80bbad24ab426651593b97e
7
- data.tar.gz: 54e1d294c090df067419edbe112e4a5587c6dea8c3c1217b5a22e43f387c5299a4941e847c2fd3b8064eedf469a9abd3d231fac62406d26376980310765a53cc
6
+ metadata.gz: 401d6578bfea1b260ae784a7f39344e93601dd5abe321d95903e8328771f87e9e3398d947d1629a7cb1a85d205082143faece0312cb71f5c93b64d9b105059cf
7
+ data.tar.gz: dc6d79b72ca1a22a03305d95532628f43b3d5a17b8a1bf5ab3b5d3e436dadb63d602ba6cd7735b4e53658ea88da5c3e2d62990a29f212e39ae24eb371c151361
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [0.3.0] - 2016-01-04
7
+
8
+ ## Added
9
+
10
+ - You can now specify html attributes as arguments to the `writeinpublic_link` tag, e.g.
11
+
12
+ ```liquid
13
+ {% writeinpublic_link person.id class: 'foo bar baz' %}
14
+ Write to {{ person.name }}
15
+ {% endwriteinpublic_link %}
16
+ ```
17
+
6
18
  ## [0.2.0] - 2015-12-21
7
19
 
8
20
  ## Added
@@ -14,3 +26,4 @@ This project adheres to [Semantic Versioning](http://semver.org/).
14
26
  - Initial release
15
27
 
16
28
  [0.2.0]: https://github.com/everypolitician/jekyll-writeinpublic/compare/v0.1.0...v0.2.0
29
+ [0.3.0]: https://github.com/everypolitician/jekyll-writeinpublic/compare/v0.2.0...v0.3.0
data/README.md CHANGED
@@ -42,7 +42,29 @@ Then whenever you want to link to a person's page on WriteInPublic you can use t
42
42
  Which will result in something like this:
43
43
 
44
44
  ```html
45
- <a href="http://kenya-politicians.writeinpublic.com/en/write/who/?person_id=person/123abc">Write to Bob on WriteInPublic!</a>
45
+ <a href="http://kenya-politicians.writeinpublic.com/en/write/who/?person_id=person/123abc">
46
+ Write to Bob on WriteInPublic!
47
+ </a>
48
+ ```
49
+
50
+ ### Adding a class
51
+
52
+ If you want to add classes to the generated link then you can specify these as part of the `writeinpublic_link` tag.
53
+
54
+ ```liquid
55
+ {% writeinpublic_link person.id class: 'writeinpublic writeinpublic-link' %}
56
+
57
+ Write to {{ person.name }} on WriteInPublic!
58
+
59
+ {% endwriteinpublic_link %}
60
+ ```
61
+
62
+ Which will result in something like this:
63
+
64
+ ```html
65
+ <a href="http://kenya-politicians.writeinpublic.com/en/write/who/?person_id=person/123abc" class="writeinpublic writeinpublic-link">
66
+ Write to Bob on WriteInPublic!
67
+ </a>
46
68
  ```
47
69
 
48
70
  If your WriteInPublic site is still in testing mode you might want to disable this plugin temporarily so the link doesn't show up on the site. You can do this with the `disabled` option:
@@ -5,9 +5,19 @@ require 'jekyll'
5
5
  module Jekyll
6
6
  module Writeinpublic
7
7
  class LinkBlock < Liquid::Block
8
+ SYNTAX = /(#{Liquid::QuotedFragment}+)?/
9
+
8
10
  def initialize(tag_name, markup, tokens)
9
11
  super
10
- @markup = markup.strip
12
+ @attributes = {}
13
+
14
+ # Parse parameters
15
+ if markup =~ SYNTAX
16
+ markup.scan(Liquid::TagAttributes) do |key, value|
17
+ @attributes[key] = value.gsub(/("|')/, '')
18
+ end
19
+ end
20
+ @person_id = markup.split(' ').first
11
21
  end
12
22
 
13
23
  def render(context)
@@ -15,8 +25,12 @@ module Jekyll
15
25
  writeinpublic = site.config['writeinpublic']
16
26
  return unless writeinpublic && writeinpublic.key?('subdomain')
17
27
  return if writeinpublic['disabled']
18
- person_id = context[@markup]
19
- %(<a href="#{link(writeinpublic['subdomain'], person_id)}">#{super}</a>)
28
+ person_id = context[@person_id]
29
+ %(<a href="#{link(writeinpublic['subdomain'], person_id)}" #{html_attributes}>#{super}</a>)
30
+ end
31
+
32
+ def html_attributes
33
+ @attributes.map { |k, v| %(#{k}="#{v}") }.join(' ')
20
34
  end
21
35
 
22
36
  def link(subdomain, person_id)
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Writeinpublic
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-writeinpublic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Mytton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-21 00:00:00.000000000 Z
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.4.5.1
122
+ rubygems_version: 2.5.1
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Link to WriteInPublic from Jekyll sites