Skip to content

Commit

Permalink
LDEV-5261 move markdown support to an extension
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jan 20, 2025
1 parent fe0ab3c commit fdd0351
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 101 deletions.
5 changes: 4 additions & 1 deletion ant/build-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@
<!-- Compress -->
<not><isset property="extCompress"/></not>
<not><isset property="extCompressVersion"/></not>
<!-- Markdown -->
<not><isset property="extMarkdown"/></not>
<not><isset property="extMarkdownVersion"/></not>
</or>
</condition>
</fail>
Expand Down Expand Up @@ -248,7 +251,7 @@
</sequential>
</macrodef>

<target name="check" depends="check-mysql,check-mssql,check-postgre,check-jdts,check-s3,check-ehcache,check-pdf,check-admin,check-doc,check-image,check-esapi,check-compress,check-testbox,check-lucee-loader-jar,download-lucee-loader-jar">
<target name="check" depends="check-mysql,check-mssql,check-postgre,check-jdts,check-s3,check-ehcache,check-pdf,check-admin,check-doc,check-image,check-esapi,check-compress,check-markdown,check-testbox,check-lucee-loader-jar,download-lucee-loader-jar">
<mkdir dir="${temp}/loader/extensions/"/>
</target>

Expand Down
28 changes: 27 additions & 1 deletion ant/build-extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@
<scriptdef name="readRequiredExtensions" language="javascript" classpath="${nashorn_classpath}">
<attribute name="file" />
<![CDATA[
var echo = project.createTask( "echo" );
var filename = attributes.get( "file" );
var manifest = new java.util.jar.Manifest( new java.io.FileInputStream( new java.io.File( filename ) ) );
var attrs = manifest.getMainAttributes();
var str = attrs.getValue( "Require-Extension" );
if (str == null){
echo.setMessage( "Error reading MANIFEST.MF - Require-Extension");
echo.perform();
for (var a in attrs){
echo.setMessage( " - " + a );
echo.perform();
}
echo.setMessage( "Require-Extension: " + str );
echo.perform();
}
var arr = str.split( "," );
var count = 0;
var ids = "";
Expand Down Expand Up @@ -156,6 +167,7 @@
<available file="${cache}/${extImage}-${extImageVersion}.lex" property="image.present"/>
<available file="${cache}/${extEsapi}-${extEsapiVersion}.lex" property="esapi.present"/>
<available file="${cache}/${extCompress}-${extCompressVersion}.lex" property="compress.present"/>
<available file="${cache}/${extMarkdown}-${extMarkdownVersion}.lex" property="markdown.present"/>
</target>

<target name="check-mysql" depends="check-cache" unless="mysql.present">
Expand Down Expand Up @@ -194,6 +206,9 @@
<target name="check-compress" depends="check-cache" unless="compress.present">
<get src="${extURL}${extCompress}?version=${extCompressVersion}" dest="${cache}/${extCompress}-${extCompressVersion}.lex"/>
</target>
<target name="check-markdown" depends="check-cache" unless="markdown.present">
<get src="${extURL}${extMarkdown}?version=${extMarkdownVersion}" dest="${cache}/${extMarkdown}-${extMarkdownVersion}.lex"/>
</target>
<target name="check-testbox" depends="check-cache" unless="testbox.present">
<get src="${testboxURL}" dest="${cache}/testbox-${testboxVersion}.zip"/>
</target>
Expand Down Expand Up @@ -346,7 +361,18 @@
tofile="${goal}/extensions/${ext_compress.filename}"/>
<echo level="info">add:${goal}/extensions/${ext_compress.filename}</echo>
<echo file="${goal}/extensions/.index" append="true">${ext_compress.filename};</echo>


<!-- add extension Markdown -->
<loadmf jar="${cache}/${extMarkdown}-${extMarkdownVersion}.lex" prefix="ext_markdown."/>
<toFileName id="${ext_markdown.id}" name="${ext_markdown.name}" version="${ext_markdown.version}" property="ext_markdown.filename"/>
<copy
file="${cache}/${extMarkdown}-${extMarkdownVersion}.lex"
todir="${goal}/extensions/"/>
<move
file="${goal}/extensions/${extMarkdown}-${extMarkdownVersion}.lex"
tofile="${goal}/extensions/${ext_markdown.filename}"/>
<echo level="info">add:${goal}/extensions/${ext_markdown.filename}</echo>
<echo file="${goal}/extensions/.index" append="true">${ext_markdown.filename};</echo>
</target>

<target name="check-lucee-loader-jar">
Expand Down
6 changes: 0 additions & 6 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,6 @@
<version>5.13.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.lucee</groupId>
<artifactId>commonmark</artifactId>
<version>0.22.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.lucee</groupId>
<artifactId>janino</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ Require-Bundle: org.apache.commons.commons-codec;bundle-version=1.15.0,
com.github.mwiede.jsch;bundle-version=0.2.21,
org.lucee.jzlib;bundle-version=1.1.3,
com.sun.jna;bundle-version=5.13.0,
org.lucee.commonmark;bundle-version=0.22.0,
com.github.f4b6a3.ulid;bundle-version=5.2.3,
org.lucee.janino;bundle-version=3.1.9,
org.lucee.janinocc;bundle-version=3.1.9
Expand All @@ -372,4 +371,5 @@ Require-Extension: 7E673D15-D87C-41A6-8B5F1956528C605F;name=MySQL;label=MySQL;ve
66E312DD-D083-27C0-64189D16753FD6F0;name=PDF;label=PDF;version=1.2.0.10,
B737ABC4-D43F-4D91-8E8E973E37C40D1B;name=Image;label=Image;version=2.0.0.26;since=5.3.0.35-ALPHA,
37C61C0A-5D7E-4256-8572639BE0CF5838;name=Esapi;label=ESAPI;version=2.2.4.17-SNAPSHOT;since=5.3.0.37-ALPHA,
8D7FB0DF-08BB-1589-FE3975678F07DB17;name=Compress;label=Compress;version=1.0.0.15;since=5.3.2.31-SNAPSHOT
8D7FB0DF-08BB-1589-FE3975678F07DB17;name=Compress;label=Compress;version=1.0.0.15;since=5.3.2.31-SNAPSHOT,
3AEDA748-F62B-42E3-8E8DC5AE0DDABE09;name=Markdown;label=Markdown;version=1.0.0.0

This file was deleted.

37 changes: 0 additions & 37 deletions core/src/main/java/resource/fld/core-base.fld
Original file line number Diff line number Diff line change
Expand Up @@ -9711,43 +9711,6 @@ mavenLoad([
</return>
</function>



<!-- MarkdownToHTML -->
<function>
<name>MarkdownToHTML</name>
<member-name>MarkdownToHTML</member-name>
<class>lucee.runtime.functions.string.MarkdownToHTML</class>
<keywords>string</keywords>
<description>Transforms Markdown formatted String into HTML.</description>
<introduced>6.0.0.150</introduced>
<argument>
<name>string</name>
<alias>markdown</alias>
<type>string</type>
<required>Yes</required>
<description>A Markdown formatted string or a path to a file containf a markdown formatted string to convert to HTML</description>
</argument>
<argument>
<name>safeMode</name>
<type>boolean</type>
<alias>safe</alias>
<default>false</default>
<required>No</required>
<description>If set to true it does escape unsafe HTML tags</description>
</argument>
<argument>
<name>encoding</name>
<type>string</type>
<alias>charset</alias>
<required>No</required>
<description>Charset, only used in case the argument markdown contains a file path</description>
</argument>
<return>
<type>string</type>
</return>
</function>

<!-- CreateAISession -->
<function>
<name>LuceeCreateAISession</name>
Expand Down
6 changes: 0 additions & 6 deletions loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,6 @@
<version>5.13.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.lucee</groupId>
<artifactId>commonmark</artifactId>
<version>0.22.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.lucee</groupId>
<artifactId>janino</artifactId>
Expand Down

0 comments on commit fdd0351

Please sign in to comment.