mirror of
https://github.com/gitpitch/gitpitch.git
synced 2024-04-18 07:30:55 +08:00
New background-position YAML prop, plus position arg on image delim.
This commit is contained in:
parent
de375fbd66
commit
67721b11bd
|
@ -179,11 +179,17 @@ public class MarkdownModel implements Markdown {
|
||||||
yOpts.fetchImageBgSize(pp) : YAMLOptions.DEFAULT_BG_SIZE;
|
yOpts.fetchImageBgSize(pp) : YAMLOptions.DEFAULT_BG_SIZE;
|
||||||
String defaultBgColor = (yOpts != null) ?
|
String defaultBgColor = (yOpts != null) ?
|
||||||
yOpts.fetchImageBgColor(pp) : YAMLOptions.DEFAULT_BG_COLOR;
|
yOpts.fetchImageBgColor(pp) : YAMLOptions.DEFAULT_BG_COLOR;
|
||||||
|
String defaultBgPosition = (yOpts != null) ?
|
||||||
|
yOpts.fetchImageBgPosition(pp) : YAMLOptions.DEFAULT_BG_POSITION;
|
||||||
|
|
||||||
return new StringBuffer(delimiter(md))
|
return new StringBuffer(delimiter(md))
|
||||||
.append(imageService.buildBackground(md,
|
.append(imageService.buildBackground(md,
|
||||||
dp, pp, defaultBgSize, defaultBgColor, this))
|
dp,
|
||||||
.toString();
|
pp,
|
||||||
|
defaultBgSize,
|
||||||
|
defaultBgColor,
|
||||||
|
defaultBgPosition,
|
||||||
|
this)).toString();
|
||||||
|
|
||||||
} else if (gistDelimFound(dp)) {
|
} else if (gistDelimFound(dp)) {
|
||||||
return gistService.build(md, dp, pp, yOpts, this);
|
return gistService.build(md, dp, pp, yOpts, this);
|
||||||
|
@ -647,6 +653,7 @@ public class MarkdownModel implements Markdown {
|
||||||
public static final String DELIM_QUERY_LANG = "lang";
|
public static final String DELIM_QUERY_LANG = "lang";
|
||||||
public static final String DELIM_QUERY_SIZE = "size";
|
public static final String DELIM_QUERY_SIZE = "size";
|
||||||
public static final String DELIM_QUERY_COLOR = "color";
|
public static final String DELIM_QUERY_COLOR = "color";
|
||||||
|
public static final String DELIM_QUERY_POSITION = "position";
|
||||||
public static final String DELIM_QUERY_FILE = "file";
|
public static final String DELIM_QUERY_FILE = "file";
|
||||||
public static final String DELIM_QUERY_TITLE = "title";
|
public static final String DELIM_QUERY_TITLE = "title";
|
||||||
|
|
||||||
|
@ -662,6 +669,8 @@ public class MarkdownModel implements Markdown {
|
||||||
"\" data-background-size=\"";
|
"\" data-background-size=\"";
|
||||||
public static final String MD_IMAGE_COLOR =
|
public static final String MD_IMAGE_COLOR =
|
||||||
"\" data-background-color=\"";
|
"\" data-background-color=\"";
|
||||||
|
public static final String MD_IMAGE_POSITION =
|
||||||
|
"\" data-background-position=\"";
|
||||||
public static final String MD_BG_COLOR =
|
public static final String MD_BG_COLOR =
|
||||||
"<!-- .slide: data-background=\"";
|
"<!-- .slide: data-background=\"";
|
||||||
public static final String MD_CLOSER = "\" -->";
|
public static final String MD_CLOSER = "\" -->";
|
||||||
|
|
|
@ -46,7 +46,8 @@ public class ImageService {
|
||||||
|
|
||||||
return buildBackground(yOpts.fetchImageBg(pp),
|
return buildBackground(yOpts.fetchImageBg(pp),
|
||||||
yOpts.fetchImageBgSize(pp),
|
yOpts.fetchImageBgSize(pp),
|
||||||
yOpts.fetchImageBgColor(pp));
|
yOpts.fetchImageBgColor(pp),
|
||||||
|
yOpts.fetchImageBgPosition(pp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String buildBackground(String md,
|
public String buildBackground(String md,
|
||||||
|
@ -54,18 +55,21 @@ public class ImageService {
|
||||||
PitchParams pp,
|
PitchParams pp,
|
||||||
String defaultSize,
|
String defaultSize,
|
||||||
String defaultColor,
|
String defaultColor,
|
||||||
|
String defaultPos,
|
||||||
MarkdownModel mdm) {
|
MarkdownModel mdm) {
|
||||||
|
|
||||||
String bgUrl = dp.get(MarkdownModel.DELIM_QUERY_IMAGE);
|
String bgUrl = dp.get(MarkdownModel.DELIM_QUERY_IMAGE);
|
||||||
bgUrl = mdm.linkLive(pp, bgUrl);
|
bgUrl = mdm.linkLive(pp, bgUrl);
|
||||||
String bgSize = dp.get(MarkdownModel.DELIM_QUERY_SIZE, defaultSize);
|
String bgSize = dp.get(MarkdownModel.DELIM_QUERY_SIZE, defaultSize);
|
||||||
String bgColor = dp.get(MarkdownModel.DELIM_QUERY_COLOR, defaultColor);
|
String bgColor = dp.get(MarkdownModel.DELIM_QUERY_COLOR, defaultColor);
|
||||||
return buildBackground(bgUrl, bgSize, bgColor);
|
String bgPos = dp.get(MarkdownModel.DELIM_QUERY_POSITION, defaultPos);
|
||||||
|
return buildBackground(bgUrl, bgSize, bgColor, bgPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildBackground(String bgUrl,
|
private String buildBackground(String bgUrl,
|
||||||
String bgSize,
|
String bgSize,
|
||||||
String bgColor) {
|
String bgColor,
|
||||||
|
String bgPosition) {
|
||||||
|
|
||||||
return new StringBuffer(MarkdownModel.MD_SPACER)
|
return new StringBuffer(MarkdownModel.MD_SPACER)
|
||||||
.append(MarkdownModel.MD_IMAGE_OPEN)
|
.append(MarkdownModel.MD_IMAGE_OPEN)
|
||||||
|
@ -74,6 +78,8 @@ public class ImageService {
|
||||||
.append(bgSize)
|
.append(bgSize)
|
||||||
.append(MarkdownModel.MD_IMAGE_COLOR)
|
.append(MarkdownModel.MD_IMAGE_COLOR)
|
||||||
.append(bgColor)
|
.append(bgColor)
|
||||||
|
.append(MarkdownModel.MD_IMAGE_POSITION)
|
||||||
|
.append(bgPosition)
|
||||||
.append(MarkdownModel.MD_CLOSER)
|
.append(MarkdownModel.MD_CLOSER)
|
||||||
.append(MarkdownModel.MD_SPACER)
|
.append(MarkdownModel.MD_SPACER)
|
||||||
.toString();
|
.toString();
|
||||||
|
|
|
@ -213,6 +213,15 @@ public final class YAMLOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String fetchImageBgPosition(PitchParams pp) {
|
||||||
|
String bgPosition = _yProps.get(IMAGE_BG_POSITION_OPTION);
|
||||||
|
if (bgPosition == null) {
|
||||||
|
return DEFAULT_BG_POSITION;
|
||||||
|
} else {
|
||||||
|
return bgPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String fetchTransition(PitchParams pp) {
|
public String fetchTransition(PitchParams pp) {
|
||||||
|
|
||||||
String transition = _yProps.get(TRANSITION_OPTION);
|
String transition = _yProps.get(TRANSITION_OPTION);
|
||||||
|
@ -390,6 +399,7 @@ public final class YAMLOptions {
|
||||||
public static final String PITCHME_YAML = "PITCHME.yaml";
|
public static final String PITCHME_YAML = "PITCHME.yaml";
|
||||||
public static final String DEFAULT_BG_SIZE = "100% 100%";
|
public static final String DEFAULT_BG_SIZE = "100% 100%";
|
||||||
public static final String DEFAULT_BG_COLOR = " ";
|
public static final String DEFAULT_BG_COLOR = " ";
|
||||||
|
public static final String DEFAULT_BG_POSITION = "center";
|
||||||
public static final String DEFAULT_TRANSITION = "slide";
|
public static final String DEFAULT_TRANSITION = "slide";
|
||||||
public static final String MATHJAX_DEFAULT = "TeX-MML-AM_CHTML";
|
public static final String MATHJAX_DEFAULT = "TeX-MML-AM_CHTML";
|
||||||
public static final String HIGHLIGHT_DARK_DEFAULT = "github-gist.css";
|
public static final String HIGHLIGHT_DARK_DEFAULT = "github-gist.css";
|
||||||
|
@ -405,6 +415,7 @@ public final class YAMLOptions {
|
||||||
private static final String IMAGE_BG_OPTION = "background";
|
private static final String IMAGE_BG_OPTION = "background";
|
||||||
private static final String IMAGE_BG_SIZE_OPTION = "background-size";
|
private static final String IMAGE_BG_SIZE_OPTION = "background-size";
|
||||||
private static final String IMAGE_BG_COLOR_OPTION = "background-color";
|
private static final String IMAGE_BG_COLOR_OPTION = "background-color";
|
||||||
|
private static final String IMAGE_BG_POSITION_OPTION = "background-position";
|
||||||
private static final String TRANSITION_OPTION = "transition";
|
private static final String TRANSITION_OPTION = "transition";
|
||||||
private static final String AUTOSLIDE_OPTION = "autoslide";
|
private static final String AUTOSLIDE_OPTION = "autoslide";
|
||||||
private static final String LOOP_OPTION = "loop";
|
private static final String LOOP_OPTION = "loop";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user