Merge pull request #229 from serokell/aeqz/#228-rename_local_file_reference_tag

[#228] Rename local file reference tag
This commit is contained in:
Adrián Enríquez 2022-12-01 20:15:20 +01:00 committed by GitHub
commit 8b2b04652f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 16 deletions

View File

@ -9,7 +9,7 @@ Unreleased
* [#176](https://github.com/serokell/xrefcheck/pull/176)
+ Enabled `autolink` extension for `cmark-gfm`, so now we're finding strings
like `www.google.com` or `https://google.com`, threating them as links
like `www.google.com` or `https://google.com`, treating them as links
and checking.
* [#175](https://github.com/serokell/xrefcheck/pull/175)
+ Reorganize top-level config keys.
@ -32,6 +32,9 @@ Unreleased
+ Use utf-8 compatible codepage on Windows
* [#224](https://github.com/serokell/xrefcheck/pull/224)
+ Now the program output does not contain unicode characters that are not widely supported.
* [#229](https://github.com/serokell/xrefcheck/pull/229)
+ Now we call references to anchors in current file (e.g. `[a](#b)`) as
`file-local` references instead of calling them `current file` (which was ambiguous).
0.2.2
==========
@ -46,7 +49,7 @@ Unreleased
+ Make `flavor` a required parameter.
* [#182](https://github.com/serokell/xrefcheck/pull/182)
+ Now we call references to anchors in current file (e.g. `[a](#b)`) as
`current file` references instead of calling them `local` (which was ambigious).
`current file` references instead of calling them `local` (which was ambiguous).
* [#188](https://github.com/serokell/xrefcheck/pull/188)
+ Added CLI option `--no-colors` that disables ANSI colors in output.
+ Automatically disable coloring if it is not supported

View File

@ -225,7 +225,7 @@ pattern PathSep <- (isPathSeparator -> True)
-- | Type of reference.
data LocationType
= CurrentFileLoc
= FileLocalLoc
-- ^ Reference to this file, e.g. @[a](#header)@
| RelativeLoc
-- ^ Reference to a file relative to given one, e.g. @[b](folder/file#header)@
@ -239,7 +239,7 @@ data LocationType
instance Given ColorMode => Buildable LocationType where
build = \case
CurrentFileLoc -> colorIfNeeded Green "current file"
FileLocalLoc -> colorIfNeeded Green "file-local"
RelativeLoc -> colorIfNeeded Yellow "relative"
AbsoluteLoc -> colorIfNeeded Blue "absolute"
ExternalLoc -> colorIfNeeded Red "external"
@ -254,7 +254,7 @@ isExternal = \case
-- | Whether this is a link to repo-local resource.
isLocal :: LocationType -> Bool
isLocal = \case
CurrentFileLoc -> True
FileLocalLoc -> True
RelativeLoc -> True
AbsoluteLoc -> True
ExternalLoc -> False
@ -263,7 +263,7 @@ isLocal = \case
-- | Get type of reference.
locationType :: Text -> LocationType
locationType location = case toString location of
[] -> CurrentFileLoc
[] -> FileLocalLoc
PathSep : _ -> AbsoluteLoc
'.' : PathSep : _ -> RelativeLoc
'.' : '.' : PathSep : _ -> RelativeLoc

View File

@ -420,7 +420,7 @@ verifyReference
let locType = locationType rLink
if shouldCheckLocType mode locType
then case locType of
CurrentFileLoc -> checkRef rAnchor fileWithReference
FileLocalLoc -> checkRef rAnchor fileWithReference
RelativeLoc -> checkRef rAnchor
(normalise $ takeDirectory fileWithReference
</> toString (canonizeLocalRef rLink))

View File

@ -15,7 +15,7 @@ assert_diff - <<EOF
=== Invalid references found ===
➥ In file ambiguous-anchors/a.md
bad reference (current file) at src:16:1-43:
bad reference (file-local) at src:16:1-43:
- text: "ambiguous anchor in this file"
- link: -
- anchor: some-text
@ -54,7 +54,7 @@ assert_diff - <<EOF
=== Invalid references found ===
➥ In file non-existing-anchors/a.md
bad reference (current file) at src:12:1-13:
bad reference (file-local) at src:12:1-13:
- text: "broken"
- link: -
- anchor: h3
@ -64,7 +64,7 @@ assert_diff - <<EOF
- h2 (header II) at src:8:1-5
➥ In file non-existing-anchors/a.md
bad reference (current file) at src:14:1-18:
bad reference (file-local) at src:14:1-18:
- text: "broken"
- link: -
- anchor: heading
@ -73,7 +73,7 @@ assert_diff - <<EOF
- the-heading (header I) at src:10:1-13
➥ In file non-existing-anchors/a.md
bad reference (current file) at src:16:1-31:
bad reference (file-local) at src:16:1-31:
- text: "broken"
- link: -
- anchor: really-unique-anchor

View File

@ -4,8 +4,8 @@
- SPDX-License-Identifier: MPL-2.0
-->
# Current file links
[existing-cf-ref](#current-file-links)
# File-local links
[existing-cf-ref](#file-local-links)
[bad-cf-ref](#bad)
# Relative links

View File

@ -1,7 +1,7 @@
=== Invalid references found ===
➥ In file dir1/dir2/d2f1.md
bad reference (current file) at src:9:1-18:
bad reference (file-local) at src:9:1-18:
- text: "bad-cf-ref"
- link: -
- anchor: bad

View File

@ -1,7 +1,7 @@
=== Invalid references found ===
➥ In file dir1/dir2/d2f1.md
bad reference (current file) at src:9:1-18:
bad reference (file-local) at src:9:1-18:
- text: "bad-cf-ref"
- link: -
- anchor: bad

View File

@ -1,7 +1,7 @@
=== Invalid references found ===
➥ In file dir1/dir2/d2f1.md
bad reference (current file) at src:9:1-18:
bad reference (file-local) at src:9:1-18:
- text: "bad-cf-ref"
- link: -
- anchor: bad