TriviaMD 0.2.0 → 0.2.2

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: 53443297da359fcb429e25eec19014ce804b445172fadfb1a4c7dc30761e805a
4
- data.tar.gz: 8408e7e419e69586c10ccf5e356ab100a3fb9d56f22e62f2e0da7a9a3da8517f
3
+ metadata.gz: 2c43cf4d56eb0fe781d75dd776f4103bf5d3a2203d921a1dc85ee1d6416bbf0e
4
+ data.tar.gz: 1bdf7f25c07891ca63b054bb37549c9da11650561a984e44d7ba7d46ad7593d2
5
5
  SHA512:
6
- metadata.gz: 03ccbf020c565a1dd6f661379d7488c5c21467380e4b3195220562cab04249c3b47e5a6a6cc27a71f137784e2360f011348da9bd1a551c4479abf23ff794d3b6
7
- data.tar.gz: 7a25d23e224033fa0938f3438ff87686ff0e708170435cffae8e9e260f0c468176a7779975bd4a91d438a366c1c9ef09b5875eb2c67b10774b4f3cb23adc5996
6
+ metadata.gz: f47d83838c50aa037c121082cb08c8ebf5f6a42483ad61eb36c92053608b9697b6aa54786d35b6ea6ab81cafd500597e3306ef3074b071fde6c31beb3d555f0c
7
+ data.tar.gz: 8d52a84648be05ed6f29b613a331c560c87e11c1fddd3e0d221b9afcd760ad2e4129bde6cf62180a13766bdc5cea19d21d46413ca9bc4678c9700c9945819906
data/lib/trivia_md.rb CHANGED
@@ -24,7 +24,7 @@ module App
24
24
  desc "parse", "parses trivias"
25
25
  option :file_path
26
26
  def parse(file_path)
27
- puts TriviaParser.new(File.read(file_path)).parse.to_json
27
+ puts TriviaParser.new(file_path).parse.to_json
28
28
  end
29
29
  end
30
30
 
data/lib/trivia_parser.rb CHANGED
@@ -2,8 +2,9 @@ require 'kramdown'
2
2
 
3
3
  class TriviaParser
4
4
  include Kramdown::Utils::Html
5
- def initialize(file, debug = false)
6
- @file = file
5
+ def initialize(file_path, debug = false)
6
+ @file_path = file_path
7
+ @file = File.read(@file_path)
7
8
  @debug = debug
8
9
  end
9
10
 
@@ -17,9 +18,14 @@ class TriviaParser
17
18
  return { type: :no_event }
18
19
  end
19
20
 
21
+
22
+ def markdown_gitlies_url
23
+ "#{ENV.fetch('GITLIES_PROJECT_URL', 'https://gitlies.com/')}#{@file_path}"
24
+ end
25
+
20
26
  def parse_reason(c)
21
27
  if c.options[:lang] == "html"
22
- c.value.strip
28
+ c.value.strip.gsub(/{GITLIES_MD}/,markdown_gitlies_url)
23
29
  else
24
30
  escape_html(c.value.strip)
25
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TriviaMD
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bence Pjatacsuk