Comments (5)
Take a look at the formatDocstring()
function in coffeedoc.coffee
. It counts the number of leading spaces before each line in the docstring, and assumes the lowest number it finds to be the indentation level. It then removes that many spaces from each line.
This will not work if you use tabs for indentation. I didn't bother putting in code for this as I don't use tabs and wasn't sure how to determine docstring indentation for cases with mixed tabs and spaces etc. If you want to contribute a patch I'll happily merge your code.
from coffeedoc.
Regarding the mixed tabs and spaces issue:
I'd say this should be of no concern as it's generally considered bad practice. What's your opinion on that?
from coffeedoc.
Sure. Then the formatDocstring()
function just needs to figure out whether the code uses tabs or spaces, and then count them. Can you write a patch?
from coffeedoc.
Actually I have no experience in working with Node.js. So building, testing etc. would be quite time-consuming for me since I'd have to look up all the stuff.
However if I haven't overlooked anything it should suffice to replace the space with the \s
character class in the Regular Expressions on these lines: 149, 156, 157, 160. That would be equivalent to [ \t\r\n]
which should be OK since we're never dealing with newlines here. If it sounds safer you could still use [ \t]
instead.
The other thing that could be added is a warning when using mixed characters for indentation. But I think I could come up with something for that too...
from coffeedoc.
Looks good. Fixed in 00c52b3
from coffeedoc.
Related Issues (20)
- No --requirejs when installed via npm, version 0.1.11 HOT 2
- Sphinx integration HOT 2
- DocBlock before statements (functions) HOT 3
- Participate in DocSpec HOT 1
- I built coffeedoctest from coffeedoc HOT 2
- weird stuff happens with classes defined in index.coffee HOT 3
- Does not generate html files only index.html HOT 3
- Flag to ignore files or folders HOT 3
- HtmlRenderer() has no method 'renderIndex' HOT 1
- reserved word "private" HOT 4
- Classes and Functions inside a top-level function won't be parsed HOT 5
- String literal in the beginning of the class declaration makes coffeedoc to fail HOT 3
- Hide non-public class methods from documentation HOT 1
- Class instance method not documented HOT 2
- Suggestion: headers beyond h2 HOT 1
- Ability to hide functions starting with _? HOT 2
- Class docstring is null when using tabs for indenting HOT 6
- Top-level documentation comment not parsed when preceded by another line HOT 2
- <Object> has no method 'existsSync' HOT 4
- Feature Request: Don't render AST nodes that aren't commented HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coffeedoc.