Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't link unknown parent classes

Summary: Fixes vast majority of bad links in generated docs.

Test Plan:
  phabricator/ $ diviner .

Looked at `class/ConduitException.html`, `class/ConduitCallTestCase.html` and `class/PhabricatorTestCase.html`.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3311
  • Loading branch information...
commit 64b668bfdd3104526d310ebb1f6ade4446d6c8b2 1 parent e2f050a
vrana authored
View
2  src/publisher/DivinerPublisher.php
@@ -120,7 +120,7 @@ protected function generateViews() {
continue 2;
}
- $views[] = $view;
+ $views[] = $view->setKnownAtoms($atoms);
}
return $views;
View
19 src/view/DivinerBaseAtomView.php
@@ -1,7 +1,7 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@
protected $docblockText;
protected $docblockMeta;
+ private $knownAtoms = array();
+
final public function __construct(DivinerAtom $atom) {
$this->atom = $atom;
}
@@ -31,6 +33,19 @@
return $this->atom;
}
+ final public function setKnownAtoms(array $atoms) {
+ assert_instances_of($atoms, 'DivinerAtom');
+ $this->knownAtoms = array();
+ foreach ($atoms as $atom) {
+ $this->knownAtoms[$atom->getType()][$atom->getName()] = true;
+ }
+ return $this;
+ }
+
+ final protected function isKnownAtom($type, $name) {
+ return isset($this->knownAtoms[$type][$name]);
+ }
+
final public function setRenderer(DivinerRenderer $renderer) {
$this->renderer = $renderer;
return $this;
@@ -104,7 +119,7 @@ protected function getAtomInfoDictionary() {
if ($group) {
$dict['Group'] = $renderer->renderGroup($group);
}
-
+
return $dict;
}
View
4 src/view/DivinerClassAtomView.php
@@ -40,7 +40,9 @@ protected function getAtomInfoDictionary() {
if ($atom->getParentClasses()) {
$extends = array();
foreach ($atom->getParentClasses() as $class) {
- $extends[] = $renderer->renderAtomLinkRaw('class', $class);
+ $extends[] = ($this->isKnownAtom(DivinerAtom::TYPE_CLASS, $class)
+ ? $renderer->renderAtomLinkRaw('class', $class)
+ : phutil_escape_html($class));
}
$dict['Extends'] = implode(', ', $extends);
}
Please sign in to comment.
Something went wrong with that request. Please try again.