aboutsummaryrefslogtreecommitdiff
path: root/plugin/markdown
diff options
context:
space:
mode:
authorVonC <vonc@laposte.net>2013-11-28 22:10:23 +0100
committerVonC <vonc@laposte.net>2013-11-30 23:12:39 +0100
commitd52eb599d1f732876540f2a22fa406b7293502e5 (patch)
tree30c227cae3ec396b320ce1ad39cc3b9b5afa9b6d /plugin/markdown
parent8ad633e4f3cdc576601e9b9aa5cd85c1f08e427e (diff)
downloadfosdem-2018-presentation-d52eb599d1f732876540f2a22fa406b7293502e5.tar
fosdem-2018-presentation-d52eb599d1f732876540f2a22fa406b7293502e5.tar.gz
Fix previous element selection.
Diffstat (limited to 'plugin/markdown')
-rwxr-xr-xplugin/markdown/markdown.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js
index 34458f2..2f6fc44 100755
--- a/plugin/markdown/markdown.js
+++ b/plugin/markdown/markdown.js
@@ -303,16 +303,24 @@
*/
function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {
- console.log("*** element='" + element.innerHTML + "', nodeType='" + element.nodeType + "'");
+ console.log("*** element='" + element.tagName + "', nodeType='" + element.nodeType + "'");
console.log("previousElement="+previousElement)
- console.log("section=****"+section.outerHTML+"****");
+ //console.log("section=****"+section.outerHTML+"****");
if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
previousParentElement = element;
for( var i = 0; i < element.childNodes.length; i++ ) {
childElement = element.childNodes[i];
- console.log(" Child element='" + childElement.innerHTML + "', type " + childElement.nodeType);
- if ( i > 0 && typeof element.childNodes[i-1].setAttribute == 'function' ) {
- previousParentElement = element.childNodes[i-1];
+ console.log(" Child element='" + childElement.tagName + "', type " + childElement.nodeType);
+ if ( i > 0 ) {
+ j = i - 1;
+ while ( j >= 0 ) {
+ aPreviousChildElement = element.childNodes[j];
+ if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR") {
+ previousParentElement = aPreviousChildElement;
+ break;
+ }
+ j = j - 1;
+ }
}
parentSection = section;
if( childElement.nodeName == "section" ) {