cecco974 / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

Enhancement: JSPlate removal of "cruft" lines, and <var ...> tag. #159

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Version 2.01 of JSDoc-Tookit.

Removal of cruft-lines:

Lines in templates which contain only JSPlate tags or code are put back
into the output as "blank" lines which contain only the remaining
whitespace. This bloats otherwise pretty outputted pages, and causes
developers to "get crafty" with their template to avoid it.

My fix removes all lines which contain *only* whitespace. Lines that are
intentionally blank (only line ending) are left alone. This isn't quite
perfect, and in a few spots, you might need two empty lines to get one (but
this isn't true for all).

JSPlate upgrade:

I added support for one other tag: var.
Var tags define a variable specified by the name attribute, and sets it
equal to the value attribute. Strings must be encased in a quote in
addition to the one you already have to have, because otherwise it would be
impossible to initialize variables to values such as data.something

See the attachment.

Original issue reported on code.google.com by mcbain....@gmail.com on 24 Jun 2008 at 5:39

Attachments:

GoogleCodeExporter commented 8 years ago
Syntax and examples for the new var tag:

<var name="title" value="data.alias"/>
<var name="count" value="0"/>
<var name="fixed" value="'string'"/>

The value in the name attribute will become the variables name, and the value 
will be
set as the value of the variable directly (not in quotes), therefore strings 
*must*
be escaped as shown.

<var name="" value="stuff"/>

is invalid syntax and as a result is not replaced/processed when it is found.

Original comment by mcbain....@gmail.com on 24 Jun 2008 at 3:50

GoogleCodeExporter commented 8 years ago
I figured that a diff would be more useful than the whole file. First time using
WinMerge, so I hope this is okay.

Original comment by mcbain....@gmail.com on 24 Jun 2008 at 11:44

Attachments:

GoogleCodeExporter commented 8 years ago
I'm accepting the "compact" option to JSDOC.JsPlate.prototype.process but I 
don't think the var tag is necessary: 
it can already be accomplished more flexibly like so:

{! var x = new Date(); !}

Original comment by micmath on 10 Jan 2009 at 12:04

GoogleCodeExporter commented 8 years ago
Committed in revision 758.

Original comment by micmath on 10 Jan 2009 at 12:23