return self::_getFile(
['operation' => 'extractmarkdown',
'pdf' => $pdf,
- 'out' => $out], 0, false);
+ 'out' => $out], 0, $out . '/docling/p1.md');
});
}
return false;
}
- if ($checkOutput) {
- $output = trim($output);
+ if (is_bool($checkOutput)) {
+ if ($checkOutput) {
+ $output = trim($output);
- if (file_exists($output)) {
- $res = $output;
+ if (file_exists($output)) {
+ $res = $output;
+ } else {
+ $res = false;
+ }
} else {
- $res = false;
+ $res = true;
}
} else {
- $res = true;
+ $res = file_exists($checkOutput);
}
$time = round(microtime(true) - $start, 4);
public function getAccessibleFile($page, $format = 'md')
{
$compo = $this->getComposition()[$page];
- return self::_getDocument($compo[0])->getMarkdown($compo[1]);
+ if ($format === 'md') {
+ return self::_getDocument($compo[0])->getMarkdown($compo[1]);
+ }
}
public function getAccessibleContents($revision = 'latest')
return $json;
}
} else {
- return json_decode(gzdecode(file_get_contents($file)),true);
+ return json_decode(gzdecode(file_get_contents($file)), true);
}
}