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

ep_context

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ep_context - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

21

index.js
var eejs = require('ep_etherpad-lite/node/eejs/');
var Changeset = require("ep_etherpad-lite/static/js/Changeset");
var sanitize = require('./sanitizer.js').sanitize;
var Security = require('ep_etherpad-lite/static/js/security');
var _encodeWhitespace = require('ep_etherpad-lite/node/utils/ExportHelper')._encodeWhitespace;

@@ -36,4 +38,3 @@ var stylesCSS = ["contextparagraph{margin-left:10px;color:green;}",

exports.aceAttribClasses = function(hook_name, attr, cb){
attr.sub = 'tag:sub';
attr.sup = 'tag:sup';
attr.contextsection = 'tag:contextsection';
cb(attr);

@@ -57,3 +58,3 @@ }

exports.exportHtmlAdditionalTags = function(hook, pad, cb){
cb(["sub", "sup"]);
cb(["contextsection"]);
};

@@ -64,9 +65,13 @@

var contextV = _analyzeLine(line.attribLine, line.apool);
// If it has a context
if(contextV){
var contexts = contextV.split("$");
}else{
return;
return line.lineContent +"<br>";
}
var before = "";
var after = "";
if (contexts.length) {

@@ -77,5 +82,7 @@ contexts.forEach(function(contextV){

});
console.warn("TODO: Use a line with attributes not just a text string");
return before + line.text.substring(1) + after + "<br>";
}else{
// Remove leading * else don't..
var newString = before + line.lineContent.substring(1) + after + "<br>";
return newString;
}else{ // no context, nothing to remove
return line.lineContent;
}

@@ -82,0 +89,0 @@ }

{
"description": "Context for Etherpad Documents, very WIP.",
"name": "ep_context",
"version": "0.0.7",
"version": "0.0.8",
"author": {

@@ -6,0 +6,0 @@ "name": "John McLear",

@@ -68,2 +68,7 @@ /******

while ((m = re.exec(line)) != null) {
// m[1] is not in array return
var prop = m[1].charAt(0).toUpperCase() + m[1].slice(1);
if(exports.sanitize.blockElements.indexOf(prop) == -1) return;
if (m.index === re.lastIndex) {

@@ -104,33 +109,37 @@ re.lastIndex++;

if(thisLine[prop] === 3){ // if its open and close
// Does the next line have this context?
if(nextLine[prop] == 3){
// set this line to open only..
if(contexts[line] && contexts[line][prop]){
contexts[line][prop] = 0;
}
}
}
if(thisLine[prop] === 0){ // if its opening
// Does the prev line have this context open already?
if((prevLine && prevLine[prop] == 0) || (prevLine && prevLine[prop] == 1)){
// set this line to open only..
if(contexts[line]){
contexts[line][prop] = 1; // set it to keep open
// If we're handling these blocks
// if(exports.sanitize.blockElements.indexOf(prop) !== -1){
if(thisLine[prop] === 3){ // if its open and close
// Does the next line have this context?
if(nextLine[prop] == 3){
// set this line to open only..
if(contexts[line] && contexts[line][prop]){
contexts[line][prop] = 0;
}
}
}
}
if(thisLine[prop] === 3){ // if its opening and closing
// Does the next line keep this context?
if( (!nextLine || !nextLine[prop])){
if (prevLine && (prevLine[prop] === 1 || prevLine[prop] === 0)){
if(thisLine[prop] === 0){ // if its opening
// Does the prev line have this context open already?
if((prevLine && prevLine[prop] == 0) || (prevLine && prevLine[prop] == 1)){
// set this line to open only..
if(contexts[line]){
contexts[line][prop] = 2; // set it to closed
contexts[line][prop] = 1; // set it to keep open
}
}
}
}
if(thisLine[prop] === 3){ // if its opening and closing
// Does the next line keep this context?
if( (!nextLine || !nextLine[prop])){
if (prevLine && (prevLine[prop] === 1 || prevLine[prop] === 0)){
// set this line to open only..
if(contexts[line]){
contexts[line][prop] = 2; // set it to closed
}
}
}
}
// }
}

@@ -166,3 +175,9 @@ }

// remove leading white space
lines[lineNumber] = lines[lineNumber].substring(1, lines[lineNumber].length);
if(lines[lineNumber].substring(0,1) === " "){
lines[lineNumber] = lines[lineNumber].substring(1, lines[lineNumber].length);
}else{
lines[lineNumber] = lines[lineNumber].substring(0, lines[lineNumber].length);
}
// Note that this leaves in the leading * which is probably unintended
});

@@ -198,6 +213,3 @@

};
// console.log(lines);
lines = lines.join("\n<br>")
// lines = lines.replace("<br>","<br>\n");
// console.log(lines);

@@ -204,0 +216,0 @@ lines = exports.sanitize.prefix + lines + exports.sanitize.suffix;

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