Skip to content

Commit

Permalink
Add 'stuff' module jsdoc to sphinx
Browse files Browse the repository at this point in the history
This commit adds the autogenerated jsdoc output to our sphinx
documentation. Its main purpose is to serve as a proof of concept for
the new jsdoc-sphinx setup.
As part of this, the jsdoc markup within ``stuff.js`` had to be fixed as
the previous version was invalid.

Ref.: #257
  • Loading branch information
elbenfreund committed Apr 9, 2018
1 parent fb9ac92 commit 10aa305
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ or feel that topics are not covered properly.
packaging
versioning
styleguide
jsdoc/index
8 changes: 8 additions & 0 deletions docs/jsdoc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Index of Autodocumented (JSDoc) code
=====================================


.. toctree::

extension
Stuff
6 changes: 6 additions & 0 deletions docs/jsdoc/stuff.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Stuff.js
========

.. autofunction:: formatDuration
.. autofunction:: formatDurationHuman
.. autofunction:: formatDurationHours
14 changes: 7 additions & 7 deletions extension/stuff.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Copyright (c) 2016 - 2018 Eric Goller / projecthamster <elbenfreund@projecthamst

// Time formatting helpers

/* @function formatDuration
*
/**
* Return time-information formatted as '%HH:%MM'
*
* @function
* @param {int} - Total amount of seconds to represent.
*/
function formatDuration(total_seconds) {
Expand All @@ -38,11 +38,11 @@ function formatDuration(total_seconds) {
// This string formatting is not part of JS canon but provided by the shell environment.
return "%02d:%02d".format(hours, minutes);
}

/* @function formatDurationHuman
*
/**
* Return time-information as '%HHh %SSmin' or '%SSmin' (if hours=0).
*
* @function
*
* @param {int} - Total amount of seconds to represent.
*/
function formatDurationHuman(total_seconds) {
Expand All @@ -68,11 +68,11 @@ function formatDurationHuman(total_seconds) {
return result;
}

/* @function formatDurationHours
*
/**
* Return time-information as decimal (with one decimal place) amount of hours.
* Example: 'X.Yh'
*
* @function
* @param {int} - Total amount of seconds to represent.
*/
function formatDurationHours(seconds) {
Expand Down

0 comments on commit 10aa305

Please sign in to comment.