lo48576 / iri-string

String types for URIs/IRIs.
Apache License 2.0
15 stars 3 forks source link

Add relativizer #16

Open lo48576 opened 2 years ago

lo48576 commented 2 years ago

relativize_against() or similar functionalities would be useful for servers or static site generators.

lo48576 commented 2 years ago

What is the result of relativizing foo:////bar against foo://?

Would making the algorithm configurable be a solution?

lo48576 commented 2 years ago

Relativizing foo:///bar:baz against foo:/// would have similar problem. What is expected, bar:baz (interpretable as scheme=bar and path=baz), or ./bar:baz?

lo48576 commented 2 years ago

The two results would have different types (a path and a relative IRI reference), so maybe the feature should be provided by different names, for example relativize_as_path_against() and relativize_as_iri_ref_against().