set the generated BASE element's href to a new page's base path
346573
function( href ) {

            // we should do nothing if the user wants to manage their url base
            // manually
            if ( !$.mobile.dynamicBaseEnabled ) {
                return;
            }

            // we should use the base tag if we can manipulate it dynamically
            if ( $.support.dynamicBaseTag ) {
                base.element.attr( "href",
                    $.mobile.path.makeUrlAbsolute( href, $.mobile.path.documentBase ) );
            }
        }
47547
def base_url(self) -> _URL:
        """"""

        # Support for <base> tag.
        base = self.find('base', first=True)
        if base:
            result = base.attrs.get('href', '').strip()
            if result:
                return result

        # Parse the url to separate out the path
        parsed = urlparse(self.url)._asdict()

        # Remove any part of the path after the last '/'
        parsed['path'] = '/'.join(parsed['path'].split('/')[:-1]) + '/'

        # Reconstruct the url with the modified path
        parsed = (v for v in parsed.values())
        url = urlunparse(parsed)

        return url
718061
def html_page_context(app, pagename, templatename, context, doctree):
    ''' 

    '''
    site = context['SITEMAP_BASE_URL']
    version = context['version']
    app.sitemap_links.add(site + version + '/' + pagename + ".html")
387200
def _update_page(self, uri, path):
        """"""
        if uri in self._pages:
            self._pages[uri].update()
        else:
            self._pages[uri] = Page(uri=uri, path=path)
592177
def add_page(self, title=None, content=None, old_url=None,
                 tags=None, old_id=None, old_parent_id=None):
        
        if not title:
            text = decode_entities(strip_tags(content)).replace("\n", " ")
            title = text.split(". ")[0]
        if tags is None:
            tags = []
        self.pages.append({
            "title": title,
            "content": content,
            "tags": tags,
            "old_url": old_url,
            "old_id": old_id,
            "old_parent_id": old_parent_id,
        })
448324
function toRoute (pageDir, entry) {
  const page = '/' + relative(pageDir, entry)
  let base = page.split(extname(page)).join('')
  if (base[0] === '/') {
    base = base.substring(1)
  }
  if (base === 'index') {
    const dir = dirname(page)
    return dir + base
  } else {
    return '/' + base
  }
}
1224017
def base_link(rel, self_rel=False):
    """"""
    link = _BASE_LINKS[rel].copy()
    link['rel'] = 'self' if self_rel else rel
    return link
840848
function () {

            // Note: Controllers are responsible of setting needRedraw.
            if (this.needRedraw) {

                // Create root element for the page
                var page = document.createElement('div');
                page.style.display = 'block';
                page.setAttribute('data-role', 'page');

                // Create, render and add the header
                if (this.header) {
                    var header = document.createElement('div');
                    header.setAttribute('data-role', 'header');
                    this.header.setElement(header);
                    this.header.render();
                    page.appendChild(header);
                }

                // Create the content element
                var content = document.createElement('div');
                content.setAttribute('data-role', 'content');
                content.className = 'content';

                // Render the content
                this.content.setElement(content);
                this.content.render();

                // Make sure content fills the screen to the top/bottom
                // when no header/footer are provided.
                if (!this.header) {
                    content.style.top = '0';
                }
                if (!this.footer) {
                    content.style.bottom = '0';
                }

                page.appendChild(content);

                // Create, render and add the footer
                if (this.footer) {
                    var footer = document.createElement('div');
                    footer.setAttribute('data-role', 'footer');
                    this.footer.setElement(footer);
                    this.footer.render();
                    page.appendChild(footer);
                }

                // Add the page into the DOM.
                if (this.el.firstChild) {
                    this.el.replaceChild(page, this.el.firstChild);
                }
                else {
                    this.el.appendChild(page);
                }
 
                this.needRedraw = false;
            }
        }
361148
function(pageComponent, pageBase, complete) {
  if (arguments.length == 2) {
    complete = pageBase;
    pageBase = undefined;
  }
  if (typeof pageComponent == 'string') {
    zest.require([pageComponent], function(pageComponent) {
      createPage(pageComponent, pageBase, complete);
    });
    return;
  }

  // create a fresh page structure, inheriting from the page base
  pageComponent = zoe.create([Page, {
    requireConfig: zest.config.require.client,
    requireUrl: '/' + zest.config.baseDir + (zest.builtLayers ? '/zest/layer.js' : '/require.js')
  }].concat(pageBase ? [pageBase, pageComponent] : [pageComponent]));
  
  //process page layers to include the paths config
  if (zest.builtLayers) {
    pageComponent.layers = pageComponent.layers || [];
    pageComponent.layers.unshift('zest/layer');
    for (var i = 0; i < pageComponent.layers.length; i++) {
      var layerName = pageComponent.layers[i];
      var layer = zest.builtLayers[layerName];
      if (!layer) {
        console.log(zest.builtLayers);
        console.log('Build layer ' + layerName + ' not found for page inclusion.');
        continue;
      }
      for (var j = 0; j < layer.length; j++)
        pageComponent.requireConfig.paths[layer[j]] = layerName;
    }

    // if separate CSS, include as link tag
    if (zest.config.require.build.zestLayer.separateCSS) {
      pageComponent.head = pageComponent.head || [];
      pageComponent.head.push('<link rel="stylesheet" href="/' + zest.config.baseDir + '/zest/layer.css"></link>');
    }
  }
  complete(pageComponent);
}
1316213
function regenerateLink(base, link) {
  const parsedBase = (0, _url.parse)(base);
  const parsedLink = link.split("/");
  let parts = [];
  let port = "";

  if (!link.startsWith("/")) {
    parts = parsedBase.pathname.split("/");
    parts.pop();
  }

  for (const part of parsedLink) {
    // Current directory:
    if (part === ".") {
      continue;
    } // Parent directory:


    if (part === "..") {
      // Accessing non-existing parent directories:
      if (!parts.pop() || parts.length === 0) {
        return null;
      }
    } else {
      parts.push(part);
    }
  }

  if (parsedBase.port) {
    port = ":" + parsedBase.port;
  } // eslint-disable-next-line max-len


  return `${parsedBase.protocol}//${parsedBase.hostname}${port}${parts.join("/")}`;
}
1322515
def import_page(path, parent)
      slug = path.split("/").last

      # setting page record
      page =
        if parent.present?
          child = site.pages.where(slug: slug).first_or_initialize
          child.parent = parent
          child
        else
          site.pages.root || site.pages.new(slug: slug)
        end

      content_path = File.join(path, "content.html")

      # If file is newer than page record we'll process it
      if fresh_seed?(page, content_path)

        # reading file content in, resulting in a hash
        fragments_hash  = parse_file_content(content_path)

        # parsing attributes section
        attributes_yaml = fragments_hash.delete("attributes")
        attrs           = YAML.safe_load(attributes_yaml)

        # applying attributes
        layout = site.layouts.find_by(identifier: attrs.delete("layout")) || parent.try(:layout)
        category_ids    = category_names_to_ids(page, attrs.delete("categories"))
        target_page     = attrs.delete("target_page")

        page.attributes = attrs.merge(
          layout: layout,
          category_ids: category_ids
        )

        # applying fragments
        old_frag_identifiers = page.fragments.pluck(:identifier)

        new_frag_identifiers, fragments_attributes =
          construct_fragments_attributes(fragments_hash, page, path)
        page.fragments_attributes = fragments_attributes

        if page.save
          message = "[CMS SEEDS] Imported Page \t #{page.full_path}"
          ComfortableMexicanSofa.logger.info(message)

          # defering target page linking
          if target_page.present?
            self.target_pages ||= {}
            self.target_pages[page.id] = target_page
          end

          # cleaning up old fragments
          page.fragments.where(identifier: old_frag_identifiers - new_frag_identifiers).destroy_all

        else
          message = "[CMS SEEDS] Failed to import Page \n#{page.errors.inspect}"
          ComfortableMexicanSofa.logger.warn(message)
        end
      end

      import_translations(path, page)

      # Tracking what page from seeds we're working with. So we can remove pages
      # that are no longer in seeds
      seed_ids << page.id

      # importing child pages (if there are any)
      Dir["#{path}*/"].each do |page_path|
        import_page(page_path, page)
      end
    end
21701
function(href) {
        var node = this.createElementDefaultNS("OnlineResource");
        this.setAttributeNS(node, this.namespaces.xlink, "xlink:type", "simple");
        this.setAttributeNS(node, this.namespaces.xlink, "xlink:href", href);
        return node;
    }
927873
function _default(base, link) {
  // Dynamic stuff:
  if (typeof link !== "string" || link.match(REGEX_DYNAMIC)) {
    return base;
  } // Link is absolute:


  if (link.match(REGEX_ABSOLUTE)) {
    try {
      const parsedBase = parseLink(base);
      const parsedLink = parseLink(link); // Both `base` and `link` are on different domains:

      if (parsedBase.domain !== parsedLink.domain) {
        return false;
      } // Absolute path from same domain:


      if (parsedLink.path) {
        return (0, _url.resolve)(base, parsedLink.path);
      } // Same domains without path:


      return (0, _url.parse)(base).href;
    } catch (err) {
      return false;
    }
  } // Relative stuff:


  return regenerateLink(base, link);
}
574258
function setActivePage() {
		
			$('.page').removeClass('active').hide();
			var path = $.address.path();
			path = path.slice(1, path.length);
			path = giveDetailUrl() != -1 ? portfolioKeyword : path;
			if(path == "") {  // if hash tag doesnt exists - go to first page
				var firstPage = $('.vs-nav li').first().find('a').attr('href');
				path = firstPage.slice(2,firstPage.length);
				$.address.path(path);
				return false;
				}
			
			// show page
			$('#'+ path).fadeIn();
			$('.page.active').hide();
			$('#'+ path).addClass('active');
			setCurrentMenuItem();
			
			if(path.indexOf(portfolioKeyword) != -1) {
				setTimeout(function() { setMasonry(); }, 100);
			} 
			$("body").scrollTop(0);

	}
1334071
function(page) {
      var t = this,
          newPages = t.pages.slice(0);
      newPages.push(page);
      t.tour.set('pages', newPages);
      t.tour.isDirty = true;
      t.setDirty(true);
      t.loadForm();
    }
669988
def add_html_link(app, pagename, templatename, context, doctree):
    """"""
    base_url = app.config['html_theme_options'].get('base_url', '')
    if base_url:
        app.sitemap_links.append(base_url + pagename + ".html")
1114782
function read(src, basedir, callback){
  var page = new Page(src, basedir)

  page.read(callback)
}