Skip to content

Commit 0df5783

Browse files
committed
fixes in order that all the doc compiles
1 parent 92093f0 commit 0df5783

File tree

5 files changed

+36
-13
lines changed

5 files changed

+36
-13
lines changed

_build/composer.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_build/src/Command/ParseDoc.php

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
namespace SymfonyDocs\Command;
44

55
use Doctrine\RST\Builder;
6-
use Doctrine\RST\Event\PostBuildRenderEvent;
76
use Doctrine\RST\Event\PostNodeRenderEvent;
87
use Doctrine\RST\Event\PostParseDocumentEvent;
9-
use Doctrine\RST\Event\PreBuildParseEvent;
108
use Doctrine\RST\Event\PreBuildRenderEvent;
11-
use Doctrine\RST\Event\PreBuildScanEvent;
9+
use Doctrine\RST\Nodes\DocumentNode;
1210
use Symfony\Component\Console\Command\Command;
1311
use Symfony\Component\Console\Helper\ProgressBar;
1412
use Symfony\Component\Console\Input\InputInterface;
@@ -41,6 +39,7 @@ class ParseDoc extends Command
4139
private $htmlOutputDir;
4240
private $jsonOutputDir;
4341
private $parsedFiles = [];
42+
private $parseOnly;
4443

4544
public function __construct()
4645
{
@@ -57,12 +56,14 @@ protected function configure()
5756
$this
5857
->addOption('source-dir', null, InputOption::VALUE_REQUIRED, 'RST files Source directory', __DIR__.'/../../..')
5958
->addOption('html-output-dir', null, InputOption::VALUE_REQUIRED, 'HTML files output directory', __DIR__.'/../../html')
60-
->addOption('json-output-dir', null, InputOption::VALUE_REQUIRED, 'JSON files output directory', __DIR__.'/../../json');
59+
->addOption('json-output-dir', null, InputOption::VALUE_REQUIRED, 'JSON files output directory', __DIR__.'/../../json')->addOption('parse-only', null, InputOption::VALUE_OPTIONAL, 'Parse only given directory', null)
60+
// ->addOption('for-pdf', null, InputOption::VALUE_NONE, 'Export for pdf')
61+
;
6162
}
6263

6364
protected function initialize(InputInterface $input, OutputInterface $output)
6465
{
65-
$this->io = new SymfonyStyle($input, $output);
66+
$this->io = new SymfonyStyle($input, $output);
6667
$this->output = $output;
6768

6869
$this->sourceDir = $this->getRealAbsolutePath($input->getOption('source-dir'));
@@ -80,6 +81,11 @@ protected function initialize(InputInterface $input, OutputInterface $output)
8081
$this->filesystem->remove($this->jsonOutputDir);
8182
}
8283

84+
// $this->parseOnly = $this->getRealAbsolutePath($input->getOption('parse-only'));
85+
// if ($this->parseOnly && !$this->filesystem->exists($this->parseOnly)) {
86+
// throw new \InvalidArgumentException(sprintf('Given "parse-only" directory "%s" does not exist', $this->parseOnly));
87+
// }
88+
8389
$this->builder = new Builder(KernelFactory::createKernel());
8490
$eventManager = $this->builder->getConfiguration()->getEventManager();
8591
$eventManager->addEventListener(
@@ -117,7 +123,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
117123
}
118124
}
119125

120-
$this->io->note('Start transforming doc into json files');
126+
$this->io->note('Start exporting doc into json files');
121127
$this->progressBar = new ProgressBar($output, $this->finder->count());
122128
$jsonGenerator = new JsonGenerator($this->builder->getDocuments()->getAll());
123129
$jsonGenerator->generateJson($this->htmlOutputDir, $this->jsonOutputDir, $this->progressBar);
@@ -152,15 +158,27 @@ public function postParseDocument(PostParseDocumentEvent $postParseDocumentEvent
152158

153159
public function preBuildRender()
154160
{
155-
$eventManager = $this->builder->getConfiguration()->getEventManager();
161+
$eventManager = $this->builder->getConfiguration()->getEventManager();
156162
$eventManager->removeEventListener(
157163
[PostParseDocumentEvent::POST_PARSE_DOCUMENT],
158164
$this
159165
);
160166

161167
$this->progressBar->finish();
162168

169+
$this->progressBar = new ProgressBar($this->output);
170+
171+
$eventManager->addEventListener(
172+
[PostNodeRenderEvent::POST_NODE_RENDER],
173+
$this
174+
);
175+
163176
$this->io->newLine(2);
164177
$this->io->note('Start rendering in HTML...');
165178
}
179+
180+
public function postNodeRender()
181+
{
182+
$this->progressBar->advance();
183+
}
166184
}

_includes/_annotation_loader_tip.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
1818

1919
return $loader;
20+

reference/constraints/UniqueEntity.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ using an email address that already exists in the system.
1010
+----------------+-------------------------------------------------------------------------------------+
1111
| Options | - `fields`_ |
1212
| | - `message`_ |
13-
| | - `em`_ |
13+
| | - :ref:`em <reference-constraint-unique-entity-em>` |
1414
| | - `repositoryMethod`_ |
1515
| | - `errorPath`_ |
1616
| | - `ignoreNull`_ |
@@ -141,6 +141,8 @@ message
141141

142142
The message that's displayed when this constraint fails.
143143

144+
.. _reference-constraint-unique-entity-em:
145+
144146
em
145147
~~
146148

reference/forms/types/entity.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ objects from the database.
1414
+-------------+------------------------------------------------------------------+
1515
| Options | - `choice_label`_ |
1616
| | - `class`_ |
17-
| | - `em`_ |
17+
| | - :ref:`em <reference-forms-type-entity-em>` |
1818
| | - `query_builder`_ |
1919
+-------------+------------------------------------------------------------------+
2020
| Overridden | - `choice_name`_ |
@@ -187,6 +187,8 @@ The class of your entity (e.g. ``AppBundle:Category``). This can be
187187
a fully-qualified class name (e.g. ``AppBundle\Entity\Category``)
188188
or the short alias name (as shown prior).
189189

190+
.. _reference-forms-type-entity-em:
191+
190192
em
191193
~~
192194

0 commit comments

Comments
 (0)