pax_global_header 0000666 0000000 0000000 00000000064 14360332564 0014520 g ustar 00root root 0000000 0000000 52 comment=9f05f8524cd974fc151d0d960ae3ad2e4935d3c6
jekyll-relative-links-0.7.0/ 0000775 0000000 0000000 00000000000 14360332564 0015745 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/.github/ 0000775 0000000 0000000 00000000000 14360332564 0017305 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/.github/CODEOWNERS 0000664 0000000 0000000 00000000246 14360332564 0020702 0 ustar 00root root 0000000 0000000 # Require @benbalter's :+1: for changes to the .github repo-config files
# mainly due to https://github.com/probot/settings privilege escalation
.github/* @benbalter
jekyll-relative-links-0.7.0/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14360332564 0021470 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/.github/ISSUE_TEMPLATE/bug_report.md 0000664 0000000 0000000 00000001007 14360332564 0024160 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Create a report to help us improve
---
### Describe the bug
A clear and concise description of what the bug is.
### Steps to reproduce the behavior
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
### Expected behavior
A clear and concise description of what you expected to happen.
### Screenshots
If applicable, add screenshots to help explain your problem.
### Additional context
Add any other context about the problem here.
jekyll-relative-links-0.7.0/.github/ISSUE_TEMPLATE/feature_request.md 0000664 0000000 0000000 00000001154 14360332564 0025216 0 ustar 00root root 0000000 0000000 ---
name: Feature request
about: Suggest an idea for this project
---
### Is your feature request related to a problem? Please describe the problem you're trying to solve.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
### Describe the solution you'd like
A clear and concise description of what you want to happen.
### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
### Additional context
Add any other context or screenshots about the feature request here.
jekyll-relative-links-0.7.0/.github/config.yml 0000664 0000000 0000000 00000003506 14360332564 0021301 0 ustar 00root root 0000000 0000000 # Behaviorbot config. See https://github.com/behaviorbot/ for more information.
# Note: Please Don't edit this file directly.
# Edit https://github.com/benbalter/shared-community-files instead.
# Configuration for update-docs - https://github.com/behaviorbot/update-docs
updateDocsComment: "Thanks for the pull request! If you are making any changes to the user-facing functionality, please be sure to update the documentation in the `README` or `docs/` folder alongside your change. :heart:"
# Configuration for request-info - https://github.com/behaviorbot/request-info
requestInfoReplyComment: Thanks for this. Do you mind providing a bit more information about what problem you're trying to solve?
requestInfoLabelToAdd: more-information-needed
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
#newIssueWelcomeComment: >
# Welcome!
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
newPRWelcomeComment: Welcome! Congrats on your first pull request to Jekyll Relative Links. If you haven't already, please be sure to check out [the contributing guidelines](https://github.com/benbalter/jekyll-relative-links/blob/master/docs/CONTRIBUTING.md).
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
firstPRMergeComment: "Congrats on getting your first pull request to Jekyll Relative Links merged! Without amazing humans like you submitting pull requests, we couldn’t run this project. You rock! :tada:
If you're interested in tackling another bug or feature, take a look at [the open issues](https://github.com/benbalter/jekyll-relative-links/issues), especially those [labeled `help wanted`](https://github.com/benbalter/jekyll-relative-links/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)."
# Bug workaround
contact_links: []
jekyll-relative-links-0.7.0/.github/dependabot.yml 0000664 0000000 0000000 00000000254 14360332564 0022136 0 ustar 00root root 0000000 0000000 version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
time: "10:00"
timezone: US/Eastern
open-pull-requests-limit: 99
jekyll-relative-links-0.7.0/.github/funding.yml 0000664 0000000 0000000 00000000023 14360332564 0021455 0 ustar 00root root 0000000 0000000 patreon: benbalter
jekyll-relative-links-0.7.0/.github/no-response.yml 0000664 0000000 0000000 00000001463 14360332564 0022304 0 ustar 00root root 0000000 0000000 # Configuration for probot-no-response - https://github.com/probot/no-response
# Note: Please Don't edit this file directly.
# Edit https://github.com/benbalter/shared-community-files instead.
# Number of days of inactivity before an Issue is closed for lack of response
daysUntilClose: 14
# Label requiring a response
responseRequiredLabel: more-information-needed
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
closeComment: >
This issue has been automatically closed because there has been no response
to our request for more information from the original author. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further.
jekyll-relative-links-0.7.0/.github/release-drafter.yml 0000664 0000000 0000000 00000000054 14360332564 0023074 0 ustar 00root root 0000000 0000000 template: |
## What's Changed
$CHANGES
jekyll-relative-links-0.7.0/.github/settings.yml 0000664 0000000 0000000 00000001510 14360332564 0021665 0 ustar 00root root 0000000 0000000 # Repository settings set via https://github.com/probot/settings
# Note: Please Don't edit this file directly.
# Edit https://github.com/benbalter/shared-community-files instead.
repository:
has_issues: true
has_wiki: false
has_projects: false
has_downloads: false
labels:
- name: help wanted
oldname: help-wanted
color: 0e8a16
- name: more-information-needed
color: d93f0b
- name: bug
color: b60205
- name: feature
color: 1d76db
- name: good first issue
color: "5319e7"
# Not currently implemented by probot/settings, but manually implemented in script/deploy
branch_protection:
restrictions: null
enforce_admins: false
required_status_checks:
strict: true
contexts:
- "continuous-integration/travis-ci"
required_pull_request_reviews:
require_code_owner_reviews: true
jekyll-relative-links-0.7.0/.github/stale.yml 0000664 0000000 0000000 00000001712 14360332564 0021141 0 ustar 00root root 0000000 0000000 # Configuration for probot-stale - https://github.com/probot/stale
# Note: Please Don't edit this file directly.
# Edit https://github.com/benbalter/shared-community-files instead.
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale Issue or Pull Request is closed
daysUntilClose: 7
# Issues or Pull Requests with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking as stale
staleLabel: wontfix
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
closeComment: false
# Limit to only `issues` or `pulls`
# only: issues
jekyll-relative-links-0.7.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14360332564 0021342 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/.github/workflows/ci.yml 0000664 0000000 0000000 00000001057 14360332564 0022463 0 ustar 00root root 0000000 0000000 name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7', '3.0']
jekyll-version: ["~> 3.0", "~> 4.0"]
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
env:
JEKYLL_VERSION: ${{ matrix.jekyll-version }}
- name: Run tests
run: script/cibuild
jekyll-relative-links-0.7.0/.github/workflows/codeql-analysis.yml 0000664 0000000 0000000 00000004433 14360332564 0025161 0 ustar 00root root 0000000 0000000 # For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '29 0 * * 6'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'ruby' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
jekyll-relative-links-0.7.0/.gitignore 0000664 0000000 0000000 00000000152 14360332564 0017733 0 ustar 00root root 0000000 0000000 /_site
/tmp
/spec/examples.txt
vendor/bundle
.bundle
/Gemfile.lock
*.gem
spec/fixtures/site/.jekyll-cache/ jekyll-relative-links-0.7.0/.rspec 0000664 0000000 0000000 00000000036 14360332564 0017061 0 ustar 00root root 0000000 0000000 --color
--require spec_helper
jekyll-relative-links-0.7.0/.rubocop.yml 0000664 0000000 0000000 00000000377 14360332564 0020226 0 ustar 00root root 0000000 0000000 inherit_from: .rubocop_todo.yml
require:
- rubocop-jekyll
- rubocop-performance
- rubocop-rspec
inherit_gem:
rubocop-jekyll: .rubocop.yml
AllCops:
Exclude:
- vendor/**/*
NewCops: enable
Metrics/BlockLength:
Exclude:
- spec/**/*
jekyll-relative-links-0.7.0/.rubocop_todo.yml 0000664 0000000 0000000 00000003776 14360332564 0021261 0 ustar 00root root 0000000 0000000 # This configuration was generated by
# `rubocop --auto-gen-config`
# on 2021-09-16 19:13:45 UTC using RuboCop version 1.18.4.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'jekyll-relative-links.gemspec'
# Offense count: 1
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 24
# Offense count: 1
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
Naming/VariableNumber:
Exclude:
- 'spec/jekyll-relative-links/generator_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: SafeMultiline.
Performance/DeletePrefix:
Exclude:
- 'lib/jekyll-relative-links/generator.rb'
# Offense count: 14
# Configuration parameters: Prefixes.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/jekyll-relative-links/generator_spec.rb'
# Offense count: 2
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/jekyll-relative-links/context_spec.rb'
- 'spec/jekyll-relative-links/generator_spec.rb'
# Offense count: 4
RSpec/MultipleExpectations:
Max: 2
# Offense count: 17
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 13
# Offense count: 10
# Configuration parameters: IgnoreSharedExamples.
RSpec/NamedSubject:
Exclude:
- 'spec/jekyll-relative-links/context_spec.rb'
- 'spec/jekyll-relative-links/generator_spec.rb'
# Offense count: 6
RSpec/NestedGroups:
Max: 5
jekyll-relative-links-0.7.0/Gemfile 0000664 0000000 0000000 00000000204 14360332564 0017234 0 ustar 00root root 0000000 0000000 # frozen_string_literal: true
source "https://rubygems.org"
gemspec
gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"]
jekyll-relative-links-0.7.0/LICENSE.md 0000664 0000000 0000000 00000002053 14360332564 0017351 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2016 Ben Balter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
jekyll-relative-links-0.7.0/README.md 0000664 0000000 0000000 00000005017 14360332564 0017227 0 ustar 00root root 0000000 0000000 # Jekyll Relative Links
[](https://github.com/benbalter/jekyll-relative-links/actions/workflows/ci.yml)
A Jekyll plugin to convert relative links to Markdown files to their rendered equivalents.
## What it does
Let's say you have a link like this in a Markdown file:
```
[foo](bar.md)
```
While that would render as a valid link on GitHub.com, it would not be a valid link on Pages. Instead, this plugin converts that link to:
```
[foo](bar.html)
```
It even work with pages with custom permalinks. If you have `bar.md` with the following:
```
---
permalink: /bar/
---
# bar
```
Then `[foo](bar.md)` will render as `[foo](/bar/)`.
The default Jekyll's configuration `permalink: pretty` in the `_config.yaml`
file removes the `.html` extensions from the generated links.
## Why
Because Markdown files rendered by GitHub Pages should behave similar to Markdown files rendered on GitHub.com
## Usage
1. Add the following to your site's Gemfile:
```ruby
gem 'jekyll-relative-links'
```
2. Add the following to your site's config file:
```yml
plugins:
- jekyll-relative-links
```
Note: If you are using a Jekyll version less than 3.5.0, use the `gems` key instead of `plugins`.
## Configuration
You can configure this plugin in `_config.yml` under the `relative_links` key. This is optional and defaults to:
```yml
relative_links:
enabled: true
collections: false
```
### Excluding files
To exclude specific directories and/or files:
```yml
relative_links:
exclude:
- directory
- file.md
```
### Processing Collections
Setting the `collections` option to `true` enables relative links from collection items (including posts).
Assuming this structure
~~~
├── _my_collection
│ ├── some_doc.md
│ └── some_subdir
│ └── another_doc.md
├── _config.yml
└── index.md
~~~
the following will work:
File | Link
-|-
`index.md` | `[Some Doc](_my_collection/some_doc.md)`
`index.md` | `[Another Doc](_my_collection/some_subdir/another_doc.md)`
`_my_collection/some_doc.md` | `[Index](../index.md)`
`_my_collection/some_doc.md` | `[Another Doc](some_subdir/another_doc.md)`
`_my_collection/some_subdir/another_doc.md` | `[Index](../../index.md)`
`_my_collection/some_subdir/another_doc.md` | `[Some Doc](../some_doc.md)`
### Disabling
Even if the plugin is enabled (e.g., via the `:jekyll_plugins` group in your Gemfile) you can disable it by setting the `enabled` key to `false`.
jekyll-relative-links-0.7.0/docs/ 0000775 0000000 0000000 00000000000 14360332564 0016675 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/docs/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000006213 14360332564 0021476 0 ustar 00root root 0000000 0000000 # Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers 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, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ben@balter.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
jekyll-relative-links-0.7.0/docs/CONTRIBUTING.md 0000664 0000000 0000000 00000013330 14360332564 0021126 0 ustar 00root root 0000000 0000000 # Contributing to Jekyll Relative Links
Hi there! We're thrilled that you'd like to contribute to Jekyll Relative Links. Your help is essential for keeping it great.
Jekyll Relative Links is an open source project supported by the efforts of an entire community and built one contribution at a time by users like you. We'd love for you to get involved. Whatever your level of skill or however much time you can give, your contribution is greatly appreciated. There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests, helping other users by commenting on issues, or writing code which can be incorporated into Jekyll Relative Links itself.
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests.
## How to report a bug
Think you found a bug? Please check [the list of open issues](https://github.com/benbalter/jekyll-relative-links/issues) to see if your bug has already been reported. If it hasn't please [submit a new issue](https://github.com/benbalter/jekyll-relative-links/issues/new).
Here are a few tips for writing *great* bug reports:
* Describe the specific problem (e.g., "widget doesn't turn clockwise" versus "getting an error")
* Include the steps to reproduce the bug, what you expected to happen, and what happened instead
* Check that you are using the latest version of the project and its dependencies
* Include what version of the project your using, as well as any relevant dependencies
* Only include one bug per issue. If you have discovered two bugs, please file two issues
* Include screenshots or screencasts whenever possible
* Even if you don't know how to fix the bug, including a failing test may help others track it down
**If you find a security vulnerability, do not open an issue. Please email ben@balter.com instead.**
## How to suggest a feature or enhancement
If you find yourself wishing for a feature that doesn't exist in Jekyll Relative Links, you are probably not alone. There are bound to be others out there with similar needs. Many of the features that Jekyll Relative Links has today have been added because our users saw the need.
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and goals of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible, including describing the problem you're trying to solve.
[Open an issue](https://github.com/benbalter/jekyll-relative-links/issues/new) which describes the feature you would like to see, why you want it, how it should work, etc.
## Your first contribution
We'd love for you to contribute to the project. Unsure where to begin contributing to Jekyll Relative Links? You can start by looking through these "good first issue" and "help wanted" issues:
* [Good first issues](https://github.com/benbalter/jekyll-relative-links/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) - issues which should only require a few lines of code and a test or two
* [Help wanted issues](https://github.com/benbalter/jekyll-relative-links/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) - issues which may be a bit more involved, but are specifically seeking community contributions
*p.s. Feel free to ask for help; everyone is a beginner at first* :smiley_cat:
## How to propose changes
Here's a few general guidelines for proposing changes:
* If you are changing any user-facing functionality, please be sure to update the documentation
* If you are adding a new behavior or changing an existing behavior, please be sure to update the corresponding test(s)
* Each pull request should implement **one** feature or bug fix. If you want to add or fix more than one thing, submit more than one pull request
* Do not commit changes to files that are irrelevant to your feature or bug fix
* Don't bump the version number in your pull request (it will be bumped prior to release)
* Write [a good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
At a high level, [the process for proposing changes](https://guides.github.com/introduction/flow/) is:
1. [Fork](https://github.com/benbalter/jekyll-relative-links/fork) and clone the project
2. Configure and install the dependencies: `script/bootstrap`
3. Make sure the tests pass on your machine: `script/cibuild`
4. Create a descriptively named branch: `git checkout -b my-branch-name`
5. Make your change, add tests and documentation, and make sure the tests still pass
6. Push to your fork and [submit a pull request](https://github.com/benbalter/jekyll-relative-links/compare) describing your change
7. Pat your self on the back and wait for your pull request to be reviewed and merged
**Interesting in submitting your first Pull Request?** It's easy! You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
## Bootstrapping your local development environment
`script/bootstrap`
## Running tests
`script/cibuild`
## Code of conduct
This project is governed by [the Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
## Additional Resources
* [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/)
* [Using Pull Requests](https://help.github.com/articles/using-pull-requests/)
* [GitHub Help](https://help.github.com)
jekyll-relative-links-0.7.0/docs/SECURITY.md 0000664 0000000 0000000 00000000155 14360332564 0020467 0 ustar 00root root 0000000 0000000 # Security Policy
To report a security vulnerability, please email [ben@balter.com](mailto:ben@balter.com).
jekyll-relative-links-0.7.0/jekyll-relative-links.gemspec 0000664 0000000 0000000 00000002075 14360332564 0023537 0 ustar 00root root 0000000 0000000 # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("lib", __dir__)
require "jekyll-relative-links/version"
Gem::Specification.new do |s|
s.name = "jekyll-relative-links"
s.version = JekyllRelativeLinks::VERSION
s.authors = ["Ben Balter"]
s.email = ["ben.balter@github.com"]
s.homepage = "https://github.com/benbalter/jekyll-relative-links"
s.summary = "A Jekyll plugin to convert relative links to markdown files " \
"to their rendered equivalents.\n"
s.files = `git ls-files app lib`.split("\n")
s.platform = Gem::Platform::RUBY
s.require_paths = ["lib"]
s.license = "MIT"
s.add_dependency "jekyll", ">= 3.3", "< 5.0"
s.add_development_dependency "kramdown-parser-gfm", "~> 1.0"
s.add_development_dependency "rspec", "~> 3.5"
s.add_development_dependency "rubocop", "~> 1.0"
s.add_development_dependency "rubocop-jekyll", "~> 0.10"
s.add_development_dependency "rubocop-performance", "~> 1.5"
s.add_development_dependency "rubocop-rspec", "~> 2.0"
end
jekyll-relative-links-0.7.0/lib/ 0000775 0000000 0000000 00000000000 14360332564 0016513 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/lib/jekyll-relative-links.rb 0000664 0000000 0000000 00000000264 14360332564 0023263 0 ustar 00root root 0000000 0000000 # frozen_string_literal: true
require "jekyll"
require_relative "jekyll-relative-links/generator"
require_relative "jekyll-relative-links/context"
module JekyllRelativeLinks
end
jekyll-relative-links-0.7.0/lib/jekyll-relative-links/ 0000775 0000000 0000000 00000000000 14360332564 0022734 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/lib/jekyll-relative-links/context.rb 0000664 0000000 0000000 00000000322 14360332564 0024742 0 ustar 00root root 0000000 0000000 # frozen_string_literal: true
module JekyllRelativeLinks
class Context
attr_reader :site
def initialize(site)
@site = site
end
def registers
{ :site => site }
end
end
end
jekyll-relative-links-0.7.0/lib/jekyll-relative-links/generator.rb 0000664 0000000 0000000 00000012203 14360332564 0025245 0 ustar 00root root 0000000 0000000 # frozen_string_literal: true
module JekyllRelativeLinks
class Generator < Jekyll::Generator
attr_accessor :site, :config
# Use Jekyll's native relative_url filter
include Jekyll::Filters::URLFilters
LINK_TEXT_REGEX = %r!(.*?)!.freeze
FRAGMENT_REGEX = %r!(#.+?|)?!.freeze
TITLE_REGEX = %r{(\s+"(?:\\"|[^"])*(? e
raise e unless e.to_s.start_with?("invalid byte sequence in UTF-8")
end
private
# Stores info on a Markdown Link (avoid rubocop's Metrics/ParameterLists warning)
Link = Struct.new(:link_type, :text, :path, :fragment, :title)
def link_parts(matches)
last_inline = 5
link_type = matches[2] ? :inline : :reference
link_text = matches[link_type == :inline ? 2 : last_inline + 1]
relative_path = matches[link_type == :inline ? 3 : last_inline + 2]
fragment = matches[link_type == :inline ? 4 : last_inline + 3]
title = matches[link_type == :inline ? 5 : last_inline + 4]
Link.new(link_type, link_text, relative_path, fragment, title)
end
def context
@context ||= JekyllRelativeLinks::Context.new(site)
end
def markdown_extension?(extension)
markdown_converter.matches(extension)
end
def markdown_converter
@markdown_converter ||= site.find_converter_instance(CONVERTER_CLASS)
end
def url_for_path(path)
path = CGI.unescape(path)
target = potential_targets.find { |p| p.relative_path.sub(%r!\A/!, "") == path }
relative_url(target.url) if target&.url
end
def potential_targets
@potential_targets ||= site.pages + site.static_files + site.docs_to_write
end
def path_from_root(relative_path, url_base)
is_absolute = relative_path.start_with? "/"
relative_path.sub!(%r!\A/!, "")
base = is_absolute ? "" : url_base
absolute_path = File.expand_path(relative_path, base)
absolute_path.sub(%r!\A#{Regexp.escape(Dir.pwd)}/!, "")
end
# @param link [Link] A Link object describing the markdown link to make
def replacement_text(link)
link.path << link.fragment if link.fragment
if link.link_type == :inline
"[#{link.text}](#{link.path}#{link.title})"
else
"\n[#{link.text}]: #{link.path}#{link.title}"
end
end
def absolute_url?(string)
return unless string
Addressable::URI.parse(string).absolute?
rescue Addressable::URI::InvalidURIError
nil
end
def fragment?(string)
string&.start_with?("#")
end
def replaceable_link?(string)
!fragment?(string) && !absolute_url?(string)
end
def option(key)
config[CONFIG_KEY] && config[CONFIG_KEY][key]
end
def disabled?
option(ENABLED_KEY) == false
end
def collections?
option(COLLECTIONS_KEY) == true
end
def excluded?(document)
return false unless option("exclude")
entry_filter = if document.respond_to?(:collection)
document.collection.entry_filter
else
global_entry_filter
end
entry_filter.glob_include?(option("exclude"), document.relative_path).tap do |excluded|
Jekyll.logger.debug(LOG_KEY, "excluded #{document.relative_path}") if excluded
end
end
def global_entry_filter
@global_entry_filter ||= Jekyll::EntryFilter.new(site)
end
def replace_relative_links_excerpt!(document)
document.data["excerpt"] = Jekyll::Excerpt.new(document) if document.data["excerpt"]
end
end
end
jekyll-relative-links-0.7.0/lib/jekyll-relative-links/version.rb 0000664 0000000 0000000 00000000122 14360332564 0024741 0 ustar 00root root 0000000 0000000 # frozen_string_literal: true
module JekyllRelativeLinks
VERSION = "0.7.0"
end
jekyll-relative-links-0.7.0/script/ 0000775 0000000 0000000 00000000000 14360332564 0017251 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/script/bootstrap 0000775 0000000 0000000 00000000032 14360332564 0021207 0 ustar 00root root 0000000 0000000 #!/bin/sh
bundle install
jekyll-relative-links-0.7.0/script/cibuild 0000775 0000000 0000000 00000000147 14360332564 0020614 0 ustar 00root root 0000000 0000000 #!/bin/sh
set -e
bundle exec rspec
bundle exec rubocop -S -D
gem build jekyll-relative-links.gemspec
jekyll-relative-links-0.7.0/spec/ 0000775 0000000 0000000 00000000000 14360332564 0016677 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/spec/fixtures/ 0000775 0000000 0000000 00000000000 14360332564 0020550 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/spec/fixtures/site/ 0000775 0000000 0000000 00000000000 14360332564 0021514 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/spec/fixtures/site/_items/ 0000775 0000000 0000000 00000000000 14360332564 0022774 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/spec/fixtures/site/_items/some-item.md 0000664 0000000 0000000 00000000141 14360332564 0025211 0 ustar 00root root 0000000 0000000 ---
---
# Some item
[Another Page](../another-page.md)
[A post](../_posts/2016-01-01-test.md)
jekyll-relative-links-0.7.0/spec/fixtures/site/_items/some-subdir/ 0000775 0000000 0000000 00000000000 14360332564 0025225 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/spec/fixtures/site/_items/some-subdir/another-item.md 0000664 0000000 0000000 00000000077 14360332564 0030147 0 ustar 00root root 0000000 0000000 ---
---
# Another item
[Another Page](../../another-page.md)
jekyll-relative-links-0.7.0/spec/fixtures/site/_items/static-file.md 0000664 0000000 0000000 00000000014 14360332564 0025515 0 ustar 00root root 0000000 0000000 Static file
jekyll-relative-links-0.7.0/spec/fixtures/site/_posts/ 0000775 0000000 0000000 00000000000 14360332564 0023023 5 ustar 00root root 0000000 0000000 jekyll-relative-links-0.7.0/spec/fixtures/site/_posts/2016-01-01-test.md 0000664 0000000 0000000 00000000704 14360332564 0025347 0 ustar 00root root 0000000 0000000 ---
excerpt_separator:
---
# Some post
[Another Page](../another-page.md)
[Page with permalink](../page-with-permalink.md)
[Reference link][reference]
[Reference with fragment][reference-with-fragment]
[Reference fragment with brackets][reference-brackets]
[Item](../_items/some-item.md)
[reference]: ../another-page.md
[reference-with-fragment]: ../another-page.md#foo
[reference-brackets]: ../another-page.md#(bar)
jekyll-relative-links-0.7.0/spec/fixtures/site/another-page.md 0000664 0000000 0000000 00000000051 14360332564 0024404 0 ustar 00root root 0000000 0000000 ---
---
# Another page
[Page](page.md)
jekyll-relative-links-0.7.0/spec/fixtures/site/html-page.html 0000664 0000000 0000000 00000000034 14360332564 0024255 0 ustar 00root root 0000000 0000000 ---
---