Comparing version 0.4.0 to 0.5.0
@@ -295,2 +295,34 @@ (function() { | ||
//=========================================================================================================== | ||
// PARSING | ||
//----------------------------------------------------------------------------------------------------------- | ||
this.$html_as_datoms = function() { | ||
var $; | ||
({$} = (require('steampipes')).export()); | ||
return $((buffer_or_text, send) => { | ||
var d, i, len, ref; | ||
ref = this.html_as_datoms(buffer_or_text); | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
d = ref[i]; | ||
send(d); | ||
} | ||
return null; | ||
}); | ||
}; | ||
//----------------------------------------------------------------------------------------------------------- | ||
this.$mkts_html_as_datoms = function() { | ||
var $; | ||
({$} = (require('steampipes')).export()); | ||
return $((buffer_or_text, send) => { | ||
var d, i, len, ref; | ||
ref = this.mkts_html_as_datoms(buffer_or_text); | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
d = ref[i]; | ||
send(d); | ||
} | ||
return null; | ||
}); | ||
}; | ||
//########################################################################################################### | ||
@@ -297,0 +329,0 @@ if (module === require.main) { |
@@ -1370,2 +1370,102 @@ (function() { | ||
//----------------------------------------------------------------------------------------------------------- | ||
this["HTML.$html_as_datoms"] = function(T, done) { | ||
var $, $async, $drain, $show, $watch, SP, matcher, pipeline, probe; | ||
SP = require('steampipes'); | ||
// SP = require '../../apps/steampipes' | ||
({$, $async, $drain, $watch, $show} = SP.export()); | ||
//......................................................................................................... | ||
probe = `<p>A <em>concise</em> introduction to the things discussed below.</p>`; | ||
matcher = [ | ||
{ | ||
"$key": "<p" | ||
}, | ||
{ | ||
"text": "A ", | ||
"$key": "^text" | ||
}, | ||
{ | ||
"$key": "<em" | ||
}, | ||
{ | ||
"text": "concise", | ||
"$key": "^text" | ||
}, | ||
{ | ||
"$key": ">em" | ||
}, | ||
{ | ||
"text": " introduction to the things discussed below.", | ||
"$key": "^text" | ||
}, | ||
{ | ||
"$key": ">p" | ||
} | ||
]; | ||
//......................................................................................................... | ||
pipeline = []; | ||
pipeline.push([Buffer.from(probe)]); | ||
pipeline.push(SP.$split()); | ||
pipeline.push(HTML.$html_as_datoms()); | ||
pipeline.push($show()); | ||
pipeline.push($drain((result) => { | ||
help(jr(result)); | ||
T.eq(result, matcher); | ||
return done(); | ||
})); | ||
SP.pull(...pipeline); | ||
//......................................................................................................... | ||
return null; | ||
}; | ||
//----------------------------------------------------------------------------------------------------------- | ||
this["HTML.$mkts_html_as_datoms"] = function(T, done) { | ||
var $, $async, $drain, $show, $watch, SP, matcher, pipeline, probe; | ||
SP = require('steampipes'); | ||
// SP = require '../../apps/steampipes' | ||
({$, $async, $drain, $watch, $show} = SP.export()); | ||
//......................................................................................................... | ||
probe = `<p>A <em>concise</em> introduction to the things discussed below.</p>`; | ||
matcher = [ | ||
{ | ||
"$key": "<p" | ||
}, | ||
{ | ||
"text": "A ", | ||
"$key": "^text" | ||
}, | ||
{ | ||
"$key": "<em" | ||
}, | ||
{ | ||
"text": "concise", | ||
"$key": "^text" | ||
}, | ||
{ | ||
"$key": ">em" | ||
}, | ||
{ | ||
"text": " introduction to the things discussed below.", | ||
"$key": "^text" | ||
}, | ||
{ | ||
"$key": ">p" | ||
} | ||
]; | ||
//......................................................................................................... | ||
pipeline = []; | ||
pipeline.push([Buffer.from(probe)]); | ||
pipeline.push(SP.$split()); | ||
pipeline.push(HTML.$mkts_html_as_datoms()); | ||
pipeline.push($show()); | ||
pipeline.push($drain((result) => { | ||
help(jr(result)); | ||
T.eq(result, matcher); | ||
return done(); | ||
})); | ||
SP.pull(...pipeline); | ||
//......................................................................................................... | ||
return null; | ||
}; | ||
//----------------------------------------------------------------------------------------------------------- | ||
this["demo"] = function(T, done) { | ||
@@ -1435,9 +1535,11 @@ var d, datoms, i, len, ref, text; | ||
// await @_demo() | ||
// test @ | ||
help('ok'); | ||
// test @[ "demo" ] | ||
return test(this["demo (buffer)"]); | ||
test(this); | ||
return help('ok'); | ||
})(); | ||
} | ||
// test @[ "demo" ] | ||
// test @[ "demo (buffer)" ] | ||
// test @[ "HTML.$html_as_datoms" ] | ||
// test @[ "must quote attribute value" ] | ||
@@ -1444,0 +1546,0 @@ // test @[ "DATOM.HTML._as_attribute_literal" ] |
{ | ||
"name": "intertext", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Services for Recurrent Text-related Tasks", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -270,2 +270,9 @@ | ||
For [SteamPipe](https://github.com/loveencounterflow/steampipes) streams, use | ||
* `$html_as_datoms()` | ||
* `$mkts_html_as_datoms()` | ||
for the same functionality; both transforms accept texts or buffers. | ||
### HTML Generation | ||
@@ -272,0 +279,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
191757
2728
568