yiiapi/build/commands/GuideLatexCommand.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

class GuideLatexCommand extends CConsoleCommand
{
	function getHelp()
	{
		return <<<EOD
USAGE
  yiic guidelatex

DESCRIPTION
  This command generates latex files for the definitive guide.
  The generated latex files are stored in the guide directory.

EOD;
	}

	function getSourceDir()
	{
		return dirname(__FILE__).'/../../docs/guide';
	}

	function getOutputDir()
	{
		return dirname(__FILE__).'/guide';
	}

	function run($args)
	{
		require_once(dirname(__FILE__).'/markdown/MarkdownHtml2Tex.php');
		$sourcePath=$this->getSourceDir();
		$chapters=$this->getGuideTopics();
		$toc = '';
		foreach($chapters as $chapter=>$sections)
		{
			$toc .= sprintf("\\chapter{%s}\n", $chapter);
			foreach($sections as $path=>$section)
			{
				echo "creating '$section'...";
				$content=file_get_contents($sourcePath."/{$path}.txt");
				$this->createLatexFile($chapter,$section,$content, $path);
				echo "done\n";
				$toc .= sprintf("\\input{%s}\n", $path);
			}
		}
		$main_file = sprintf('%s/main.tex', $this->getOutputDir());
		file_put_contents($main_file, $toc);
	}

	function getGuideTopics()
	{
		$file = $this->getSourceDir().'/toc.txt';
		$lines=file($file);
		$chapter='';
		$guideTopics=array();
		foreach($lines as $line)
		{
			if(($line=trim($line))==='')
				continue;
			if($line[0]==='*')
后面还有 19 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。