Skip to content

Commit

Permalink
Apply all rules for showing figures within math environments.
Browse files Browse the repository at this point in the history
  • Loading branch information
obuchtala committed Jul 8, 2016
1 parent 5d21f5a commit 4d56d96
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions extensions/math/math_converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ MathConverter.Prototype = function MathConverterPrototype() {
};

function _showFigure(state, node) {
// show figures without captions are only in-flow
// show figures without captions only in the content panel
if (!node.caption) {
state.doc.show('content', node.id);
}
Expand Down Expand Up @@ -791,15 +791,22 @@ MathConverter.Prototype = function MathConverterPrototype() {

function _showNestedContent(state, nodeIds) {
var referencedMath = state.referencedMath;
nodeIds.forEach(function(nodeId) {
for (var i = 0; i < nodeIds.length; i++) {
var nodeId = nodeIds[i]
var node = state.doc.get(nodeId);
var info = state.nodeInfo[nodeId];
switch (node.type) {
case 'figure':
// only show figures in the figures panel,
// which have a caption
// showing a figure in figures panel if it has a caption
// and it is not explicitly anchored (position='anchor')
// If a figure doen't have a caption or is anchored explicitly,
// it is shown in the original position.
if (node.caption) {
state.doc.show('figures', nodeId);
state.doc.show('figures', nodeId);
if (node.position !== 'anchor') {
nodeIds.splice(i, 1);
i--;
}
}
break;
case 'formula':
Expand All @@ -809,7 +816,7 @@ MathConverter.Prototype = function MathConverterPrototype() {
default:
// nothing
}
});
}
}

function _showProof(state, node) {
Expand Down

0 comments on commit 4d56d96

Please sign in to comment.