jekyll-gdocfilter 0.1.1

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: 691d15c67635094f9f17bc10f9ca3e0a8863e3534f313032ed92dc09414a3951
4
+ data.tar.gz: 3924781db4b1a46668e32dd06ab469997ed6800a6da0a1e0449973d60758da19
5
+ SHA512:
6
+ metadata.gz: ba60208effacc68530a7aaef10514e541a555c0e44ad0873f79d2c6b266160e694f861f9c1d4889307aee83ac5e62f0532b1ab4bd42cb1edacb8a62692f7f3a6
7
+ data.tar.gz: e6db91665907ea9c239f37721504ad1456d1b0f240504372e6cbab2bdaddc0cbb3642b47d1d11e717abb0d66ee3ba205eb3abd39f8a07a4fcd584d1bbfc25f17
@@ -0,0 +1,16 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.7.0
14
+ bundler-cache: true
15
+ - name: Run the default task
16
+ run: bundle exec rake
@@ -0,0 +1,45 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ release-please:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: GoogleCloudPlatform/release-please-action@v2
13
+ id: release
14
+ with:
15
+ # The release type
16
+ release-type: ruby
17
+ # A name for the artifact releases are being created for
18
+ # which is the name of our gem
19
+ package-name: jekyll-gdocfilter
20
+ # Should breaking changes before 1.0.0 produce minor bumps?
21
+ bump-minor-pre-major: true
22
+ # Path to our version file to increment
23
+ version-file: "lib/jekyll/gdocfilter/version.rb"
24
+ # Checkout code if release was created
25
+ - uses: actions/checkout@v2
26
+ if: ${{ steps.release.outputs.release_created }}
27
+ # Setup ruby if a release was created
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: 3.0.0
31
+ if: ${{ steps.release.outputs.release_created }}
32
+ # Bundle install
33
+ - run: bundle install
34
+ if: ${{ steps.release.outputs.release_created }}
35
+ - name: publish gem
36
+ run: |
37
+ mkdir -p $HOME/.gem
38
+ touch $HOME/.gem/credentials
39
+ chmod 0600 $HOME/.gem/credentials
40
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
41
+ gem build *.gemspec
42
+ gem push *.gem
43
+ env:
44
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
45
+ if: ${{ steps.release.outputs.release_created }}
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ # jekyll
14
+ _site
15
+ .sass-cache
16
+ .jekyll-cache
17
+ .jekyll-metadata
18
+ vendor
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ ## [Unreleased]
2
+
3
+ ### [0.1.1](https://www.github.com/tippingpointuk/jekyll-gdocfilter/compare/v0.1.0...v0.1.1) (2022-04-01)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Add RubyGems.org to allowed push hosts ([4a5c185](https://www.github.com/tippingpointuk/jekyll-gdocfilter/commit/4a5c1856ffe432aa44f7f2a3ef40dbdc0d7702a3))
9
+
10
+ ## 0.1.0 (2022-04-01)
11
+
12
+
13
+ ### Features
14
+
15
+ * Basic HTML parsing of doc ([b9c58a9](https://www.github.com/tippingpointuk/jekyll-gdocfilter/commit/b9c58a95381e3e3edb4f2eba47c47ece75240bdc))
16
+
17
+ ## [0.1.0] - 2022-04-01
18
+
19
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at joeirving.jbi@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in jekyll-gdocfilter.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 joe-irving
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Jekyll::Gdocfilter
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/jekyll/gdocfilter`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'jekyll-gdocfilter'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install jekyll-gdocfilter
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-gdocfilter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/jekyll-gdocfilter/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Jekyll::Gdocfilter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/jekyll-gdocfilter/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "jekyll/gdocfilter"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/example/404.html ADDED
@@ -0,0 +1,25 @@
1
+ ---
2
+ permalink: /404.html
3
+ layout: default
4
+ ---
5
+
6
+ <style type="text/css" media="screen">
7
+ .container {
8
+ margin: 10px auto;
9
+ max-width: 600px;
10
+ text-align: center;
11
+ }
12
+ h1 {
13
+ margin: 30px 0;
14
+ font-size: 4em;
15
+ line-height: 1;
16
+ letter-spacing: -1px;
17
+ }
18
+ </style>
19
+
20
+ <div class="container">
21
+ <h1>404</h1>
22
+
23
+ <p><strong>Page not found :(</strong></p>
24
+ <p>The requested page could not be found.</p>
25
+ </div>
data/example/Gemfile ADDED
@@ -0,0 +1,30 @@
1
+ source "https://rubygems.org"
2
+ # Hello! This is where you manage which Jekyll version is used to run.
3
+ # When you want to use a different version, change it below, save the
4
+ # file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
5
+ #
6
+ # bundle exec jekyll serve
7
+ #
8
+ # This will help ensure the proper Jekyll version is running.
9
+ # Happy Jekylling!
10
+ gem "jekyll", "~> 4.2.0"
11
+ # This is the default theme for new Jekyll sites. You may change this to anything you like.
12
+ gem "minima", "~> 2.5"
13
+ # If you want to use GitHub Pages, remove the "gem "jekyll"" above and
14
+ # uncomment the line below. To upgrade, run `bundle update github-pages`.
15
+ # gem "github-pages", group: :jekyll_plugins
16
+ # If you have any plugins, put them here!
17
+ group :jekyll_plugins do
18
+ gem "jekyll-feed", "~> 0.12"
19
+ gem "jekyll-gdocfilter", path: "../"
20
+ end
21
+
22
+ # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
23
+ # and associated library.
24
+ platforms :mingw, :x64_mingw, :mswin, :jruby do
25
+ gem "tzinfo", "~> 1.2"
26
+ gem "tzinfo-data"
27
+ end
28
+
29
+ # Performance-booster for watching directories on Windows
30
+ gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
@@ -0,0 +1,104 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ jekyll-gdocfilter (0.1.0)
5
+ css_parser (= 1.11.0)
6
+ jekyll (>= 3.7, < 5.0)
7
+ nokogiri (>= 1.11.0, <= 1.13.3)
8
+ open-uri (= 0.2.0)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ addressable (2.8.0)
14
+ public_suffix (>= 2.0.2, < 5.0)
15
+ colorator (1.1.0)
16
+ concurrent-ruby (1.1.10)
17
+ css_parser (1.11.0)
18
+ addressable
19
+ date (3.2.2)
20
+ em-websocket (0.5.3)
21
+ eventmachine (>= 0.12.9)
22
+ http_parser.rb (~> 0)
23
+ eventmachine (1.2.7)
24
+ ffi (1.15.5)
25
+ forwardable-extended (2.6.0)
26
+ http_parser.rb (0.8.0)
27
+ i18n (1.10.0)
28
+ concurrent-ruby (~> 1.0)
29
+ jekyll (4.2.2)
30
+ addressable (~> 2.4)
31
+ colorator (~> 1.0)
32
+ em-websocket (~> 0.5)
33
+ i18n (~> 1.0)
34
+ jekyll-sass-converter (~> 2.0)
35
+ jekyll-watch (~> 2.0)
36
+ kramdown (~> 2.3)
37
+ kramdown-parser-gfm (~> 1.0)
38
+ liquid (~> 4.0)
39
+ mercenary (~> 0.4.0)
40
+ pathutil (~> 0.9)
41
+ rouge (~> 3.0)
42
+ safe_yaml (~> 1.0)
43
+ terminal-table (~> 2.0)
44
+ jekyll-feed (0.16.0)
45
+ jekyll (>= 3.7, < 5.0)
46
+ jekyll-sass-converter (2.2.0)
47
+ sassc (> 2.0.1, < 3.0)
48
+ jekyll-seo-tag (2.8.0)
49
+ jekyll (>= 3.8, < 5.0)
50
+ jekyll-watch (2.2.1)
51
+ listen (~> 3.0)
52
+ kramdown (2.3.2)
53
+ rexml
54
+ kramdown-parser-gfm (1.1.0)
55
+ kramdown (~> 2.0)
56
+ liquid (4.0.3)
57
+ listen (3.7.1)
58
+ rb-fsevent (~> 0.10, >= 0.10.3)
59
+ rb-inotify (~> 0.9, >= 0.9.10)
60
+ mercenary (0.4.0)
61
+ minima (2.5.1)
62
+ jekyll (>= 3.5, < 5.0)
63
+ jekyll-feed (~> 0.9)
64
+ jekyll-seo-tag (~> 2.1)
65
+ nokogiri (1.13.3-x86_64-linux)
66
+ racc (~> 1.4)
67
+ open-uri (0.2.0)
68
+ stringio
69
+ time
70
+ uri
71
+ pathutil (0.16.2)
72
+ forwardable-extended (~> 2.6)
73
+ public_suffix (4.0.6)
74
+ racc (1.6.0)
75
+ rb-fsevent (0.11.1)
76
+ rb-inotify (0.10.1)
77
+ ffi (~> 1.0)
78
+ rexml (3.2.5)
79
+ rouge (3.28.0)
80
+ safe_yaml (1.0.5)
81
+ sassc (2.4.0)
82
+ ffi (~> 1.9)
83
+ stringio (3.0.1)
84
+ terminal-table (2.0.0)
85
+ unicode-display_width (~> 1.1, >= 1.1.1)
86
+ time (0.2.0)
87
+ date
88
+ unicode-display_width (1.8.0)
89
+ uri (0.11.0)
90
+
91
+ PLATFORMS
92
+ x86_64-linux
93
+
94
+ DEPENDENCIES
95
+ jekyll (~> 4.2.0)
96
+ jekyll-feed (~> 0.12)
97
+ jekyll-gdocfilter!
98
+ minima (~> 2.5)
99
+ tzinfo (~> 1.2)
100
+ tzinfo-data
101
+ wdm (~> 0.1.1)
102
+
103
+ BUNDLED WITH
104
+ 2.2.21
@@ -0,0 +1,55 @@
1
+ # Welcome to Jekyll!
2
+ #
3
+ # This config file is meant for settings that affect your whole blog, values
4
+ # which you are expected to set up once and rarely edit after that. If you find
5
+ # yourself editing this file very often, consider using Jekyll's data files
6
+ # feature for the data you need to update frequently.
7
+ #
8
+ # For technical reasons, this file is *NOT* reloaded automatically when you use
9
+ # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10
+ #
11
+ # If you need help with YAML syntax, here are some quick references for you:
12
+ # https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
13
+ # https://learnxinyminutes.com/docs/yaml/
14
+ #
15
+ # Site settings
16
+ # These are used to personalize your new site. If you look in the HTML files,
17
+ # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
18
+ # You can create any custom variable you would like, and they will be accessible
19
+ # in the templates via {{ site.myvariable }}.
20
+
21
+ title: Your awesome title
22
+ email: your-email@example.com
23
+ description: >- # this means to ignore newlines until "baseurl:"
24
+ Write an awesome description for your new site here. You can edit this
25
+ line in _config.yml. It will appear in your document head meta (for
26
+ Google search results) and in your feed.xml site description.
27
+ baseurl: "" # the subpath of your site, e.g. /blog
28
+ url: "" # the base hostname & protocol for your site, e.g. http://example.com
29
+ twitter_username: jekyllrb
30
+ github_username: jekyll
31
+
32
+ # Build settings
33
+ theme: minima
34
+ plugins:
35
+ - jekyll-feed
36
+
37
+ # Exclude from processing.
38
+ # The following items will not be processed, by default.
39
+ # Any item listed under the `exclude:` key here will be automatically added to
40
+ # the internal "default list".
41
+ #
42
+ # Excluded items can be processed by explicitly listing the directories or
43
+ # their entries' file path in the `include:` list.
44
+ #
45
+ # exclude:
46
+ # - .sass-cache/
47
+ # - .jekyll-cache/
48
+ # - gemfiles/
49
+ # - Gemfile
50
+ # - Gemfile.lock
51
+ # - node_modules/
52
+ # - vendor/bundle/
53
+ # - vendor/cache/
54
+ # - vendor/gems/
55
+ # - vendor/ruby/
@@ -0,0 +1,29 @@
1
+ ---
2
+ layout: post
3
+ title: "Welcome to Jekyll!"
4
+ date: 2022-04-01 18:12:10 +0100
5
+ categories: jekyll update
6
+ ---
7
+ You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
8
+
9
+ Jekyll requires blog post files to be named according to the following format:
10
+
11
+ `YEAR-MONTH-DAY-title.MARKUP`
12
+
13
+ Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works.
14
+
15
+ Jekyll also offers powerful support for code snippets:
16
+
17
+ {% highlight ruby %}
18
+ def print_hi(name)
19
+ puts "Hi, #{name}"
20
+ end
21
+ print_hi('Tom')
22
+ #=> prints 'Hi, Tom' to STDOUT.
23
+ {% endhighlight %}
24
+
25
+ Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].
26
+
27
+ [jekyll-docs]: https://jekyllrb.com/docs/home
28
+ [jekyll-gh]: https://github.com/jekyll/jekyll
29
+ [jekyll-talk]: https://talk.jekyllrb.com/
@@ -0,0 +1,8 @@
1
+ ---
2
+ layout: page
3
+ title: About
4
+ permalink: /about/
5
+ google_doc: https://docs.google.com/document/d/1ukcn39ZrEJXS7PYnB-IfTdh7JdWQakiEnlaTy4XEefM/edit
6
+ ---
7
+
8
+ {{ page.google_doc | google_doc }}
@@ -0,0 +1,6 @@
1
+ ---
2
+ # Feel free to add content and custom Front Matter to this file.
3
+ # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
4
+
5
+ layout: home
6
+ ---
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/jekyll/gdocfilter/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "jekyll-gdocfilter"
7
+ spec.version = Jekyll::Gdocfilter::VERSION
8
+ spec.authors = ["joe-irving"]
9
+ spec.email = ["joe@irving.me.uk"]
10
+
11
+ spec.summary = "A simple filter to turn a Google Doc into readable HTML"
12
+ spec.description = "A Jekyll filter that takes a link to a public google doc,
13
+ and returns HTML with basic styling to put on your pages"
14
+ spec.homepage = "https://github.com/tippingpointuk/jekyll-gdocfilter"
15
+ spec.license = "MIT"
16
+ spec.required_ruby_version = ">= 2.4.0"
17
+
18
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
19
+
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = "https://github.com/tippingpointuk/jekyll-gdocfilter/"
22
+ spec.metadata["changelog_uri"] = "https://github.com/tippingpointuk/jekyll-gdocfilter/CHANGELOG.md"
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # Uncomment to register a new dependency of your gem
34
+ spec.add_dependency "jekyll", ">= 3.7", "< 5.0"
35
+ spec.add_dependency "nokogiri", ">=1.11.0", "<=1.13.3"
36
+ spec.add_dependency "css_parser", "1.11.0"
37
+ spec.add_dependency "open-uri", "0.2.0"
38
+
39
+ # For more information and examples about making a new gem, checkout our
40
+ # guide at: https://bundler.io/guides/creating_gem.html
41
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Gdocfilter
5
+ VERSION = "0.1.1"
6
+ end
7
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "gdocfilter/version"
4
+ require 'nokogiri'
5
+ require 'open-uri'
6
+ require 'css_parser'
7
+
8
+ module Jekyll
9
+ module Gdocfilter
10
+ class Error < StandardError; end
11
+ ##
12
+ # Parses a google doc link to neatly embedable html,
13
+ # using the +google_doc+ method.
14
+
15
+ def replace_links(html)
16
+ # Removes the google.com proxy from links in the doc
17
+ html.css('a').each do |link|
18
+ href = URI(link.attributes["href"].value)
19
+ next unless href.query
20
+ query = CGI.parse(href.query)
21
+ next unless query['q'][0]
22
+ link.attributes['href'].value = query['q'][0]
23
+ end
24
+ @html = html
25
+ end
26
+ def reduce_styles(css)
27
+ # Extract basic styling from the <style> tag at top of document
28
+ # ie. bold, colours
29
+ # But not any of the layout/spacing/font-type styles
30
+ allowed_rules = [
31
+ 'font-weight',
32
+ # 'color',
33
+ 'font-style',
34
+ 'text-decoration'
35
+ ]
36
+
37
+ parser_css.add_block! css
38
+
39
+ parser_css.each_rule_set do |rule_set|
40
+ # puts rule_set['declarations']['declarations']
41
+ rule_set.each_declaration do |d|
42
+ rule_set.remove_declaration! d unless allowed_rules.include? d
43
+ end
44
+ end
45
+
46
+ # parser_css.each_selector do |selector, declarations, specificity|
47
+ # next unless selector =~ /^[\d\w\s\#\.\-]*$/ # Check if is real selector
48
+ #
49
+ #
50
+ # end
51
+
52
+ @parser_css
53
+ end
54
+
55
+ def inline_styles(html)
56
+ css = reduce_styles html.css('style').inner_html
57
+ css.each_selector do |selector, declarations, specificity|
58
+ next unless selector =~ /^[\d\w\s\#\.\-]*$/ # Check if is real selector
59
+ elements = html.css(selector)
60
+ elements.each do |e|
61
+ e['style'] = [e["style"], declarations].compact.join(" ")
62
+ end
63
+ end
64
+ @html = html
65
+ end
66
+
67
+ def convert_headings(html)
68
+ # Convert <span class=title>s to <h1 class=title> elements
69
+ # Downsize headings by 1
70
+ (5).downto(1) do |n|
71
+ heading = html.at_css "h#{n}"
72
+ if heading
73
+ heading.name = "h#{n + 1}"
74
+ end
75
+ end
76
+
77
+ title = html.at_css 'p.title'
78
+ if title
79
+ title.name = 'h1'
80
+ end
81
+
82
+ @html = html
83
+ end
84
+
85
+ def parser_css
86
+ @parser_css ||= CssParser::Parser.new
87
+ end
88
+
89
+ def google_doc(link)
90
+ # TODO:
91
+ # * Properly nest lists
92
+ ids = /[-\w]{25,}/.match(link)
93
+ return unless ids
94
+ f = URI.open "https://docs.google.com/feeds/download/documents/export/Export?id=#{ids[0]}&exportFormat=html"
95
+ @html = Nokogiri::HTML.parse f
96
+ replace_links @html
97
+ inline_styles @html
98
+ convert_headings @html
99
+ @html.css('body').inner_html
100
+ end
101
+ end
102
+ end
103
+
104
+ Liquid::Template.register_filter(Jekyll::Gdocfilter)
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-gdocfilter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - joe-irving
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.7'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.7'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: nokogiri
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 1.11.0
40
+ - - "<="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.13.3
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 1.11.0
50
+ - - "<="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.13.3
53
+ - !ruby/object:Gem::Dependency
54
+ name: css_parser
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '='
58
+ - !ruby/object:Gem::Version
59
+ version: 1.11.0
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '='
65
+ - !ruby/object:Gem::Version
66
+ version: 1.11.0
67
+ - !ruby/object:Gem::Dependency
68
+ name: open-uri
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '='
72
+ - !ruby/object:Gem::Version
73
+ version: 0.2.0
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '='
79
+ - !ruby/object:Gem::Version
80
+ version: 0.2.0
81
+ description: |-
82
+ A Jekyll filter that takes a link to a public google doc,
83
+ and returns HTML with basic styling to put on your pages
84
+ email:
85
+ - joe@irving.me.uk
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".github/workflows/main.yml"
91
+ - ".github/workflows/release.yml"
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".rubocop.yml"
95
+ - CHANGELOG.md
96
+ - CODE_OF_CONDUCT.md
97
+ - Gemfile
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - bin/console
102
+ - bin/setup
103
+ - example/404.html
104
+ - example/Gemfile
105
+ - example/Gemfile.lock
106
+ - example/_config.yml
107
+ - example/_posts/2022-04-01-welcome-to-jekyll.markdown
108
+ - example/about.markdown
109
+ - example/index.markdown
110
+ - jekyll-gdocfilter.gemspec
111
+ - lib/jekyll/gdocfilter.rb
112
+ - lib/jekyll/gdocfilter/version.rb
113
+ homepage: https://github.com/tippingpointuk/jekyll-gdocfilter
114
+ licenses:
115
+ - MIT
116
+ metadata:
117
+ allowed_push_host: https://rubygems.org
118
+ homepage_uri: https://github.com/tippingpointuk/jekyll-gdocfilter
119
+ source_code_uri: https://github.com/tippingpointuk/jekyll-gdocfilter/
120
+ changelog_uri: https://github.com/tippingpointuk/jekyll-gdocfilter/CHANGELOG.md
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 2.4.0
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubygems_version: 3.2.3
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: A simple filter to turn a Google Doc into readable HTML
140
+ test_files: []