absolutize 0

Absolutize is essentially a replication of the URI.join or URI.merge methods, however, these strictly adhere to html standards, unfortunately the rest of the world doesn’t. The absolutize gem attempts to replicate url parsing that browsers use, ignoring t

6 years after

h1. Absolutize v0.0.11

h2. Intro

Absolutize is essentially a replication of the URI.join or URI.merge methods, however, these strictly adhere to html standards, unfortunately the rest of the world doesn't. The absolutize gem attempts to replicate url parsing that browsers use, ignoring the encoding issues etc.

h2. Installation

Install absolutize as a gem

bq. gem install absolutize

h2. Usage

h4. new(base_url, options)

Creates a new absolutize object based on a base_url

  • base_url - This is the base url for the absolutize method, it should either be the url of the current page or if a base tag is supplied it should be the href attribute of the base tag

  • options - Options are passed in as a hash, :remove_anchors - removes any anchor tags (false) :force_escaping - forces escaping of urls if it hasn't been done already (true) :output_debug - puts debug info while processing the url (false) :raise_exceptions - raises exceptions when it can't parse a url, otherwise returns passed in value (false)

bq. absolutizer = Absolutize.new("http://www.vamosa.com/mainfolder/", :remove_anchors => true)

h4. url(rel_url)

Absolutizes the url that is passed in based on the options that have already been configured

  • rel_url - The url to absolutize, this is the url that is used on the page and should be absolutized in relation to the base url.

bq. absolutizer.url("subfolder/index.html")

h2. License

h3. The MIT License

Copyright (c) 2010 Vamosa Limited

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.

Related Repositories

aspectjs

aspectjs

Aspects for javascript ...

django-absoluteuri

django-absoluteuri

Absolute URI functions and template tags for Django ...

mail-tools

mail-tools

Utilities for the email template developer. ...

node-ams

node-ams

asset management system for nodejs ...

path-helper

path-helper

Helper class for creating relative paths, absolutizing paths,… ...


Top Contributors

stewartmckee