Socket
Socket
Sign inDemoInstall

gitbook-asciidoc

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitbook-asciidoc - npm Package Compare versions

Comparing version 0.2.4 to 1.0.0

lib/toasciidoc.js

11

lib/index.js

@@ -0,8 +1,5 @@

var htmlParser = require('gitbook-html');
var toHTML = require('./tohtml');
var toAsciidoc = require('./toasciidoc');
module.exports = {
summary: require("./summary"),
glossary: require("./glossary"),
langs: require("./langs"),
readme: require("./readme"),
page: require("./page")
};
module.exports = htmlParser.createParser(toHTML, toAsciidoc);
{
"name": "gitbook-asciidoc",
"version": "0.2.4",
"version": "1.0.0",
"homepage": "https://www.gitbook.com",

@@ -8,6 +8,5 @@ "description": "Parse AsciiDoc content for gitbook",

"dependencies": {
"q": "^1.1.2",
"lodash": "^3.2.0",
"asciidoctor.js": "1.5.3-preview.1",
"cheerio": "^0.19.0"
"asciidoctor.js": "1.5.5-1",
"gitbook-html": "1.0.0"
},

@@ -18,3 +17,3 @@ "devDependencies": {

"scripts": {
"test": "export TESTING=true; mocha --reporter list"
"test": "export TESTING=true; mocha --reporter list --bail"
},

@@ -21,0 +20,0 @@ "repository": {

@@ -7,6 +7,10 @@ var fs = require('fs');

var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GLOSSARY.adoc'), 'utf8');
var LEXED = glossary(CONTENT);
describe('Glossary parsing', function () {
var LEXED;
describe('Glossary parsing', function () {
before(function() {
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GLOSSARY.adoc'), 'utf8');
LEXED = glossary(CONTENT);
});
it('should only get heading + paragraph pairs', function() {

@@ -13,0 +17,0 @@ assert.equal(LEXED.length, 5);

var assert = require("assert");
global.assertObjectsEqual = function(o1, o2) {
assert.equal(JSON.stringify(o1, null, 4), JSON.stringify(o2, null, 4));
assert.equal(JSON.stringify(o1, null, 4), JSON.stringify(o2, null, 4));
};

@@ -7,6 +7,10 @@ var fs = require('fs');

var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/LANGS.adoc'), 'utf8');
var LEXED = langs(CONTENT);
describe('Languages parsing', function () {
var LEXED;
describe('Languages parsing', function () {
before(function() {
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/LANGS.adoc'), 'utf8');
LEXED = langs(CONTENT);
});
it('should detect paths and titles', function() {

@@ -13,0 +17,0 @@ assert.equal(LEXED[0].path,'en/');

@@ -7,17 +7,13 @@ var fs = require('fs');

function loadPage (name, options) {
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/' + name + '.adoc'), 'utf8');
return page(CONTENT, options).sections;
}
describe('Page parsing', function() {
var LEXED;
var LEXED = loadPage('PAGE');
describe('Page parsing', function() {
it('should detect sections', function() {
assert.equal(LEXED.length, 1);
before(function() {
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/PAGE.adoc'), 'utf8');
LEXED = page(CONTENT);
});
it('should gen content for normal sections', function() {
assert(LEXED[0].content);
it('should gen content', function() {
assert(LEXED.content);
});
});

@@ -7,8 +7,10 @@ var fs = require('fs');

describe('Readme parsing', function () {
var LEXED;
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/README.adoc'), 'utf8');
var LEXED = readme(CONTENT);
before(function() {
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/README.adoc'), 'utf8');
LEXED = readme(CONTENT);
});
describe('Readme parsing', function () {
it('should contain a title', function() {

@@ -15,0 +17,0 @@ assert(LEXED.title);

@@ -7,34 +7,44 @@ var fs = require('fs');

var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/SUMMARY.adoc'), 'utf8');
var LEXED = summary(CONTENT);
describe('Summary parsing', function () {
var LEXED, PART;
describe('Summary parsing', function () {
it('should detect chapters', function() {
assert.equal(LEXED.chapters.length, 5);
before(function() {
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/SUMMARY.adoc'), 'utf8');
LEXED = summary(CONTENT);
PART = LEXED.parts[0];
// todo: add support for parts in asciidoc
});
it('should detect parts', function() {
assert.equal(LEXED.parts.length, 1);
});
it('should detect articles', function() {
assert.equal(PART.articles.length, 5);
});
it('should support articles', function() {
assert.equal(LEXED.chapters[0].articles.length, 2);
assert.equal(LEXED.chapters[1].articles.length, 0);
assert.equal(LEXED.chapters[2].articles.length, 0);
assert.equal(PART.articles[0].articles.length, 2);
assert.equal(PART.articles[1].articles.length, 0);
assert.equal(PART.articles[2].articles.length, 0);
});
it('should detect paths and titles', function() {
assert(LEXED.chapters[0].path);
assert(LEXED.chapters[1].path);
assert(LEXED.chapters[2].path);
assert(LEXED.chapters[3].path);
assert.equal(LEXED.chapters[4].path, null);
assert(PART.articles[0].path);
assert(PART.articles[1].path);
assert(PART.articles[2].path);
assert(PART.articles[3].path);
assert.equal(PART.articles[4].path, null);
assert(LEXED.chapters[0].title);
assert(LEXED.chapters[1].title);
assert(LEXED.chapters[2].title);
assert(LEXED.chapters[3].title);
assert(LEXED.chapters[4].title);
assert(PART.articles[0].title);
assert(PART.articles[1].title);
assert(PART.articles[2].title);
assert(PART.articles[3].title);
assert(PART.articles[4].title);
});
it('should normalize paths from .md', function() {
assert.equal(LEXED.chapters[0].path,'chapter-1/README.adoc');
assert.equal(LEXED.chapters[1].path,'chapter-2/README.adoc');
assert.equal(LEXED.chapters[2].path,'chapter-3/README.adoc');
assert.equal(PART.articles[0].path,'chapter-1/README.adoc');
assert.equal(PART.articles[1].path,'chapter-2/README.adoc');
assert.equal(PART.articles[2].path,'chapter-3/README.adoc');
});

@@ -41,0 +51,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc