Helper function to generate a page

 @param [Usmu::Template::Page] page
558708
def generate_page(page)
      output_filename = page.output_filename
      @log.success("creating #{output_filename}...")
      @log.debug("Rendering #{output_filename} from #{page.name}")
      file = File.join(@configuration.destination_path, output_filename)
      directory = File.dirname(file)

      unless File.directory?(directory)
        FileUtils.mkdir_p(directory)
      end

      File.write file, page.render

      FileUtils.touch file, mtime: page.mtime
      nil
    end
99080
def generate_pages(self):
		
		for page in self.pages:
			self.generate_page(page.slug, template='page.html.jinja', page=page)
97847
def render_page(path=None, user_content=False, context=None,
                username=None, password=None,
                render_offline=False, render_wide=False, render_inline=False,
                api_url=None, title=None, text=None, quiet=None,
                grip_class=None):
    
    return create_app(path, user_content, context, username, password,
                      render_offline, render_wide, render_inline, api_url,
                      title, text, False, quiet, grip_class).render()
594038
def generate_pagination
        total_records = @args[:records].is_a?(Hash) ? @args[:records][:total] : @args[:records].length
        total_records_per_page = @args[:records].is_a?(Hash) ? @args[:records][:per_page] : @args[:records].length
        total_pages = (total_records.to_f / total_records_per_page.to_f).ceil
        current_page = @args[:records].is_a?(Hash) ? @args[:records][:pagination] : 1

        search_value = @args[:records].is_a?(Hash) ? @args[:records][:search] : ''
        sort_value = @args[:records].is_a?(Hash) ? @args[:records][:sort] : ''
        sort_dir_value = @args[:records].is_a?(Hash) ? @args[:records][:sort_dir] : ''

        url = core__add_param_to_url(@args[:index_url], 'widget_index[search]', search_value)
        url = core__add_param_to_url(url, 'widget_index[sort]', sort_value)
        url = core__add_param_to_url(url, 'widget_index[sort_dir]', sort_dir_value)
        return LatoCore::Elements::Pagination::Cell.new(total: total_pages, current: current_page, url: url,
        param: 'widget_index[pagination]')
      end
438247
def page(name, attributes = {}, &block)
      page = Elements::Page.new(name, nil, @resolver, attributes, &block)
      pages << page if page.visible?
    end
1313968
def page(pattern: SCAN_PATTERN, cursor: 0, page_size: 100)
      redis do |conn|
        total_size, digests = conn.multi do
          conn.scard(UNIQUE_SET)
          conn.sscan(UNIQUE_SET, cursor, match: pattern, count: page_size)
        end

        [total_size, digests[0], digests[1]]
      end
    end
773463
def each_page
      page_obj = load_page(1)
      loop do
        yield page_obj
        break unless page_obj.has_next?
        page_obj = load_page(page_obj.next_page)
      end
    end
602067
def page(number)
      number = (n = number.to_i) > 0 ? n : 1
      Page.new(self, number, lambda {
                 offset = (number - 1) * @per_page
                 args = [offset]
                 args << @per_page if @select.arity == 2
                 @select.call(*args)
               })
    end
1147056
function createPage(filename) {
        let page = {
            path: filename,
            rawContent: fs.readFileSync(filename, "utf8"),
            name: path.basename(filename).replace(/\.[^/.]+$/, ""),
            filename: path.basename(filename),
            folder: path.dirname(filename),
            ext: path.extname(filename),
            userData: {}
        };
        page.isMarkdown = page.ext.toLocaleUpperCase() == ".MD";
        if (page.isMarkdown)
            page.ext = ".html";
        page.template = doT.template(page.rawContent, null, page.userData);
        page.outPath = path.join(path.relative(CONTENT, page.folder), page.name + page.ext);
        page.href = CONFIG.prefix + page.outPath;
        return page;
    }
109360
def set_page
      title = params[:id] || params[:page_id] || params[:path]
      raise ActiveRecord::RecordNotFound, "Unknown page request" unless title

      @page = select_page(title)

      unless @page
        if user_can?(:create_page)
          return redirect_to new_page_path(title: title)
        else
          if title == "Home"
            @page = special_page("Welcome")
          else
            raise ActiveRecord::RecordNotFound, "Could not find page '#{title}'"
          end
        end
      end
    end
182192
def create
      @page = ::Page.new(page_params)

      respond_to do |format|
        if @page.save
          format.html { redirect_to(cmtool.pages_path, :notice => I18n.t('cmtool.action.create.successful', :model => ::Page.model_name.human)) }
          format.xml  { render :xml => @page, :status => :created, :location => @page }
        else
          format.html { render :action => "new" }
          format.xml  { render :xml => @page.errors, :status => :unprocessable_entity }
        end
      end
    end
1154201
function pages(req, res, next) {

    generator.getPage(req.url, function(err, page) {

      if (err || !page || !checkMethod(req, page)) return next();

      if (!isPageAuthorized(req, page)) {
        if (!server.login || page.nologin) return next();
        return server.login(req, res);
      }

      debug('page %s', page._href);

      // make req and res available to dynamic pages
      generator.req = req;
      generator.res = res;

      resHeaders(res, page);
      res.send(generator.renderDoc(page));

    });
  }
1285206
def pages
      @pages ||= begin
        from = @page - (@size / 2).ceil
        from = 1 if from < 1
        upto = from + @size - 1

        # Correct +from+ and +to+ if +to+ is more than number of pages
        if upto > pages_count
          from -= (upto - pages_count)
          from = 1 if from < 1
          upto = pages_count
        end

        (from..upto).to_a
      end
    end
671631
private function _loadPage($page, $variables = false)
	{
		// Start the output buffer captain
		ob_start();

		// Store the page
		$this->page = $page;

		// Load the page that was requested
		$this->_loadFile($this->page, 'page', $variables);

		// If a template was set we need to get the page content and pass it to the template
		if ($this->template !== null) {
			// Set the template content var
			$this->_template_content = ob_get_clean();

			// Restart the buffer
			ob_start();

			// Load the template with any template vars that were passed in earlier
			// from the page
			$this->_loadFile($this->template, 'template', $this->_template_vars);
		}

		// And finally output everything in the buffer
		ob_end_flush();
	}
523240
protected function pages_prepare_next(){
		if($this->page_next<=$this->pages_count){
			$url=$this->generateurl($this->page_next);
			$this->pages[]=(object)array(
				'name'=>'&gt;',
				'url'=>$url,
				'active'=>($this->page_next==$this->page_active),
				'disabled'=>false
				);
			}else{
			$this->pages[]=(object)array(
				'name'=>'&gt;',
				'url'=>'',
				'active'=>false,
				'disabled'=>true
				);
			}
		}
1290428
static function PageUrl(Page $page, array $params = array(), $fragment = '')
    {
        $siteUrl = $page->GetSite()->GetUrl();
        $pageUrl = $page->GetUrl();
        if ($pageUrl == 'index.html') {
            $url = $siteUrl;
        }
        else {
            $url = Path::Combine($siteUrl, $pageUrl);
        }

        $oblParams = self::GatherParams($url);
        $urlObl = self::AttachObligatoryParams($url, $oblParams, $params);

        $urlAllParams = self::AttachMoreParams($urlObl, $oblParams, $params);
        return $fragment ? $urlAllParams . '#' . $fragment : $urlAllParams;
    }
1366816
def create_page(title, space, parrent_page_id=nil)
            params = { 'type' => 'page',
                'title' => title,
                'space' => {'key' => space},
                'body' => {
                    'storage' => {
                        'value' => ("#{ @body_message.to_json.gsub("&&", "&amp;&amp;").gsub(/\\u001b.../, "   ") }").force_encoding('UTF-8'),
                        'representation' => 'storage'
                        }
                    }
                }
            if parrent_page_id
                params['ancestors'] = [{'type' => 'page', 'id' => parrent_page_id}]
            end

            uri = URI.parse(@base_url)
            https = Net::HTTP.new(uri.host,uri.port)
            https.use_ssl = true
            # https.set_debug_output $stderr
            req = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})
            req.basic_auth(@user, @password)
            req['Accept'] = 'application/json'
            req.body = "#{params.to_json}"
            response = https.request(req)
            response = JSON.parse(response.body)
            if response["statusCode"] == 400
                puts response.inspect
                puts req.body.inspect
                puts "Create page: Error reporting to confluence: #{response["message"]}"
                raise "Create page: Error reporting to confluence: #{response["message"]}"
            else
                puts "Reported page creation."
            end
        end