Skip to content

Commit

Permalink
Experimental: all figures in figures panel - unreferenced anchored on…
Browse files Browse the repository at this point in the history
…es into main.
  • Loading branch information
obuchtala committed Jul 8, 2016
1 parent 6616888 commit d21cfed
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions extensions/math/math_converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,18 +755,12 @@ MathConverter.Prototype = function MathConverterPrototype() {
};

function _showFigure(state, node) {
// show figures without captions only in the content panel
if (!node.isReferenced) {
// show all figures in the figures panel
state.doc.show('figures', node.id);
// show unreferenced and anchored figures in the main content
if (!node.isReferenced || node.position === 'anchor') {
state.doc.show('content', node.id);
}
// all others are shown in the figures panel
else {
state.doc.show('figures', node.id);
// in addition a figure can be shown in-flow using position='anchor'
if (node.position === 'anchor') {
state.doc.show('content', node.id);
}
}
}

function _showFormulaOrEnvironment(state, node, nested) {
Expand Down Expand Up @@ -798,16 +792,12 @@ MathConverter.Prototype = function MathConverterPrototype() {
var info = state.nodeInfo[nodeId];
switch (node.type) {
case 'figure':
// 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.isReferenced) {
state.doc.show('figures', nodeId);
if (node.position !== 'anchor') {
nodeIds.splice(i, 1);
i--;
}
// show all figures in the figures panel
state.doc.show('figures', nodeId);
// hide referenced and unanchored figures from the environment
if (node.isReferenced && node.position !== 'anchor') {
nodeIds.splice(i, 1);
i--;
}
break;
case 'formula':
Expand Down

0 comments on commit d21cfed

Please sign in to comment.