Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rebber

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rebber - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

dist/custom-types/math.js

14

dist/custom-types/abbr.js
'use strict';
/* Dependencies. */
var all = require('../all');
module.exports = function (ctx, node) {
/* Expose. */
module.exports = abbr;
function abbr(ctx, node) {
var displayedText = all(ctx, node);
var signification = node.data.hProperties.title;
return ctx.abbr ? ctx.abbr(displayedText, signification) : '\\abbr{' + displayedText + '}{' + signification + '}';
};
if (ctx.abbr && typeof ctx.abbr === 'function') {
return ctx.abbr(displayedText, signification);
}
return '\\abbr{' + displayedText + '}{' + signification + '}';
}
'use strict';
/* Dependencies. */
var all = require('../all');
/* Expose. */
module.exports = align;

@@ -6,0 +8,0 @@

'use strict';
/* Dependencies. */
var all = require('../all');
/* Expose. */
module.exports = customBlock;

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

'use strict';
/* Dependencies. */
var baseCell = require('../types/tableCell');

@@ -7,2 +8,3 @@ var baseTable = require('../types/table');

/* Expose. */
module.exports = gridTable;

@@ -9,0 +11,0 @@

'use strict';
/* Dependencies. */
var all = require('../all');

@@ -4,0 +5,0 @@

'use strict';
var visit = require('unist-util-visit');
module.exports = plugin;
function plugin(ctx, root) {
return { codeInTableVisitor: codeInTableVisitor };
function codeInTableVisitor(node) {
var inAnnex = [];
var annexIndex = 1;
var appendiceVisitorFactory = function appendiceVisitorFactory(_ref) {
var title = _ref.title,
root = _ref.root;
return function (node) {
var inAppendix = [];
var appendixIndex = 1;
visit(node, 'code', function (innerNode, index, _parent) {
inAnnex.push({
inAppendix.push({
type: 'paragraph',
children: [{
type: 'definition',
identifier: 'annex-' + annexIndex,
identifier: 'appendix-' + appendixIndex,
referenceType: 'full',

@@ -23,19 +26,25 @@ children: [{ type: 'text', value: 'code' }]

type: 'linkReference',
identifier: 'annex-' + annexIndex
identifier: 'appendix-' + appendixIndex
};
_parent.children.splice(index, 1, referenceNode);
annexIndex++;
appendixIndex++;
});
if (inAnnex.length) {
if (inAppendix.length) {
root.children.push({
type: 'heading',
depth: 1,
children: [{ type: 'text', value: 'Annexe' }]
children: [{ type: 'text', value: title }]
});
inAnnex.forEach(function (element) {
inAppendix.forEach(function (element) {
return root.children.push(element);
});
}
}
};
};
function plugin(ctx, root) {
var title = ctx.codeAppendiceTitle || 'Appendices';
return { codeInTableVisitor: appendiceVisitorFactory({ title: title, root: root }) };
}

@@ -7,2 +7,3 @@ 'use strict';

var codePlugin = require('./codeVisitor');
var headingPlugin = require('./headingVisitor');

@@ -13,9 +14,11 @@ module.exports = preVisit;

var defaultVisitors = {
'tableCell': [codePlugin(ctx, root).codeInTableVisitor],
'definition': [referencePlugin(ctx).definitionVisitor],
'imageReference': [referencePlugin(ctx).imageReferenceVisitor]
tableCell: [codePlugin(ctx, root).codeInTableVisitor],
definition: [referencePlugin(ctx).definitionVisitor],
imageReference: [referencePlugin(ctx).imageReferenceVisitor],
heading: [headingPlugin(ctx)]
};
var visitors = xtend(defaultVisitors, ctx.preprocessors || {});
Object.keys(visitors).forEach(function (key) {
if (Array.isArray(visitors[key])) {

@@ -22,0 +25,0 @@ visitors[key].forEach(function (visitor) {

'use strict';
module.exports = plugin;
var identifiers = {};
function plugin() {

@@ -12,21 +14,23 @@ var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

};
function definitionVisitor(node, index, parent) {
var identifier = node.identifier;
while (Object.keys(identifiers).includes(identifier)) {
identifier += '-1';
}
identifiers[identifier] = node.url;
node.identifier = identifier; // force to remove doubly so that latex is compilable
if (node.referenceType === 'shortcut') {
// remark for abbr
}
parent.children.splice(index, 1);
}
function definitionVisitor(node, index, parent) {
var identifier = node.identifier;
while (Object.keys(identifiers).includes(identifier)) {
identifier += '-1';
}
function imageReferenceVisitor(node) {
node.type = 'image';
node.title = '';
node.url = identifiers[node.identifier];
identifiers[identifier] = node.url;
node.identifier = identifier; // force to remove twice so that latex compiles
if (node.referenceType === 'shortcut') {
// remark for abbr
parent.children.splice(index, 1);
}
}
function imageReferenceVisitor(node) {
node.type = 'image';
node.title = '';
node.url = identifiers[node.identifier];
}

@@ -9,2 +9,3 @@ 'use strict';

};
/* Stringify a break `node`. */

@@ -11,0 +12,0 @@ function br(ctx, node) {

'use strict';
var all = require('../all');
module.exports = notes;
var defaultMacro = function defaultMacro(text, isHeading) {
if (isHeading) {
var defaultMacro = function defaultMacro(text, protect) {
if (protect) {
return '\\protect\\footnote{' + text + '}';

@@ -13,5 +14,7 @@ }

function notes(ctx, node, _, parent) {
function notes(ctx, node, _index, parent) {
var macro = ctx.footnote || defaultMacro;
return macro(all(ctx, node), parent.type === 'heading');
var protect = !!node.inHeading;
return macro(all(ctx, node), protect);
}

@@ -6,2 +6,3 @@ 'use strict';

var all = require('../all');
var escape = require('../escaper');

@@ -11,4 +12,4 @@ /* Expose. */

var defaultMacro = function defaultMacro(displayedText, link) {
return '\\externalLink{' + displayedText + '}{' + link + '}';
var defaultMacro = function defaultMacro(displayedText, url, title) {
return '\\externalLink{' + displayedText + '}{' + url + '}';
};

@@ -23,4 +24,4 @@

var prefix = has(config, 'prefix') ? config.prefix : '';
var url = node.url.startsWith('/') ? prefix + node.url : node.url;
var url = escape(node.url.startsWith('/') ? prefix + node.url : node.url);
return macro(all(ctx, node), url, node.title);
}
{
"name": "rebber",
"version": "0.0.21",
"version": "0.0.22",
"description": "Stringifies MDAST to LaTeX",

@@ -5,0 +5,0 @@ "repository": "https://github.com/zestedesavoir/zmarkdown/tree/master/packages/rebber",

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