Skip to content

Commit

Permalink
Use Str\split_args_switched in generate-docs.php
Browse files Browse the repository at this point in the history
Summary: Closes #31

Reviewed By: fredemmott

Differential Revision: D5923425

Pulled By: fredemmott

fbshipit-source-id: a76f945e0082c8e1e0b20367f4bc04676ce7dcee
  • Loading branch information
kmeht authored and facebook-github-bot committed Sep 27, 2017
1 parent 34c5078 commit b885c0f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/generate-docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function createInDirectory($path): void {
);

foreach ($namespaces_funcs as $ns => $funcs) {
$file = $path.'/'.C\lastx(Str\split("\\", $ns)).'.md';
$file = $path.'/'.C\lastx(Str\split_args_switched($ns, "\\")).'.md';
file_put_contents(
$file,
$this->getMarkdownForNamespace($ns, $funcs),
Expand All @@ -57,7 +57,7 @@ public function createInDirectory($path): void {
$ns ==> sprintf(
" - [%s](%s)",
$ns,
C\lastx(Str\split("\\", $ns)).'.md',
C\lastx(Str\split_args_switched($ns, "\\")).'.md',
),
)
|>Str\join("\n", $$)
Expand Down Expand Up @@ -122,7 +122,7 @@ private function renderSignature(ScannedFunction $f): string {

if (
C\every(
Str\split("\n", $out),
Str\split_args_switched($out, "\n"),
$s ==> Str\length($s) < self::TARGET_LINE_LENGTH,
)
) {
Expand Down Expand Up @@ -245,12 +245,13 @@ private function renderDocComment(ScannedFunction $f): ?string {
if ($c === null || $c === '') {
fprintf(STDERR, "%s needs a doc comment\n", $f->getName());
return null;

}
return $c
|>Str\strip_prefix($$, '/**')
|>Str\strip_suffix($$, '*/')
|>Str\trim($$)
|>Str\split("\n", $$)
|>Str\split_args_switched($$, "\n")
|>Vec\map($$, $s ==> Str\trim(Str\strip_prefix(Str\trim($s), '*')))
|>Str\join("\n", $$)
|>$$."\n";
Expand Down

0 comments on commit b885c0f

Please sign in to comment.