Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip protocol #405

Merged
merged 4 commits into from
Jan 5, 2022
Merged

Strip protocol #405

merged 4 commits into from
Jan 5, 2022

Conversation

bwiernik
Copy link
Member

Description

Adds a style attribute specifying that https:// and http:// should be stripped from rendered URLs.

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist

  • I have installed the repo pre-commit hook; if not, and I have modified any of the schema files, I have run trang and/or prettier on the files, per CONTRIBUTING
  • I have performed a self-review of my own code
  • I have included suggested corresponding changes to the documentation (if relevant)

@bwiernik bwiernik changed the base branch from master to v1.1 December 30, 2021 19:32
@cormacrelf
Copy link

Implementation note: Technically you can come across FTP links, however rare these days (and browsers have stopped supporting them for whatever reason). It's possible we'll have academia using IPFS or something soon enough too. The appropriate way to deal with this is to have a whitelist that it applies to (not configurable per style), not to do it blindly. FTP and IPFS links should not have the protocol stripped because they're not implied by overwhelming common usage like http/https are.

Http/https should be the only ones. I'd also strip tel: and mailto: regardless of the flag, but not very important.

@bwiernik
Copy link
Member Author

bwiernik commented Dec 31, 2021

Yep, this would only apply to http/https and I think only to the URL field

@denismaier
Copy link
Member

That's not ready for review, right?

@bwiernik
Copy link
Member Author

bwiernik commented Jan 2, 2022

It's ready for review. It's just adding the one style attribute we discussed in the linked issue

@denismaier
Copy link
Member

But this commit only adds this to the list of possible options on cs:style. However, I think it does not define possible values for that option. Cf., e.g., this:

style.initialize-with-hyphen =
    
    ## Specify whether compound given names (e.g., "Jean-Luc") are
    ## initialized with ("J-L") or without a hyphen ("JL").
    [ a:defaultValue = "true" ]
attribute initialize-with-hyphen { xsd:boolean }?

So, I'd think something similar would be needed:

style.strip-url-protocol =
    
    ## Specify whether http/https should be stripped from urls
    [ a:defaultValue = "true" ]
attribute strip-url-protocol { xsd:boolean }?

Should the default value be true or false?

@bdarcus
Copy link
Member

bdarcus commented Jan 2, 2022

FWIW, relax ng doesn't truly support default values.

We include them for documentation purposes, where I think it does help add to the clarity.

@bwiernik
Copy link
Member Author

bwiernik commented Jan 2, 2022

@denismaier ah, right. Can you add that? Default to false

@denismaier
Copy link
Member

I don't know how to commit directly to your PR, but I'll add this as a suggestion.

@bwiernik bwiernik merged commit 929a9a6 into v1.1 Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add ability to remove protocol from URL
4 participants