Skip to content

Commit 7ade901

Browse files
authored
add flexmark-ext-resizable-image (#489)
* add extension to resize image * add extension to resize image * minor fixes * Revert "Make support for relative paths to images as an extension" * add flexmark-ext-resizable-image * fix folders * fix spaces * some fixes test, but not last( * fix spec file * fix spec file * add Sample * delete comments
1 parent 3eccbef commit 7ade901

29 files changed

Lines changed: 432 additions & 0 deletions

File tree

.idea/compiler.xml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

VERSION-TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,7 @@ Please give feedback on the upcoming changes if you have concerns about breaking
16121612
* `flexmark-ext-jekyll-tag/src/test/resources/com.vladsch.flexmark.ext.jekyll.tag.txt`
16131613
* `flexmark-ext-macros/src/test/resources/com.vladsch.flexmark.ext.macros.txt`
16141614
* `flexmark-ext-media-tags/src/test/resources/com.vladsch.flexmark.ext.media.tags.txt`
1615+
* `flexmark-ext-resizable-image/src/test/resources/com.vladsch.flexmark.ext.resizable.image.txt`
16151616
* `flexmark-ext-spec-example/src/test/resources/com.vladsch.flexmark.ext.spec.example.txt`
16161617
* `flexmark-ext-superscript/src/test/resources/com.vladsch.flexmark.ext.superscript.txt`
16171618
* `flexmark-ext-tables/src/test/resources/com.vladsch.flexmark.ext.tables.txt`

VERSION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,7 @@ Please give feedback on the upcoming changes if you have concerns about breaking
12081208
* `flexmark-ext-jekyll-tag/src/test/resources/com.vladsch.flexmark.ext.jekyll.tag.txt`
12091209
* `flexmark-ext-macros/src/test/resources/com.vladsch.flexmark.ext.macros.txt`
12101210
* `flexmark-ext-media-tags/src/test/resources/com.vladsch.flexmark.ext.media.tags.txt`
1211+
* `flexmark-ext-resizable-image/src/test/resources/com.vladsch.flexmark.ext.resizable.image.txt`
12111212
* `flexmark-ext-spec-example/src/test/resources/com.vladsch.flexmark.ext.spec.example.txt`
12121213
* `flexmark-ext-superscript/src/test/resources/com.vladsch.flexmark.ext.superscript.txt`
12131214
* `flexmark-ext-tables/src/test/resources/com.vladsch.flexmark.ext.tables.txt`

flexmark-all/flexmark-all.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@
7272
<orderEntry type="module" module-name="flexmark-ext-gitlab" />
7373
<orderEntry type="module" module-name="flexmark-ext-macros" />
7474
<orderEntry type="module" module-name="flexmark-ext-media-tags" />
75+
<orderEntry type="module" module-name="flexmark-ext-resizable-image" />
7576
</component>
7677
</module>

flexmark-all/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@
118118
<artifactId>flexmark-ext-media-tags</artifactId>
119119
<version>${project.version}</version>
120120
</dependency>
121+
<dependency>
122+
<groupId>com.vladsch.flexmark</groupId>
123+
<artifactId>flexmark-ext-resizable-image</artifactId>
124+
<version>${project.version}</version>
125+
</dependency>
121126
<dependency>
122127
<groupId>com.vladsch.flexmark</groupId>
123128
<artifactId>flexmark-ext-macros</artifactId>

flexmark-all/src/assembly/bin.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<include>com.vladsch.flexmark:flexmark-ext-ins</include>
3434
<include>com.vladsch.flexmark:flexmark-ext-macros</include>
3535
<include>com.vladsch.flexmark:flexmark-ext-media-tags</include>
36+
<include>com.vladsch.flexmark:flexmark-ext-resizable-image</include>
3637
<include>com.vladsch.flexmark:flexmark-ext-xwiki-macros</include>
3738
<include>com.vladsch.flexmark:flexmark-ext-superscript</include>
3839
<include>com.vladsch.flexmark:flexmark-ext-tables</include>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<content url="file://$MODULE_DIR$">
5+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
6+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
7+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
8+
<excludeFolder url="file://$MODULE_DIR$/target" />
9+
</content>
10+
<orderEntry type="inheritedJdk" />
11+
<orderEntry type="sourceFolder" forTests="false" />
12+
<orderEntry type="module" module-name="flexmark" />
13+
<orderEntry type="module" module-name="flexmark-util-ast" />
14+
<orderEntry type="module" module-name="flexmark-util-builder" />
15+
<orderEntry type="module" module-name="flexmark-util-data" />
16+
<orderEntry type="module" module-name="flexmark-util-dependency" />
17+
<orderEntry type="module" module-name="flexmark-util-html" />
18+
<orderEntry type="module" module-name="flexmark-util-misc" />
19+
<orderEntry type="module" module-name="flexmark-util-sequence" />
20+
<orderEntry type="module" module-name="flexmark-util-visitor" />
21+
<orderEntry type="module" module-name="flexmark-test-util" scope="TEST" />
22+
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
23+
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
24+
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
25+
<orderEntry type="library" name="org.jetbrains:annotations" level="project" />
26+
</component>
27+
</module>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>com.vladsch.flexmark</groupId>
6+
<artifactId>flexmark-java</artifactId>
7+
<version>0.62.2</version>
8+
</parent>
9+
10+
<artifactId>flexmark-ext-resizable-image</artifactId>
11+
<name>flexmark-java extension for image's size</name>
12+
<description>flexmark-java extension to set the size of the images</description>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>com.vladsch.flexmark</groupId>
17+
<artifactId>flexmark</artifactId>
18+
</dependency>
19+
<dependency>
20+
<groupId>com.vladsch.flexmark</groupId>
21+
<artifactId>flexmark-test-util</artifactId>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>com.vladsch.flexmark</groupId>
26+
<artifactId>flexmark-core-test</artifactId>
27+
<scope>test</scope>
28+
</dependency>
29+
</dependencies>
30+
</project>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.vladsch.flexmark.ext.resizable.image;
2+
3+
import com.vladsch.flexmark.util.ast.DoNotDecorate;
4+
import com.vladsch.flexmark.util.ast.Node;
5+
import com.vladsch.flexmark.util.sequence.BasedSequence;
6+
import org.jetbrains.annotations.NotNull;
7+
8+
public class ResizableImage extends Node implements DoNotDecorate {
9+
protected BasedSequence source = BasedSequence.NULL;
10+
protected BasedSequence text = BasedSequence.NULL;
11+
protected BasedSequence width = BasedSequence.NULL;
12+
protected BasedSequence height = BasedSequence.NULL;
13+
14+
@NotNull
15+
@Override
16+
public BasedSequence[] getSegments() {
17+
return new BasedSequence[] { text, source, width, height };
18+
}
19+
20+
public ResizableImage(BasedSequence text, BasedSequence source, BasedSequence width, BasedSequence height) {
21+
super(spanningChars(text, source, width, height));
22+
this.source = source;
23+
this.text = text;
24+
this.width = width;
25+
this.height = height;
26+
}
27+
28+
public BasedSequence getText() {
29+
return text;
30+
}
31+
32+
public BasedSequence getSource() {
33+
return source;
34+
}
35+
36+
public BasedSequence getWidth() {
37+
return width;
38+
}
39+
40+
public BasedSequence getHeight() {
41+
return height;
42+
}
43+
}

0 commit comments

Comments
 (0)