mirror of
https://github.com/gitpitch/gitpitch.git
synced 2024-04-18 07:30:55 +08:00
New background-color YAML prop, plus color arg on image delim.
This commit is contained in:
parent
4b71259f52
commit
90aa721581
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -17,3 +17,4 @@ server.pid
|
||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
.settings/
|
.settings/
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -173,10 +173,12 @@ public class MarkdownModel implements Markdown {
|
||||||
|
|
||||||
String defaultBgSize = (yOpts != null) ?
|
String defaultBgSize = (yOpts != null) ?
|
||||||
yOpts.fetchImageBgSize(pp) : YAMLOptions.DEFAULT_BG_SIZE;
|
yOpts.fetchImageBgSize(pp) : YAMLOptions.DEFAULT_BG_SIZE;
|
||||||
|
String defaultBgColor = (yOpts != null) ?
|
||||||
|
yOpts.fetchImageBgColor(pp) : YAMLOptions.DEFAULT_BG_COLOR;
|
||||||
|
|
||||||
return new StringBuffer(delimiter(md))
|
return new StringBuffer(delimiter(md))
|
||||||
.append(imageService.buildBackground(md,
|
.append(imageService.buildBackground(md,
|
||||||
dp, pp, defaultBgSize, this))
|
dp, pp, defaultBgSize, defaultBgColor, this))
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
} else if (gistDelimFound(dp)) {
|
} else if (gistDelimFound(dp)) {
|
||||||
|
@ -634,6 +636,7 @@ public class MarkdownModel implements Markdown {
|
||||||
public static final String DELIM_QUERY_CODE = "code";
|
public static final String DELIM_QUERY_CODE = "code";
|
||||||
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_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";
|
||||||
|
|
||||||
|
@ -647,6 +650,8 @@ public class MarkdownModel implements Markdown {
|
||||||
"<!-- .slide: data-background-iframe=\"";
|
"<!-- .slide: data-background-iframe=\"";
|
||||||
public static final String MD_IMAGE_SIZE =
|
public static final String MD_IMAGE_SIZE =
|
||||||
"\" data-background-size=\"";
|
"\" data-background-size=\"";
|
||||||
|
public static final String MD_IMAGE_COLOR =
|
||||||
|
"\" data-background-color=\"";
|
||||||
public static final String MD_CLOSER = "\" -->";
|
public static final String MD_CLOSER = "\" -->";
|
||||||
public static final String MD_SPACER = "\n";
|
public static final String MD_SPACER = "\n";
|
||||||
public static final String DATA_IMAGE_ATTR = "data-background-image=";
|
public static final String DATA_IMAGE_ATTR = "data-background-image=";
|
||||||
|
|
|
@ -44,28 +44,36 @@ public class ImageService {
|
||||||
public String buildBackground(PitchParams pp,
|
public String buildBackground(PitchParams pp,
|
||||||
YAMLOptions yOpts) {
|
YAMLOptions yOpts) {
|
||||||
|
|
||||||
return buildBackground(yOpts.fetchImageBg(pp), yOpts.fetchImageBgSize(pp));
|
return buildBackground(yOpts.fetchImageBg(pp),
|
||||||
|
yOpts.fetchImageBgSize(pp),
|
||||||
|
yOpts.fetchImageBgColor(pp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String buildBackground(String md,
|
public String buildBackground(String md,
|
||||||
DelimParams dp,
|
DelimParams dp,
|
||||||
PitchParams pp,
|
PitchParams pp,
|
||||||
String defaultSize,
|
String defaultSize,
|
||||||
|
String defaultColor,
|
||||||
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);
|
||||||
return buildBackground(bgUrl, bgSize);
|
String bgColor = dp.get(MarkdownModel.DELIM_QUERY_COLOR, defaultColor);
|
||||||
|
return buildBackground(bgUrl, bgSize, bgColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildBackground(String bgUrl, String bgSize) {
|
private String buildBackground(String bgUrl,
|
||||||
|
String bgSize,
|
||||||
|
String bgColor) {
|
||||||
|
|
||||||
return new StringBuffer(MarkdownModel.MD_SPACER)
|
return new StringBuffer(MarkdownModel.MD_SPACER)
|
||||||
.append(MarkdownModel.MD_IMAGE_OPEN)
|
.append(MarkdownModel.MD_IMAGE_OPEN)
|
||||||
.append(bgUrl)
|
.append(bgUrl)
|
||||||
.append(MarkdownModel.MD_IMAGE_SIZE)
|
.append(MarkdownModel.MD_IMAGE_SIZE)
|
||||||
.append(bgSize)
|
.append(bgSize)
|
||||||
|
.append(MarkdownModel.MD_IMAGE_COLOR)
|
||||||
|
.append(bgColor)
|
||||||
.append(MarkdownModel.MD_CLOSER)
|
.append(MarkdownModel.MD_CLOSER)
|
||||||
.append(MarkdownModel.MD_SPACER)
|
.append(MarkdownModel.MD_SPACER)
|
||||||
.toString();
|
.toString();
|
||||||
|
|
|
@ -183,6 +183,15 @@ public final class YAMLOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String fetchImageBgColor(PitchParams pp) {
|
||||||
|
String bgColor = _yProps.get(IMAGE_BG_COLOR_OPTION);
|
||||||
|
if (bgColor == null) {
|
||||||
|
return DEFAULT_BG_COLOR;
|
||||||
|
} else {
|
||||||
|
return bgColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String fetchTransition(PitchParams pp) {
|
public String fetchTransition(PitchParams pp) {
|
||||||
|
|
||||||
String transition = _yProps.get(TRANSITION_OPTION);
|
String transition = _yProps.get(TRANSITION_OPTION);
|
||||||
|
@ -359,6 +368,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_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";
|
||||||
|
@ -373,6 +383,7 @@ public final class YAMLOptions {
|
||||||
private static final String LOGO_POSITION_OPTION = "logo-position";
|
private static final String LOGO_POSITION_OPTION = "logo-position";
|
||||||
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 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