From 889db16897c8c5c1d636ec5ce042b88021498585 Mon Sep 17 00:00:00 2001 From: Rafael Henkin Date: Tue, 28 Jan 2020 12:25:48 +0000 Subject: [PATCH 1/2] Interactive by default and archive keyword in codeBlock --- .../src/renderEnhancers/literateElm.ts | 5 ++++- packages/litvis/src/attributeDerivatives.ts | 5 +++++ packages/litvis/src/types.ts | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/litvis-integration-mume/src/renderEnhancers/literateElm.ts b/packages/litvis-integration-mume/src/renderEnhancers/literateElm.ts index cac68a4..24450ec 100644 --- a/packages/litvis-integration-mume/src/renderEnhancers/literateElm.ts +++ b/packages/litvis-integration-mume/src/renderEnhancers/literateElm.ts @@ -143,6 +143,7 @@ export default async function enhance( const outputFormat: OutputFormat | undefined = $el.data("outputFormat"); const expressionText = $el.data("expression"); const interactive = $el.data("interactive"); + const archive = $el.data("archive"); const renderKey = hash({ contextName, outputFormat, @@ -232,7 +233,7 @@ export default async function enhance( resultNormalizedInfo = { language, attributes: { - interactive: interactive === true, + interactive: (archive || !interactive) === false, style: "display: inline-block", }, }; @@ -319,6 +320,8 @@ function generateArrayOf$outputItems( outputExpression, )}" data-interactive="${ derivatives.interactive + }" data-archive="${ + derivatives.archive }" data-output-format="${escapeString( outputFormat, )}">${escapeString(outputFormat)}=${escapeString( diff --git a/packages/litvis/src/attributeDerivatives.ts b/packages/litvis/src/attributeDerivatives.ts index 113f262..6fc89a7 100644 --- a/packages/litvis/src/attributeDerivatives.ts +++ b/packages/litvis/src/attributeDerivatives.ts @@ -23,6 +23,8 @@ export function extractAttributeDerivatives( ? normalizeExpression(attributesWithMixIns.context) : "default", outputFormats: [], + interactive: true, + archive: false, outputExpressionsByFormat: {}, id: attributesWithMixIns.id, follows: attributesWithMixIns.follows, @@ -63,6 +65,9 @@ export function extractAttributeDerivatives( isLitVis = true; addOutputExpressions(result, "m", value); break; + case "archive": + result.archive = !!value; + break; case "interactive": result.interactive = !!value; break; diff --git a/packages/litvis/src/types.ts b/packages/litvis/src/types.ts index 22689fa..d97be7e 100644 --- a/packages/litvis/src/types.ts +++ b/packages/litvis/src/types.ts @@ -28,6 +28,7 @@ export interface AttributeDerivatives { outputFormats: BlockOutputFormat[]; outputExpressionsByFormat: { [TKey in OutputFormat]?: string[] }; interactive?: boolean; + archive?: boolean; id?: string; follows?: string; } From aa204138b60ff62b2395592eb0be03c1f8042300 Mon Sep 17 00:00:00 2001 From: Rafael Henkin Date: Tue, 28 Jan 2020 14:49:46 +0000 Subject: [PATCH 2/2] Fixing formatting --- .../src/renderEnhancers/literateElm.ts | 4 +--- packages/litvis/src/types.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/litvis-integration-mume/src/renderEnhancers/literateElm.ts b/packages/litvis-integration-mume/src/renderEnhancers/literateElm.ts index 24450ec..d35885c 100644 --- a/packages/litvis-integration-mume/src/renderEnhancers/literateElm.ts +++ b/packages/litvis-integration-mume/src/renderEnhancers/literateElm.ts @@ -318,9 +318,7 @@ function generateArrayOf$outputItems( derivatives.contextName, )}" data-expression="${escapeString( outputExpression, - )}" data-interactive="${ - derivatives.interactive - }" data-archive="${ + )}" data-interactive="${derivatives.interactive}" data-archive="${ derivatives.archive }" data-output-format="${escapeString( outputFormat, diff --git a/packages/litvis/src/types.ts b/packages/litvis/src/types.ts index d97be7e..732dc97 100644 --- a/packages/litvis/src/types.ts +++ b/packages/litvis/src/types.ts @@ -28,7 +28,7 @@ export interface AttributeDerivatives { outputFormats: BlockOutputFormat[]; outputExpressionsByFormat: { [TKey in OutputFormat]?: string[] }; interactive?: boolean; - archive?: boolean; + archive?: boolean; id?: string; follows?: string; }