Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-theme into mikeharty-master
  • Loading branch information
ricardograca committed Jan 5, 2018
2 parents 17d69c4 + 41a45cc commit 081538c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
9 changes: 4 additions & 5 deletions publish.js
Expand Up @@ -141,11 +141,10 @@ function find(spec) {
return helper.find(data, spec);
}

function simplifyName(namepath) {
// Doesn't necessarily handle all types yet. Just doing this for events for now.
var regex = /"(.*)"$|[:#~.](\w*)$/;
function simplifyEventName(namepath) {
var regex = /#(event:)?(.*)$/;
var matches = namepath.match(regex);
return matches[1] || matches[2] || namepath;
return matches[2] || namepath;
}

function formattedParent(data) {
Expand Down Expand Up @@ -843,7 +842,7 @@ exports.publish = function(taffyData, opts, tutorials) {
view.elementId = elementId;
view.sectionId = sectionId;
view.subsectionId = subsectionId;
view.simplifyName = simplifyName;
view.simplifyEventName = simplifyEventName;
view.formattedParent = formattedParent;
view.resolveAuthorLinks = resolveAuthorLinks;
view.htmlsafe = htmlsafe;
Expand Down
12 changes: 8 additions & 4 deletions tmpl/method.tmpl
@@ -1,7 +1,7 @@
<?js
var data = obj;
var self = this;
var parent;
var parent;

var hasDescription = !_.isEmpty(data.description)
?>
Expand Down Expand Up @@ -76,9 +76,13 @@ var hasDescription = !_.isEmpty(data.description)

<?js if (data.fires && fires.length) { ?>
<h5>Fires</h5>
<ul class="fired-event-list"><?js fires.forEach(function(f) { ?>
<li class="fired-event-item"><code class="event-name"><?js= self.linkto(f, '"' + self.simplifyName(f) + '"') ?></code></li>
<?js }); ?></ul>
<ul class="fired-event-list">
<?js fires.forEach(function(f) { ?>
<li class="fired-event-item">
<code class="event-name"><?js= self.linkto(f, '"' + self.simplifyEventName(f) + '"') ?></code>
</li>
<?js }); ?>
</ul>
<?js } ?>

<?js if (data.listens && listens.length) { ?>
Expand Down

0 comments on commit 081538c

Please sign in to comment.