Socket
Socket
Sign inDemoInstall

dss

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

55

dss.js

@@ -357,2 +357,57 @@ // DSS Object

// Describe detection pattern
dss.detector(function(line){
if(typeof line !== 'string')
return false;
var reference = line.split("\n\n").pop();
return !!reference.match(/.*@/);
});
// Describe parsing a name
dss.parser('name', function(i, line, block, file){
return line;
});
// Describe parsing a description
dss.parser('description', function(i, line, block, file){
return line;
});
// Describe parsing a state
dss.parser('state', function(i, line, block, file){
var state = line.split(' - ');
return {
name: (state[0]) ? _dss.trim(state[0]) : '',
escaped: (state[0]) ? _dss.trim(state[0].replace('.', ' ').replace(':', ' pseudo-class-')) : '',
description: (state[1]) ? _dss.trim(state[1]) : ''
};
});
// Describe parsing markup
dss.parser('markup', function(i, line, block, file){
var markup = block.split('').splice(i, block.length).join('');
markup = (function(markup){
var ret = [];
markup.split('\n').forEach(function(line){
var pattern = '*',
index = line.indexOf(pattern);
if(index > 0 && index < 10)
line = line.split('').splice((index + pattern.length), line.length).join('');
line = dss.trim(line);
if(line && line != '@markup')
ret.push(line);
});
return ret.join('');
})(markup);
return {
example: markup,
escaped: markup.replace(/</g, '&lt;').replace(/>/g, '&gt;')
};
});
// Module exports

@@ -359,0 +414,0 @@ if(typeof exports !== 'undefined'){

2

package.json
{
"name": "dss",
"description": "Documented Style Sheets",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/darcyclarke/dss",

@@ -6,0 +6,0 @@ "author": {

# DSS
**@version 1.0**
**@logo [DSS](http://f.cl.ly/items/1J353X3U172A1u3r2K3b/dss-logo.png)**
**version 1.0.1**
- **[Official Logo](http://f.cl.ly/items/1J353X3U172A1u3r2K3b/dss-logo.png)**
- **[NPM Package](https://npmjs.org/package/dss)**
**DSS**, Documented Style Sheets, is a parser and style guide that creates UI documentation objects from properly commented CSS, LESS, STYLUS, SASS and SCSS files.
**DSS**, Documented Style Sheets, is a comment styleguide and parser for CSS, LESS, STYLUS, SASS and SCSS code.
### Example Comment Block
## Generating Documentation
In most cases, you will want to include the **DSS** parser in a build step that will generate documentation files automatically. **[grunt-dss](https://github.com/darcyclarke/grunt-dss)** is the official **DSS** `grunt` task which does just that.
## Parser Example
#### Example Comment Block
```css

@@ -40,4 +47,15 @@ /**

### Example Generated Object
#### Example Parser Implementation
```javscript
var lines = fs.readFileSync('styles.css'),
options = {},
callback = function(parsed){
console.log(parsed);
};
dss.parse(lines, options, callback);
````
#### Example Generated Object
```javascript

@@ -75,1 +93,18 @@ {

````
## Modifying Parsers
**DSS**, by default, includes 4 parsers for the **name**, **description**, **states** and **markup** of a comment block. You can add to or override these default parsers using the following:
```javascript
// Matches @link
dss.parser('link', function(i, line, block){
// Replace link with HTML wrapped version
var exp = /(b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig;
line.replace(exp, "<a href='$1'>$1</a>");
return line;
});
````
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc