Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Commit

Permalink
Removed fig: default prefix from Image altText attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
dfrommi committed Apr 12, 2015
1 parent 640f4c3 commit 2bb1166
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

# Build directories
/build/
/gh-pages/
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'groovy'
version = '0.1'
version = '0.2'

ext {
groovy = [version: '2.3.10']
Expand All @@ -22,4 +22,5 @@ dependencies {

groovydoc {
groovyClasspath = configurations.groovyDoc
destinationDir = file('gh-pages')
}
8 changes: 5 additions & 3 deletions src/main/groovy/net/frommknecht/pandoc/types/Image.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ class Image implements Inline {
def url = ""

/**
* Alternate text
* Alternate text.
*
* Use prefix 'fig:' if image is in its own paragraph. Then altText becomes figure caption.
*/
@JsonValue(index=2, subindex=2, toJson={"fig:" + it}, fromJson={it - ~/^fig:/})
def altText = "fig:"
@JsonValue(index=2, subindex=2)
def altText = ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class ImageTest extends TypeTestBase {
@Parameters(name = "{index}: {0}")
static getParams() { [
['![caption](someimage.jpg "altText")',
new Image(title: [new Str("caption")], url: "someimage.jpg", altText: "altText")] as Object[]
new Image(title: [new Str("caption")], url: "someimage.jpg", altText: "fig:altText")] as Object[]
]}
}

0 comments on commit 2bb1166

Please sign in to comment.