articles = [generate_article]
422441
def reply_news_message(from=nil, to=nil, articles)
      message = NewsReplyMessage.new
      message.FromUserName = from || @weixin_message.ToUserName
      message.ToUserName   = to   || @weixin_message.FromUserName
      message.Articles     = articles
      message.ArticleCount = articles.count
      encrypt_message message.to_xml
    end
556303
def create
      @article = Article.new(params[:article])

      respond_to do |format|
        if @article.save
          format.html { redirect_to edit_category_article_path(@article.category, @article), notice: 'Article was successfully created.' }
          format.json { render json: @article, status: :created, location: @article }
        else
          format.html { render action: "new", :category_id => @article.category, :id => @article }
          format.json { render json: @article.errors, status: :unprocessable_entity }
        end
      end
    end
385669
def content_written(generator, content):
    
    url = "%s/%s" % (generator.settings.get('SITEURL', 'http://localhost:8000'), content.url)
    make_posts(generator, content.metadata, url)
87857
public function showArticles()
		{
			$form_data = array(
				'headers' => 1
			);
			$data = $this->call('showarticlelist', $form_data, 'csv');
			$csv = new \parseCSV($data);

			$articles = array();

			foreach ($csv->data as $article_item) {
				$article = new Article;
				$article
					->setId((int)$article_item['Article Number'])
					->setName((string)$article_item['Name'])
					->setDescription((string)$article_item['Article Description'])
					->setFolderId((int)$article_item['Folder ID']);
				$articles[] = $article;
			}

			return $articles;
		}
1080221
def create_recomended_articles(main_article, article_list):
    '''
    
    '''

    # store existing recommended articles
    existing_recommended_articles = [
        ra.recommended_article.specific
        for ra in main_article.recommended_articles.all()]
    # delete existing recommended articles
    ArticlePageRecommendedSections.objects.filter(page=main_article).delete()

    for hyperlinked_article in article_list:
        ArticlePageRecommendedSections(
            page=main_article,
            recommended_article=hyperlinked_article).save()

    # re-create existing recommended articles
    for article in existing_recommended_articles:
        if article not in article_list:
            ArticlePageRecommendedSections(
                page=main_article,
                recommended_article=article).save()
498350
private function InitArchiveArticles()
    {
        $sql = Access::SqlBuilder();
        $tblArticle = Article::Schema()->Table();
        $tblCategory = Category::Schema()->Table();
        $join = $sql->Join($tblCategory);
        $joinCond = $sql->Equals($tblArticle->Field('Category'), $tblCategory->Field('ID'));
        $orderBy = $sql->OrderList($sql->OrderDesc($tblArticle->Field('Created')));
        $where = $this->PublishedCondition()->
                And_($sql->Equals($tblCategory->Field('Archive'), $sql->Value($this->archive->GetID())));
        $this->articles = Article::Schema()->Fetch(false, $where, $orderBy, null, 
                $this->ArticleOffset(), $this->ArticleCount(), $join, Sql\JoinType::Inner(), $joinCond);
        $this->articlesTotal = Article::Schema()->Count(false, $where, null, $join, Sql\JoinType::Inner(), $joinCond);
    }
17238
def index
      respond_to do |format|
        format.html {
          @first_page = (params[:page] and params[:page].to_i > 0) ? false : true
          if params[:tag]
            @articles = Lines::Article.published.tagged_with(params[:tag]).page(params[:page].to_i)
          else
            @articles = Lines::Article.published.page(params[:page].to_i).padding(1)
          end
          
          if @articles.first_page?
            if @first_article = Article.published.first
              @first_article.teaser = nil unless @first_article.teaser.present?
            end
          end
          
          set_meta_tags title: SITE_TITLE,
                        description: CONFIG[:meta_description],
                        keywords: KEYWORDS,
                        open_graph: { title: SITE_TITLE,
                                        type: 'website',
                                        url: articles_url,
                                        site_name: SITE_TITLE,
                                        image: CONFIG[:og_logo]
                                      }

        }
        format.atom{
          @articles = Lines::Article.published
        }
      end
    end
715580
function editArticleInPart(part, level, newArticle) {
    var articles = part.getArticles();
    articles = editArticleInList(articles, level, newArticle);

    return part.set('articles', articles);
}
928907
def get_articles_per_page(self, per_page=1000, page=1, params=None):
        
        return self._get_resource_per_page(resource=ARTICLES, per_page=per_page, page=page, params=params)
62405
def generate_tags(self):
		
		for tag in self.tags:
			posts = self.get_posts(tag=tag, private=True)
			self.generate_page(['tags', tag.slug],
				template='archive.html.jinja', posts=posts)
107494
public function updateArticle(Article $article)
		{
			$form_data = array(
				'article_id' => $article->getId(),
				'article_name' => $article->getName(),
				'article_title' => $article->getTitle(),
				'article_description' => $article->getDescription(),
				'deck' => $article->getDeck(),
				'callout' => $article->getCallout(),
				'author_name' => $article->getAuthorName(),
				'author_bio' => $article->getAuthorBio(),
				'author_email' => $article->getAuthorEmail(),
				'folder_id' => $article->getFolderId(),
				'article_body' => $article->getBody()
			);
			$data = $this->call('updatearticle', $form_data);

			return TRUE;
		}
11256
def help_center_article_subscription_show(self, article_id, id, locale=None, **kwargs):
        ""
        api_path = "/api/v2/help_center/articles/{article_id}/subscriptions/{id}.json"
        api_path = api_path.format(article_id=article_id, id=id)
        if locale:
            api_opt_path = "/api/v2/help_center/{locale}/articles/{article_id}/subscriptions/{id}.json"
            api_path = api_opt_path.format(article_id=article_id, id=id, locale=locale)
        return self.call(api_path, **kwargs)
856429
def article_tag(title = nil, options = nil, &block)
      output = tag(:article, options, true)
      if title.present?
        output.safe_concat(
          content_tag("header") do
            content_tag("h1", title)
          end
        )
      end
      output.concat(capture(&block)) if block_given?
      output.safe_concat("</article>")
    end
183907
public function generateReplyArticles(Article $articles, $search = [], $replace = [])
    {
        $wei = $this->wei;
        $data = [];
        foreach ($articles as $article) {
            // 如果指定了关键词,替换描述内容里的关键词
            if ($search) {
                $article['title'] = str_replace($search, $replace, $article['title']);
                $article['intro'] = str_replace($search, $replace, $article['intro']);
            }

            // 上传的封面图片,不以http开头
            if (!$wei->isStartsWith($article['thumb'], 'http')) {
                $article['thumb'] = $wei->request->getUrlFor($article['thumb']);
            }

            $data[] = [
                'title' => $article['title'],
                'description' => $articles->length() > 1 ? '' : $article['intro'],
                'picUrl' => $article['thumb'],
                'url' => $article->getFullUrl(),
            ];
        }

        return $data;
    }
86422
function indexArticleLevels(article, baseLevel) {
    baseLevel = baseLevel || article.getLevel();
    var articles = article.getArticles();

    articles = articles.map(function(inner, i) {
        return indexArticleLevels(inner, baseLevel + '.' + (i + 1));
    });

    return article.merge({
        level: baseLevel,
        articles: articles
    });
}
108904
function genAttrs(attrs) {
    return _.reduce(attrs, (acc, v, k) => {
        let attr = ` ${k}`;
        if (v !== true) {
            attr += `="${v}"`;
        }
        return acc + attr;
    }, '');
}
992097
def create_article(tree, template, title, language, slug=None, description=None,
                   page_title=None, menu_title=None, meta_description=None,
                   created_by=None, image=None, publication_date=None, publication_end_date=None,
                   published=False, login_required=False, creation_date=None, categories=[]):
    

    # validate tree
    tree = tree.get_public_object()
    assert tree.application_urls == 'CMSArticlesApp'

    # validate template
    assert template in [tpl[0] for tpl in settings.CMS_ARTICLES_TEMPLATES]
    get_template(template)

    # validate language:
    assert language in get_language_list(tree.node.site_id), settings.CMS_LANGUAGES.get(tree.node.site_id)

    # validate publication date
    if publication_date:
        assert isinstance(publication_date, datetime.date)

    # validate publication end date
    if publication_end_date:
        assert isinstance(publication_end_date, datetime.date)

    # validate creation date
    if not creation_date:
        creation_date = publication_date
    if creation_date:
        assert isinstance(creation_date, datetime.date)

    # get username
    if created_by:
        try:
            username = created_by.get_username()
        except Exception:
            username = force_text(created_by)
    else:
        username = 'script'

    with current_user(username):
        # create article
        article = Article.objects.create(
            tree=tree,
            template=template,
            login_required=login_required,
            creation_date=creation_date,
            publication_date=publication_date,
            publication_end_date=publication_end_date,
            languages=language,
        )
        for category in categories:
            article.categories.add(category)

        # create title
        create_title(
            article=article,
            language=language,
            title=title,
            slug=slug,
            description=description,
            page_title=page_title,
            menu_title=menu_title,
            meta_description=meta_description,
            creation_date=creation_date,
            image=image,
        )

        # publish article
        if published:
            article.publish(language)

    return article.reload()