Skip to content

Allow to build RST content strings #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2021

Conversation

javiereguiluz
Copy link
Collaborator

The common use case is to build all the RST contents stored in some dir. However, sometimes you need to build just the contents of a single file or a string. For example we need this for symfony.com, where many blog posts are written as RST contents.

This PR adds a new buildString(string $contents): BuildResult content to complement the current build(BuildConfig $config): BuildResult method.

I had to add some config options and methods ... please tell me what you think about their naming. Thanks!

@@ -30,6 +30,8 @@ class BuildConfig
private $subdirectoryToBuild;
private $excludedPaths;
private $fileFinder;
private $isContentAString;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private $isContentAString;
private $contentIsString;

?

@javiereguiluz javiereguiluz mentioned this pull request Jul 9, 2021
javiereguiluz added a commit that referenced this pull request Jul 15, 2021
This PR was merged into the main branch.

Discussion
----------

Don't output errors

This change is needed because otherwise, this happens:

https://github.com/doctrine/rst-parser/blob/54024026d64fff84de645537015e30709a123ab1/lib/ErrorManager.php#L27-L29

This `echo` outputs the errors to the console, which is not that bad ... but also to the webpage contents (e.g. when using #109 to parse RST blog posts).

We manage the build results and the errors explicitly, so we don't need this for Symfony docs. Thanks!

Commits
-------

e8e6ee2 Don't output errors
@javiereguiluz javiereguiluz merged commit 554351e into symfony-tools:main Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants