Subramanya Sastry has uploaded a new change for review.
https://gerrit.wikimedia.org/r/197850
Change subject: Minor comment + function naming tweaks to improve code
readability
......................................................................
Minor comment + function naming tweaks to improve code readability
Change-Id: Ie2a19450969fb6ef9a2d8755759df9b5e27b3813
---
M lib/mediawiki.WikitextSerializer.js
M lib/wts.SerializerState.js
M lib/wts.separators.js
3 files changed, 14 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/50/197850/1
diff --git a/lib/mediawiki.WikitextSerializer.js
b/lib/mediawiki.WikitextSerializer.js
index 3fc91b0..19614fa 100644
--- a/lib/mediawiki.WikitextSerializer.js
+++ b/lib/mediawiki.WikitextSerializer.js
@@ -72,7 +72,7 @@
// Separator handling
WSP.handleSeparatorText = SeparatorsModule.handleSeparatorText;
WSP.updateSeparatorConstraints = SeparatorsModule.updateSeparatorConstraints;
-WSP.emitSeparator = SeparatorsModule.emitSeparator;
+WSP.buildAndEmitSep = SeparatorsModule.buildAndEmitSep;
// Methods
diff --git a/lib/wts.SerializerState.js b/lib/wts.SerializerState.js
index 1c65fa4..7547011 100644
--- a/lib/wts.SerializerState.js
+++ b/lib/wts.SerializerState.js
@@ -29,6 +29,9 @@
* atStartOfOutput
* True when wts kicks off, false after the first char has been output
*
+ * inLink
+ * Is the serializer currently handling link content (children of <a>)?
+ *
* inIndentPre
* Is the serializer currently handling indent-pre tags?
*
@@ -137,9 +140,8 @@
this.currLine.chunks.length = 0;
};
-// Serialize the children of a DOM node, sharing the global serializer
-// state. Typically called by a DOM-based handler to continue handling its
-// children.
+// Serialize the children of a DOM node, sharing the global serializer state.
+// Typically called by a DOM-based handler to continue handling its children.
SSP.serializeChildren = function(node, chunkCB, wtEscaper) {
try {
// TODO gwicke: use nested WikitextSerializer instead?
@@ -168,7 +170,7 @@
}
// If we serialized children explicitly,
- // clearly, we were processing a modified node.
+ // we were obviously processing a modified node.
this.currNodeUnmodified = false;
if (wtEscaper) {
@@ -278,10 +280,10 @@
if (origSep !== undefined && WTSUtils.isValidSep(origSep)) {
this.emitSep(origSep, node, cb2, 'ORIG-SEP:');
} else {
- this.serializer.emitSeparator(this, cb2, node);
+ this.serializer.buildAndEmitSep(this, cb2, node);
}
} else {
- this.serializer.emitSeparator(this, cb2, node);
+ this.serializer.buildAndEmitSep(this, cb2, node);
}
if (this.onSOL) {
@@ -399,7 +401,7 @@
}
this.serializeChildren(node, cb, wtEscaper);
this.flushLine(appendToBits);
- self.serializer.emitSeparator(this, appendToBits, node);
+ self.serializer.buildAndEmitSep(this, appendToBits, node);
// restore the separator state
this.sep = oldSep;
this.currLine.chunks = oldChunks;
diff --git a/lib/wts.separators.js b/lib/wts.separators.js
index bfbddc1..5456b58 100644
--- a/lib/wts.separators.js
+++ b/lib/wts.separators.js
@@ -161,7 +161,7 @@
//if (!state.sep.lastSourceNode) {
// // FIXME: Actually set lastSourceNode when the
source is
- // // emitted / emitSeparator is called!
+ // // emitted / buildAndEmitSep is called!
// state.sep.lastSourceNode = node.previousSibling
|| node.parentNode;
//}
return true;
@@ -174,7 +174,7 @@
state.onSOL = true;
//if (!state.sep.lastSourceNode) {
// // FIXME: Actually set lastSourceNode
when the source is
- // // emitted / emitSeparator is called!
+ // // emitted / buildAndEmitSep is called!
// state.sep.lastSourceNode =
node.previousSibling || node.parentNode;
//}
}
@@ -524,7 +524,7 @@
* Emit a separator based on the collected (and merged) constraints
* and existing separator text. Called when new output is triggered.
*/
-var emitSeparator = function(state, cb, node) {
+var buildAndEmitSep = function(state, cb, node) {
var sep,
origNode = node,
@@ -710,5 +710,5 @@
if (typeof module === "object") {
module.exports.handleSeparatorText = handleSeparatorText;
module.exports.updateSeparatorConstraints = updateSeparatorConstraints;
- module.exports.emitSeparator = emitSeparator;
+ module.exports.buildAndEmitSep = buildAndEmitSep;
}
--
To view, visit https://gerrit.wikimedia.org/r/197850
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2a19450969fb6ef9a2d8755759df9b5e27b3813
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits