This function will render a formatted URL for accessing the PLoS' server
        SingleRepresentation of an object.
772831
def fetch_single_representation(self, item_xlink_href):
        
        #A dict of URLs for PLoS subjournals
        journal_urls = {'pgen': 'http://www.plosgenetics.org/article/{0}',
                        'pcbi': 'http://www.ploscompbiol.org/article/{0}',
                        'ppat': 'http://www.plospathogens.org/article/{0}',
                        'pntd': 'http://www.plosntds.org/article/{0}',
                        'pmed': 'http://www.plosmedicine.org/article/{0}',
                        'pbio': 'http://www.plosbiology.org/article/{0}',
                        'pone': 'http://www.plosone.org/article/{0}',
                        'pctr': 'http://clinicaltrials.ploshubs.org/article/{0}'}
        #Identify subjournal name for base URl
        subjournal_name = self.article.doi.split('.')[2]
        base_url = journal_urls[subjournal_name]
        #Compose the address for fetchSingleRepresentation
        resource = 'fetchSingleRepresentation.action?uri=' + item_xlink_href
        return base_url.format(resource)
599074
def render(self, url, template=None, expiration=0):
        
        template = template or self.default_template
        
        return render_to_string(template, self.get_context(url, expiration))
958613
function formatURL(httpOptions) {
  var url;
  if (httpOptions.protocol) {
    url = httpOptions.protocol;
  } else {
    url = 'http:';
  }
  url += '//';
  if (httpOptions.auth) {
    url += httpOptions.auth + '@';
  }
  if (httpOptions.host) {
    url += httpOptions.host;
  } else if (httpOptions.hostname) {
    url += httpOptions.hostname;
  } else {
    url += 'localhost';
  }
  if (httpOptions.port && !url.includes(':' + httpOptions.port)) {
    url += ':' + httpOptions.port;
  }
  if (httpOptions.path) {
    url += httpOptions.path;
  } else {
    url += '/';
  }
  return url;
}
1033787
def create_url(url_protocol, host, api, url_params):
    
    is_batch = url_params.pop("batch", None)
    apis = url_params.pop("apis", None)
    version = url_params.pop("version", None) or url_params.pop("v", None)
    method = url_params.pop('method', None)

    host_url_seg = url_protocol + "://%s" % host
    api_url_seg = "/%s" % api
    batch_url_seg = "/batch" if is_batch else ""
    method_url_seg = "/%s" % method if method else ""

    params = {}
    if apis:
        params["apis"] = ",".join(apis)
    if version:
        params["version"] = version

    url = host_url_seg + api_url_seg + batch_url_seg + method_url_seg
    if params:
        url += "?" + urlencode(params)

    return url
563532
def render(object, options={}, return_obj=false)
      if options[:inspect]
        puts(object.inspect)
      else
        render_object(object, options, return_obj) unless silent_object?(object)
      end
    end
1098060
def render_local_template(service_name, environment, repo_root, template_file):
    
    cmd = 'cd {} && ef-cf {} {} --devel --verbose'.format(repo_root, template_file, environment)
    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = p.communicate()

    if p.returncode != 0:
        stderr = indentify('\n{}'.format(stderr))
        stdout = indentify('\n{}'.format(stdout))
        raise Exception('Service: `{}`, Env: `{}`, Msg: `{}{}`'
                        .format(service_name, environment, stderr, stdout))

    logger.debug('Rendered template for `%s` in `%s`', template_file, environment)

    r = re.match(r".*(^{.*^})$", stdout, re.MULTILINE | re.DOTALL)
    return jsonify(json.loads(r.group(1)))
1052171
function formatUrlPref(prefName) {
  var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
                     .getService(Ci.nsIURLFormatter);

  return formatter.formatURLPref(prefName);
}
656834
def display(url):
	""""""
	import os
	oscmd="curl --silent -g --fail --max-time 1800 --user jkavelaars '%s'" % (url)
	logger.debug(oscmd)
    	os.system(oscmd+' | xpaset ds9 fits')
	return
762233
def _url_format(self, service):
        
        base_service_url = '{base}{service}'.format(
            base=self.urlbase,
            service=service
        )
        return base_service_url
908755
def render_core(url_prefix, auth_header, resources):
    """"""
    code = ''
    code += "function(root, init) {\n"
    code += "  var q = init('%(auth_header)s', '%(url_prefix)s');\n" %\
        {'url_prefix': url_prefix, 'auth_header': auth_header}
    code += "  var r = null;\n"
    for key in resources:
        code += "  r = root.%(key)s = {};\n" % {'key': key}
        for action, item in resources[key].items():
            code += "    r.%(action)s = q('%(url)s', '%(method)s');\n" %\
                {'action': action,
                 'url': item['url'],
                 'method': item['method']}
    code += "}"
    return code
157780
def displayhtml(public_key,
                attrs,
                use_ssl=False,
                error=None):
    """"""

    error_param = ''
    if error:
        error_param = '&error=%s' % error

    if use_ssl:
        server = API_SSL_SERVER
    else:
        server = API_SERVER

    if 'lang' not in attrs:
        attrs['lang'] = get_language()[:2]

    return render_to_string(
        WIDGET_TEMPLATE,
        {'api_server': server,
         'public_key': public_key,
         'error_param': error_param,
         'lang': attrs['lang'],
         'options': mark_safe(json.dumps(attrs, indent=2))
         })
675713
function formatUrl (url, query) {
  let protocol
  let index = url.indexOf('://')
  if (index !== -1) {
    protocol = url.substring(0, index)
    url = url.substring(index + 3)
  } else if (url.indexOf('//') === 0) {
    url = url.substring(2)
  }

  let parts = url.split('/')
  let result = (protocol ? protocol + '://' : '//') + parts.shift()

  let path = parts.filter(Boolean).join('/')
  let hash
  parts = path.split('#')
  if (parts.length === 2) {
    path = parts[0]
    hash = parts[1]
  }

  result += path ? '/' + path : ''

  if (query && JSON.stringify(query) !== '{}') {
    result += (url.split('?').length === 2 ? '&' : '?') + formatQuery(query)
  }
  result += hash ? '#' + hash : ''

  return result
}
246063
def render_single(segments, article_url, status)
      # get content - if the admin isn't logged in your add the extra status requirements
      if !current_user.blank? && !params[:admin_preview].blank? && params[:admin_preview] == 'true'
        @content = Post.where("post_type = 'post' AND post_visible = 'Y' AND (post_status = 'Published' OR post_status = 'Draft')").find_by_post_slug(segments[1])
      else
        @content = Post.where(status + " AND post_type = 'post' AND post_visible = 'Y'").find_by_post_slug(segments[1])
      end

      render_404 and return if @content.nil?
      gloalize @content

      # create a new comment object for the comment form
      @new_comment = Comment.new

      # add the necessary breadcrumbs
      add_breadcrumb "#{article_url.capitalize}", "/#{article_url}", :title => I18n.t("helpers.routing_helper.generic.back_to", word: article_url.capitalize)
      add_breadcrumb "#{@content.post_title}", "/#{@content.post_title}", :title => I18n.t("helpers.routing_helper.generic.back_to", word: @content.post_title)

      # render the single template
      render_template 'article'

    end
1242478
function(_url,_data){
            var _sep = _url.indexOf('?')<0?'?':'&',
                _data = _data||'';
            if (_u._$isObject(_data))
                _data = _u._$object2query(_data);
            if (!!_data) _url += _sep+_data;
            return _url;
        }
401717
function serverDecorator (server, id, params = {}) {
  params = joi.attempt(params, internals.scheme.params)

  const route = Object.assign({}, lookupRoute(server, id))
  const routeSections = route.path.match(internals.regexp.params) || []

  routeSections.forEach((routeSection) => {
    const stripped = routeSection.replace(internals.regexp.braces, '')
    let parsed

    if (stripped.includes('?')) {
      parsed = parseOptional(params.params, routeSection, stripped)
    } else if (stripped.includes('*') && stripped.slice(-1) !== '*') {
      parsed = parseMulti(params.params, routeSection, stripped)
    } else {
      parsed = parsePlain(params.params, routeSection, stripped)
    }

    route.path = route.path.replace(parsed.dst, parsed.src)
  })

  if (params.query) {
    route.path += `?${qs.stringify(params.query)}`
    route.path = route.path.replace(/\?$/, '')
  }

  return route.path
}
1121439
public boolean renderURL(String urlstring, OutputStream out, Type type) throws IOException, SAXException
    {
        if (!urlstring.startsWith("http:") &&
            !urlstring.startsWith("https:") &&
            !urlstring.startsWith("ftp:") &&
            !urlstring.startsWith("file:"))
                urlstring = "http://" + urlstring;
        
        //Open the network connection 
        DocumentSource docSource = new DefaultDocumentSource(urlstring);
        
        //Parse the input document
        DOMSource parser = new DefaultDOMSource(docSource);
        Document doc = parser.parse();
        
        //create the media specification
        MediaSpec media = new MediaSpec(mediaType);
        media.setDimensions(windowSize.width, windowSize.height);
        media.setDeviceDimensions(windowSize.width, windowSize.height);

        //Create the CSS analyzer
        DOMAnalyzer da = new DOMAnalyzer(doc, docSource.getURL());
        da.setMediaSpec(media);
        da.attributesToStyles(); //convert the HTML presentation attributes to inline styles
        da.addStyleSheet(null, CSSNorm.stdStyleSheet(), DOMAnalyzer.Origin.AGENT); //use the standard style sheet
        da.addStyleSheet(null, CSSNorm.userStyleSheet(), DOMAnalyzer.Origin.AGENT); //use the additional style sheet
        da.addStyleSheet(null, CSSNorm.formsStyleSheet(), DOMAnalyzer.Origin.AGENT); //render form fields using css
        da.getStyleSheets(); //load the author style sheets
        
        BrowserCanvas contentCanvas = new BrowserCanvas(da.getRoot(), da, docSource.getURL());
        contentCanvas.setAutoMediaUpdate(false); //we have a correct media specification, do not update
        contentCanvas.getConfig().setClipViewport(cropWindow);
        contentCanvas.getConfig().setLoadImages(loadImages);
        contentCanvas.getConfig().setLoadBackgroundImages(loadBackgroundImages);

        if (type == Type.PNG)
        {
            contentCanvas.createLayout(windowSize);
            ImageIO.write(contentCanvas.getImage(), "png", out);
        }
        else if (type == Type.SVG)
        {
            setDefaultFonts(contentCanvas.getConfig());
            contentCanvas.createLayout(windowSize);
            Writer w = new OutputStreamWriter(out, "utf-8");
            writeSVG(contentCanvas.getViewport(), w);
            w.close();
        }
        
        docSource.close();

        return true;
    }
26988
def show
      if params[:page_name] == "website"
        return render json: Website.unique_instance.as_json_for_page
      end

      page = Pwb::Page.find_by_slug(params[:page_name])
      if page
        render json: page.as_json_for_admin
      else
        render json: {}
      end
    end