From Page(DictionaryBlock1, DictionaryBlock2) create new page with Page(dictionary1, dictionary2)
189764
private Page createPageWithExtractedDictionary(Page page)
    {
        Block[] blocks = new Block[page.getChannelCount()];
        Block dictionary = ((DictionaryBlock) page.getBlock(channels[0])).getDictionary();

        // extract data dictionary
        blocks[channels[0]] = dictionary;

        // extract hash dictionary
        if (inputHashChannel.isPresent()) {
            blocks[inputHashChannel.get()] = ((DictionaryBlock) page.getBlock(inputHashChannel.get())).getDictionary();
        }

        return new Page(dictionary.getPositionCount(), blocks);
    }
96287
def create_page(self, **extra_kwargs):
        
        with translation.override(self.default_language_code):
            # for evaluate the language name lazy translation
            # e.g.: settings.LANGUAGE_CODE is not "en"

            self.default_lang_name = dict(
                self.languages)[self.default_language_code]
            self.slug = self.get_slug(self.default_language_code,
                                      self.default_lang_name)
            assert self.slug != ""

        page = None
        parent = self.get_parent_page()
        if parent is not None:
            assert parent.publisher_is_draft == True, "Parent page '%s' must be a draft!" % parent

        if self.delete_first:
            if self.apphook_namespace is not None:
                pages = Page.objects.filter(
                    application_namespace=self.apphook_namespace,
                    parent=parent,
                )
            else:
                pages = Page.objects.filter(
                    title_set__slug=self.slug,
                    parent=parent,
                )
            log.debug("Delete %i pages...", pages.count())
            pages.delete()
        else:
            if self.apphook_namespace is not None:
                # Create a plugin page
                queryset = Page.objects.drafts()
                queryset = queryset.filter(parent=parent)
                try:
                    page = queryset.get(
                        application_namespace=self.apphook_namespace)
                except Page.DoesNotExist:
                    pass  # Create page
                else:
                    log.debug("Use existing page: %s", page)
                    created = False
                    return page, created
            else:
                # Not a plugin page
                queryset = Title.objects.filter(
                    language=self.default_language_code)
                queryset = queryset.filter(page__parent=parent)
                try:
                    title = queryset.filter(slug=self.slug).first()
                except Title.DoesNotExist:
                    pass  # Create page
                else:
                    if title is not None:
                        log.debug("Use page from title with slug %r",
                                  self.slug)
                        page = title.page
                        created = False

        if page is None:
            with translation.override(self.default_language_code):
                # set right translation language
                # for evaluate language name lazy translation
                # e.g.: settings.LANGUAGE_CODE is not "en"

                page = create_page(
                    title=self.get_title(self.default_language_code,
                                         self.default_lang_name),
                    menu_title=self.get_menu_title(self.default_language_code,
                                                   self.default_lang_name),
                    template=self.get_template(self.default_language_code,
                                               self.default_lang_name),
                    language=self.default_language_code,
                    slug=self.slug,
                    published=False,
                    parent=parent,
                    in_navigation=self.in_navigation,
                    apphook=self.apphook,
                    apphook_namespace=self.apphook_namespace,
                    **extra_kwargs)
                created = True
                log.debug("Page created in %s: %s", self.default_lang_name,
                          page)

        assert page.publisher_is_draft == True
        return page, created
598686
def do_add(argdict):
    ''''''
    site = make_site_obj(argdict)
    if not site.tree_ready:
        print "Cannot add page. You are not within a simplystatic \
tree and you didn't specify a directory."
        sys.exit()
    title = argdict['title']
    try: 
        new_page = site.add_page(title)
        new_page.write()
        print "Added page '"+ title + "'"
    except ValueError as e: # pragma: no cover
        print "Attempted to create a page which already exists."
        sys.exit()
845693
def insert_page(n, page)
            raise IndexError, "Page numbers are referenced starting from 1" if n < 1

            kids = self.Kids
            unless kids.is_a?(Array)
                raise InvalidPageTreeError, "Kids must be an Array"
            end

            count = 0
            kids.each_with_index do |kid, index|
                node = kid.solve

                case node
                when Page
                    count = count + 1
                    if count == n
                        kids.insert(index, page)
                        page.Parent = self
                        self.Count += 1
                        return self
                    end

                when PageTreeNode
                    count = count + node.Count
                    if count >= n
                        node.insert_page(n - count + node.Count, page)
                        self.Count += 1
                        return self
                    end
                else
                    raise InvalidPageTreeError, "not a Page or PageTreeNode"
                end
            end

            raise IndexError, "Out of order page index" unless count + 1 == n

            self.append_page(page)
        end
959361
def new_page(record, values = [])
      idx = @page_counter
      @page_counter += 1
      mark_page_as_modified(IDListPage.new(self, record, idx, values))
      idx
    end
646059
def duplicate(page, parent = nil)
      new_element = self.class.new(self.attributes)
      case parent.class.to_s
      when ChoiceField
        new_element.conditional_id = parent.id
      when QuestionGrid, QuestionGridWithTotal
        new_element.question_grid_id = parent.id
      end
      new_element.save(:validate => false)
      PageElement.create(:element => new_element, :page => page) unless parent
      
      # duplicate children
      if respond_to?(:elements) && elements.present?
        elements.each {|e| e.duplicate(page, new_element)}
      end
      
      new_element
    end
192880
def create_page(pagename):
    
    page = pagename.lstrip("/").rstrip("/")
    _, _ext = os.path.splitext(pagename)

    # If the file doesn't have an extension, we'll just create one
    if not _ext or _ext == "":
        page += ".jade"

    if not page.endswith(PAGE_FORMAT):
        error("Can't create '%s'" % page)
        print("Invalid filename format")
        print("Filename must be in: '%s'" % " | ".join(PAGE_FORMAT))
    else:
        engine = Yass(CWD)
        markup = "jade"
        if page.endswith(".md"):
            markup = "md"
        if page.endswith(".html"):
            markup = "html"

        dest_file = os.path.join(engine.pages_dir, page)
        dest_dir = os.path.dirname(dest_file)

        content = TPL_HEADER
        content += TPL_BODY[markup]

        if os.path.isfile(dest_file):
            error("File exists already")
            print("Location: %s" % dest_file)

        else:
            if not os.path.isdir(dest_dir):
                os.makedirs(dest_dir)
            with open(dest_file, "w") as f:
                f.write(content)

            print("New page created: '%s'" % page)
            print("Location: %s" % dest_file)


    footer()
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;
    }
38342
def flush_pages(self, white_list):
        
        white_list_page_number = []

        for addr in white_list:
            for page_addr in range(addr[0], addr[1], self._page_size):
                white_list_page_number.append(page_addr // self._page_size)

        new_page_dict = {}

        # cycle over all the keys ( the page number )
        for page in self._pages:
            if page in white_list_page_number:
                # l.debug("Page " + str(page) + " not flushed!")
                new_page_dict[page] = self._pages[page]

        self._pages = new_page_dict
        self._initialized = set()
276366
def get_batch(sequence, size, start=0, endpoint=None, complete=False):
    

    batch = make_batch(sequence, size, start)

    return {
        "pagesize": batch.get_pagesize(),
        "next": batch.make_next_url(),
        "previous": batch.make_prev_url(),
        "page": batch.get_pagenumber(),
        "pages": batch.get_numpages(),
        "count": batch.get_sequence_length(),
        "items": make_items_for([b for b in batch.get_batch()],
                                endpoint, complete=complete),
    }
638305
def merge_pages(self, replacements):
         
         warnings.warn("merge_pages has been deprecated in favour of merge_templates",
                      category=DeprecationWarning,
                      stacklevel=2)         
         self.merge_templates(replacements, "page_break")
1114782
function read(src, basedir, callback){
  var page = new Page(src, basedir)

  page.read(callback)
}
1064741
def new(self, page_name, **dict):
        '''
        
        '''
        self._item_new_path = '/projects/%s/wiki/%s.json' % \
            (self._project.identifier, page_name)
        # Call the base class new method
        return super(Redmine_Wiki_Pages_Manager, self).new(**dict)
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
146125
def build_pages(self):
        
        for root, _, files in os.walk(self.pages_dir):
            base_dir = root.replace(self.pages_dir, "").lstrip("/")
            if not base_dir.startswith("_"):
                for f in files:
                    src_file = os.path.join(base_dir, f)
                    self._build_page(src_file)
1232333
public function CreatePage() 
	{
		parent::CreatePage(); 
	
		$this->_myWords = $this->WordCollection();
		
		$this->defaultXmlnukeDocument->addMenuItem("module:Xmlnuke.Admin.FileManagement",$this->_myWords->Value("FILEMANAGEMENT"),"");
		
		$this->_block = new XmlBlockCollection($this->_myWords->Value("FILEMANAGEMENT"), BlockPosition::Center);
		$this->setTitlePage($this->_myWords->Value("TITLE"));
		$this->setHelp($this->_myWords->Value("DESCRIPTION"));
		$this->defaultXmlnukeDocument->addXmlnukeObject($this->_block);
		
		
		//get the current folder
		$root = $this->_context->get("folder");
		
		$browser = new XmlFileBrowser($root, $this->_action, $this->_context);
		
		//SET FILEBROWSER ACESS LEVEL
		$processor = new AnydatasetFilenameProcessor("filemanagement");
		$processor->setFilenameLocation(ForceFilenameLocation::UseWhereExists );
		$anyDataSet = new AnyDataset($processor->FullQualifiedNameAndPath());

		$ignoreAdmin = false;

		$it = $anyDataSet->getIterator();
		while($it->hasNext())
		{
			$row = $it->moveNext();
			switch ($row->getField("type"))
			{
				case "INITIAL_DIR":
					$initial_dir = $row->getFieldArray("value");
					$browser->setSubFoldersPermitted($initial_dir);
					break;
				case "VALID_FILE_NEW":
					$file_new_list = $row->getFieldArray("value");
					$browser->setFileNewList($file_new_list);
					break;
				case "VALID_FILE_VIEW":
					$file_view_list = $row->getFieldArray("value");
					$browser->setFileViewList($file_view_list);
					break;
				case "VALID_FILE_EDIT":
					$file_edit_list = $row->getFieldArray("value");
					$browser->setFileEditList($file_edit_list);
					break;
				case "VALID_FILE_DELETE":
					$file_delete_list = $row->getFieldArray("value");
					$browser->setFileDeleteList($file_delete_list);
					break;
				case "VALID_FILE_UPLOAD":
					$file_upload_list = $row->getFieldArray("value");
					$browser->setFileUploadList($file_upload_list);
					break;
				case "VALID_FILE_MAX_UPLOAD":
					$file_max_upload = $row->getField("value");
					$browser->setFileMaxUpload($file_max_upload);
					break;
				case "PERMISSION":
					$browser->setFileNew($row->getField("file_new"));
					$browser->setFileView($row->getField("file_view"));
					$browser->setFileEdit($row->getField("file_edit"));
					$browser->setFileDelete($row->getField("file_delete"));
					$browser->setFileUpload($row->getField("file_upload"));
					$browser->setFolderNew($row->getField("folder_new"));
					$browser->setFolderView($row->getField("folder_view"));
					$browser->setFolderEdit($row->getField("folder_edit"));
					$browser->setFolderDelete($row->getField("folder_delete"));
					$ignoreAdmin = ($row->getField("ignore_admin")=="true");
					break;
			}
		}		
		
		if ($this->isUserAdmin() && !$ignoreAdmin)
			$browser->setUserType(FileBrownserUserType::ADMIN );
		
		$this->_block->addXmlnukeObject($browser);                                                                             
		
		return $this->defaultXmlnukeDocument->generatePage();
	}
222424
def pages_sub_menu(context, page, url='/'):
    
    lang = context.get('lang', pages_settings.PAGE_DEFAULT_LANGUAGE)
    page = get_page_from_string_or_id(page, lang)
    if page:
        root = page.get_root()
        children = root.get_children_for_frontend()
        context.update({'children': children, 'page': page})
    return context