Skip to content

Commit

Permalink
Add function noStandalone to disable --standalone
Browse files Browse the repository at this point in the history
This implementation keeps backwards-compability by adding `--standalone`
in `run()` per default but not adding it per default in `execute()`.

It still can be set explicitely with `standalone()`, resulting in
`execute()` passing `--standalone`.

Additionally it can be disabled explicitely with `noStandalone()`,
resulting in `run()` not passing `--standalone`.

Fixes: #31

Signed-off-by: Jonas <jonas@freesources.org>
  • Loading branch information
mejo- committed Jan 28, 2023
1 parent fa1a575 commit 1a2af0e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Pandoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Pandoc

protected $input;

protected $standalone = true;

protected $inputFile;

protected $from;
Expand Down Expand Up @@ -127,6 +129,14 @@ public function tocDepth($value)
public function standalone()
{
$this->option('standalone');
$this->standalone = true;

return $this;
}

public function noStandalone()
{
$this->standalone = false;

return $this;
}
Expand Down Expand Up @@ -197,10 +207,13 @@ public function execute(array $parameters = [])
public function run()
{
$parameters = [
'--standalone',
'--sandbox',
];

if ($this->standalone) {
array_push($parameters, '--standalone');
}

if ($this->inputFile) {
array_push($parameters, $this->inputFile);
}
Expand Down

0 comments on commit 1a2af0e

Please sign in to comment.