jekyll-criticmarkup 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f47e509bb1245ff00124f7eb2b0cbea671e157872010c0c101434ef92dfca2b5
4
+ data.tar.gz: dc24b34c6e69f206c16307b7cfb9077485b0586934a29801ed50e743bf7f6020
5
+ SHA512:
6
+ metadata.gz: 06d3e41639941dda1b98c21c81ce811a83e0b4df721e949d84af1f93f8aa4dde8951ce284acc58bf5b291774076075bda1ee1bac5dc9d575ef818ad55d49eaf3
7
+ data.tar.gz: d76b0458ad31b80291b34af2e214e55971b7f6d2a99f72b17e65fafba652514e4fd1ce5cb7dc7414f1e014389744e7f759c1204af98b5d386a9813ae98358e8c
@@ -0,0 +1,43 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ tags: "*"
6
+
7
+ jobs:
8
+ build:
9
+ name: Build + Publish
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ packages: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Set up Ruby 2.6
18
+ uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.6.x
21
+
22
+ - name: Publish to GPR
23
+ run: |
24
+ mkdir -p $HOME/.gem
25
+ touch $HOME/.gem/credentials
26
+ chmod 0600 $HOME/.gem/credentials
27
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
+ gem build *.gemspec
29
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
30
+ env:
31
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
32
+ OWNER: ${{ github.repository_owner }}
33
+
34
+ - name: Publish to RubyGems
35
+ run: |
36
+ mkdir -p $HOME/.gem
37
+ touch $HOME/.gem/credentials
38
+ chmod 0600 $HOME/.gem/credentials
39
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
40
+ gem build *.gemspec
41
+ gem push *.gem
42
+ env:
43
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Thai “0xReki” Chung
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # jekyll-criticmarkup
2
+
3
+ Quick & dirty implementation of [CriticMarkup](https://criticmarkup.com) for jekyll.
4
+ I'm just hooking it into jekyll because I don't know where else to hook it.
5
+ If you have a suitable hook in liquid, feel free create a pull request.
6
+
7
+ ## Installation
8
+
9
+ 1. Add `gem "jekyll-criticmarkup", git: "https://github.com/0xReki/jekyll-criticmarkup.git", branch: "main"` to your site's Gemfile and run `bundle`
10
+ 2. Add the following to your site's `_config.yml`:
11
+
12
+ ```yml
13
+ gems:
14
+ - jekyll-criticmarkup
15
+ ```
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,13 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "jekyll-criticmarkup"
5
+ spec.version = "0.0.2"
6
+ spec.authors = ["Thai Chung"]
7
+ spec.email = ["mail@0xReki.de"]
8
+ spec.summary = "CriticMarkup"
9
+ spec.homepage = "https://github.com/0xReki/jekyll-criticmarkup"
10
+ spec.licenses = "MIT"
11
+
12
+ spec.files = `git ls-files -z`.split("\x0")
13
+ end
@@ -0,0 +1,37 @@
1
+ Jekyll::Hooks.register :documents, :pre_render do |document, payload|
2
+ # Convert CriticMarkup to HTML
3
+ content = document.content
4
+
5
+ # Add Space to empty Markup
6
+ content = content.gsub(/\{\+\+\n\n(.*)\+\+\}/, "<ins>&nbsp;</ins>\n\n<ins>\\1</ins>")
7
+ content = content.gsub(/\{\+\+(.*?)\+\+\}/m, '<ins>\1</ins>')
8
+
9
+ content = content.gsub(/\{--\n\n(.*)--\}/, "<del>&nbsp;</del>\n\n<del>\\1</del>")
10
+ content = content.gsub(/\{--(.*?)--\}/m, '<del>\1</del>')
11
+
12
+ content = content.gsub(/\{~~(.*?)->(.*?)~~\}/m, '<del>\1</del><ins>\2</ins>')
13
+ content = content.gsub(/\{>>(.*?)<<\}/m, '<span class="critic-comment" style="right:0">\1</span>')
14
+ content = content.gsub(/\{==(.*?)==\}/m, '<mark>\1</mark>')
15
+
16
+ document.content = content
17
+ end
18
+
19
+ # Pages don't seem to be part of documents so adding duplicate code.
20
+
21
+ Jekyll::Hooks.register :pages, :pre_render do |document, payload|
22
+ # Convert CriticMarkup to HTML
23
+ content = document.content
24
+
25
+ # Add Space to empty Markup
26
+ content = content.gsub(/\{\+\+\n\n(.*)\+\+\}/, "<ins>&nbsp;⏎</ins>\n\n<ins>\\1</ins>")
27
+ content = content.gsub(/\{\+\+(.*?)\+\+\}/m, '<ins>\1</ins>')
28
+
29
+ content = content.gsub(/\{--\n\n(.*)--\}/, "<del>&nbsp;⏎</del>\n\n<del>\\1</del>")
30
+ content = content.gsub(/\{--(.*?)--\}/m, '<del>\1</del>')
31
+
32
+ content = content.gsub(/\{~~(.*?)->(.*?)~~\}/m, '<del>\1</del><ins>\2</ins>')
33
+ content = content.gsub(/\{>>(.*?)<<\}/m, '<span class="critic-comment" style="right:0">\1</span>')
34
+ content = content.gsub(/\{==(.*?)==\}/m, '<mark>\1</mark>')
35
+
36
+ document.content = content
37
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-criticmarkup
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Thai Chung
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-06-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - mail@0xReki.de
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".github/workflows/gem-push.yml"
21
+ - Gemfile
22
+ - LICENSE
23
+ - README.md
24
+ - Rakefile
25
+ - jekyll-criticmarkup.gemspec
26
+ - lib/jekyll-criticmarkup.rb
27
+ homepage: https://github.com/0xReki/jekyll-criticmarkup
28
+ licenses:
29
+ - MIT
30
+ metadata: {}
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubygems_version: 3.0.3.1
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: CriticMarkup
50
+ test_files: []