mirror of https://github.com/halo-dev/halo
Fix incorrectly non-git folder opening and fix start panic when no themes found (#1479)
parent
a046f3edca
commit
0059668a76
|
@ -1,6 +1,5 @@
|
||||||
package run.halo.app.core;
|
package run.halo.app.core;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.core.MethodParameter;
|
import org.springframework.core.MethodParameter;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
@ -26,18 +25,18 @@ public class CommonResultControllerAdvice implements ResponseBodyAdvice<Object>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(MethodParameter returnType,
|
public boolean supports(MethodParameter returnType,
|
||||||
@NotNull Class<? extends HttpMessageConverter<?>> converterType) {
|
@NonNull Class<? extends HttpMessageConverter<?>> converterType) {
|
||||||
return AbstractJackson2HttpMessageConverter.class.isAssignableFrom(converterType);
|
return AbstractJackson2HttpMessageConverter.class.isAssignableFrom(converterType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
public final Object beforeBodyWrite(@Nullable Object body,
|
public final Object beforeBodyWrite(@Nullable Object body,
|
||||||
@NotNull MethodParameter returnType,
|
@NonNull MethodParameter returnType,
|
||||||
@NotNull MediaType contentType,
|
@NonNull MediaType contentType,
|
||||||
@NotNull Class<? extends HttpMessageConverter<?>> converterType,
|
@NonNull Class<? extends HttpMessageConverter<?>> converterType,
|
||||||
@NotNull ServerHttpRequest request,
|
@NonNull ServerHttpRequest request,
|
||||||
@NotNull ServerHttpResponse response) {
|
@NonNull ServerHttpResponse response) {
|
||||||
MappingJacksonValue container = getOrCreateContainer(body);
|
MappingJacksonValue container = getOrCreateContainer(body);
|
||||||
// The contain body will never be null
|
// The contain body will never be null
|
||||||
beforeBodyWriteInternal(container, contentType, returnType, request, response);
|
beforeBodyWriteInternal(container, contentType, returnType, request, response);
|
||||||
|
|
|
@ -167,12 +167,9 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
||||||
// Create theme folder
|
// Create theme folder
|
||||||
Path themePath = themeService.getBasePath();
|
Path themePath = themeService.getBasePath();
|
||||||
|
|
||||||
// Fix the problem that the project cannot start after moving to a new server
|
if (themeService.fetchThemePropertyBy(HaloConst.DEFAULT_THEME_ID).isEmpty()) {
|
||||||
if (Files.notExists(themePath) || !isInstalled) {
|
|
||||||
FileUtils.copyFolder(source, themePath);
|
FileUtils.copyFolder(source, themePath);
|
||||||
log.debug("Copied theme folder from [{}] to [{}]", source, themePath);
|
log.info("Copied theme folder from [{}] to [{}]", source, themePath);
|
||||||
} else {
|
|
||||||
log.debug("Skipped copying theme folder due to existence of theme folder");
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof FileNotFoundException) {
|
if (e instanceof FileNotFoundException) {
|
||||||
|
|
|
@ -98,10 +98,6 @@ public class ThemeRepositoryImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<ThemeProperty> fetchThemePropertyByThemeId(String themeId) {
|
public Optional<ThemeProperty> fetchThemePropertyByThemeId(String themeId) {
|
||||||
if (StringUtils.equals(themeId, getActivatedThemeId())) {
|
|
||||||
return Optional.of(getActivatedThemeProperty());
|
|
||||||
}
|
|
||||||
|
|
||||||
return ThemePropertyScanner.INSTANCE.scan(getThemeRootPath(), null)
|
return ThemePropertyScanner.INSTANCE.scan(getThemeRootPath(), null)
|
||||||
.stream()
|
.stream()
|
||||||
.filter(property -> Objects.equals(themeId, property.getId()))
|
.filter(property -> Objects.equals(themeId, property.getId()))
|
||||||
|
|
|
@ -27,11 +27,13 @@ import run.halo.app.exception.BadRequestException;
|
||||||
import run.halo.app.exception.ForbiddenException;
|
import run.halo.app.exception.ForbiddenException;
|
||||||
import run.halo.app.exception.NotFoundException;
|
import run.halo.app.exception.NotFoundException;
|
||||||
import run.halo.app.exception.ServiceException;
|
import run.halo.app.exception.ServiceException;
|
||||||
|
import run.halo.app.exception.ThemeNotFoundException;
|
||||||
import run.halo.app.exception.ThemeNotSupportException;
|
import run.halo.app.exception.ThemeNotSupportException;
|
||||||
import run.halo.app.exception.ThemePropertyMissingException;
|
import run.halo.app.exception.ThemePropertyMissingException;
|
||||||
import run.halo.app.exception.ThemeUpdateException;
|
import run.halo.app.exception.ThemeUpdateException;
|
||||||
import run.halo.app.handler.theme.config.ThemeConfigResolver;
|
import run.halo.app.handler.theme.config.ThemeConfigResolver;
|
||||||
import run.halo.app.handler.theme.config.support.Group;
|
import run.halo.app.handler.theme.config.support.Group;
|
||||||
|
import run.halo.app.handler.theme.config.support.Option;
|
||||||
import run.halo.app.handler.theme.config.support.ThemeProperty;
|
import run.halo.app.handler.theme.config.support.ThemeProperty;
|
||||||
import run.halo.app.model.support.HaloConst;
|
import run.halo.app.model.support.HaloConst;
|
||||||
import run.halo.app.model.support.ThemeFile;
|
import run.halo.app.model.support.ThemeFile;
|
||||||
|
@ -131,7 +133,7 @@ public class ThemeServiceImpl implements ThemeService {
|
||||||
Path themePath = Paths.get(themeProperty.getThemePath());
|
Path themePath = Paths.get(themeProperty.getThemePath());
|
||||||
try (Stream<Path> pathStream = Files.list(themePath)) {
|
try (Stream<Path> pathStream = Files.list(themePath)) {
|
||||||
return pathStream.filter(path ->
|
return pathStream.filter(path ->
|
||||||
StringUtils.startsWithIgnoreCase(path.getFileName().toString(), prefix))
|
StringUtils.startsWithIgnoreCase(path.getFileName().toString(), prefix))
|
||||||
.map(path -> {
|
.map(path -> {
|
||||||
// Remove prefix
|
// Remove prefix
|
||||||
final var customTemplate = StringUtils
|
final var customTemplate = StringUtils
|
||||||
|
@ -315,13 +317,17 @@ public class ThemeServiceImpl implements ThemeService {
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
public ThemeProperty getActivatedTheme() {
|
public ThemeProperty getActivatedTheme() {
|
||||||
return fetchActivatedTheme().orElseThrow();
|
return themeRepository.getActivatedThemeProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
public Optional<ThemeProperty> fetchActivatedTheme() {
|
public Optional<ThemeProperty> fetchActivatedTheme() {
|
||||||
return Optional.of(themeRepository.getActivatedThemeProperty());
|
try {
|
||||||
|
return Optional.of(themeRepository.getActivatedThemeProperty());
|
||||||
|
} catch (ThemeNotFoundException tne) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class GitThemeUpdater implements ThemeUpdater {
|
||||||
|
|
||||||
final var oldThemePath = Paths.get(oldThemeProperty.getThemePath());
|
final var oldThemePath = Paths.get(oldThemeProperty.getThemePath());
|
||||||
// open old git repo
|
// open old git repo
|
||||||
try (final var oldGit = Git.open(oldThemePath.toFile())) {
|
try (final var oldGit = Git.init().setDirectory(oldThemePath.toFile()).call()) {
|
||||||
// 0. commit old repo
|
// 0. commit old repo
|
||||||
commitAutomatically(oldGit);
|
commitAutomatically(oldGit);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.vladsch.flexmark.util.ast.Document;
|
||||||
import com.vladsch.flexmark.util.ast.Node;
|
import com.vladsch.flexmark.util.ast.Node;
|
||||||
import com.vladsch.flexmark.util.ast.ReferencingNode;
|
import com.vladsch.flexmark.util.ast.ReferencingNode;
|
||||||
import com.vladsch.flexmark.util.sequence.BasedSequence;
|
import com.vladsch.flexmark.util.sequence.BasedSequence;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.springframework.lang.NonNull;
|
||||||
import run.halo.app.utils.footnotes.internal.FootnoteRepository;
|
import run.halo.app.utils.footnotes.internal.FootnoteRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@ public class Footnote extends Node implements DelimitedNode, DoNotDecorate, Link
|
||||||
|
|
||||||
protected int referenceOrdinal;
|
protected int referenceOrdinal;
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public BasedSequence getReference() {
|
public BasedSequence getReference() {
|
||||||
return text;
|
return text;
|
||||||
|
@ -80,14 +80,14 @@ public class Footnote extends Node implements DelimitedNode, DoNotDecorate, Link
|
||||||
this.footnoteBlock = footnoteBlock;
|
this.footnoteBlock = footnoteBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public BasedSequence[] getSegments() {
|
public BasedSequence[] getSegments() {
|
||||||
return new BasedSequence[] {openingMarker, text, closingMarker};
|
return new BasedSequence[] {openingMarker, text, closingMarker};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getAstExtra(@NotNull StringBuilder out) {
|
public void getAstExtra(@NonNull StringBuilder out) {
|
||||||
out.append(" ordinal: ")
|
out.append(" ordinal: ")
|
||||||
.append(footnoteBlock != null ? footnoteBlock.getFootnoteOrdinal() : 0).append(" ");
|
.append(footnoteBlock != null ? footnoteBlock.getFootnoteOrdinal() : 0).append(" ");
|
||||||
delimitedSegmentSpanChars(out, openingMarker, text, closingMarker, "text");
|
delimitedSegmentSpanChars(out, openingMarker, text, closingMarker, "text");
|
||||||
|
|
|
@ -10,8 +10,8 @@ import com.vladsch.flexmark.util.data.DataHolder;
|
||||||
import com.vladsch.flexmark.util.sequence.BasedSequence;
|
import com.vladsch.flexmark.util.sequence.BasedSequence;
|
||||||
import com.vladsch.flexmark.util.sequence.SequenceUtils;
|
import com.vladsch.flexmark.util.sequence.SequenceUtils;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import run.halo.app.utils.footnotes.internal.FootnoteRepository;
|
import run.halo.app.utils.footnotes.internal.FootnoteRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,7 @@ public class FootnoteBlock extends Block
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Footnote getReferencingNode(@NotNull Node node) {
|
public Footnote getReferencingNode(@NonNull Node node) {
|
||||||
return node instanceof Footnote ? (Footnote) node : null;
|
return node instanceof Footnote ? (Footnote) node : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public class FootnoteBlock extends Block
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getAstExtra(@NotNull StringBuilder out) {
|
public void getAstExtra(@NonNull StringBuilder out) {
|
||||||
out.append(" ordinal: ").append(footnoteOrdinal).append(" ");
|
out.append(" ordinal: ").append(footnoteOrdinal).append(" ");
|
||||||
segmentSpan(out, openingMarker, "open");
|
segmentSpan(out, openingMarker, "open");
|
||||||
segmentSpan(out, text, "text");
|
segmentSpan(out, text, "text");
|
||||||
|
@ -82,7 +82,7 @@ public class FootnoteBlock extends Block
|
||||||
segmentSpan(out, footnote, "footnote");
|
segmentSpan(out, footnote, "footnote");
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public BasedSequence[] getSegments() {
|
public BasedSequence[] getSegments() {
|
||||||
return new BasedSequence[] {openingMarker, text, closingMarker, footnote};
|
return new BasedSequence[] {openingMarker, text, closingMarker, footnote};
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.vladsch.flexmark.util.data.DataKey;
|
||||||
import com.vladsch.flexmark.util.data.MutableDataHolder;
|
import com.vladsch.flexmark.util.data.MutableDataHolder;
|
||||||
import com.vladsch.flexmark.util.format.options.ElementPlacement;
|
import com.vladsch.flexmark.util.format.options.ElementPlacement;
|
||||||
import com.vladsch.flexmark.util.format.options.ElementPlacementSort;
|
import com.vladsch.flexmark.util.format.options.ElementPlacementSort;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.springframework.lang.NonNull;
|
||||||
import run.halo.app.utils.footnotes.internal.FootnoteBlockParser;
|
import run.halo.app.utils.footnotes.internal.FootnoteBlockParser;
|
||||||
import run.halo.app.utils.footnotes.internal.FootnoteLinkRefProcessor;
|
import run.halo.app.utils.footnotes.internal.FootnoteLinkRefProcessor;
|
||||||
import run.halo.app.utils.footnotes.internal.FootnoteNodeFormatter;
|
import run.halo.app.utils.footnotes.internal.FootnoteNodeFormatter;
|
||||||
|
@ -63,8 +63,8 @@ public class FootnoteExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void extend(@NotNull HtmlRenderer.Builder htmlRendererBuilder,
|
public void extend(@NonNull HtmlRenderer.Builder htmlRendererBuilder,
|
||||||
@NotNull String rendererType) {
|
@NonNull String rendererType) {
|
||||||
if (htmlRendererBuilder.isRendererType("HTML")) {
|
if (htmlRendererBuilder.isRendererType("HTML")) {
|
||||||
htmlRendererBuilder.nodeRendererFactory(new FootnoteNodeRenderer.Factory());
|
htmlRendererBuilder.nodeRendererFactory(new FootnoteNodeRenderer.Factory());
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class FootnoteExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rendererOptions(@NotNull MutableDataHolder options) {
|
public void rendererOptions(@NonNull MutableDataHolder options) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ import com.vladsch.flexmark.util.sequence.BasedSequence;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import run.halo.app.utils.footnotes.FootnoteBlock;
|
import run.halo.app.utils.footnotes.FootnoteBlock;
|
||||||
import run.halo.app.utils.footnotes.FootnoteExtension;
|
import run.halo.app.utils.footnotes.FootnoteExtension;
|
||||||
|
|
||||||
|
@ -115,9 +115,9 @@ public class FootnoteBlockParser extends AbstractBlockParser {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public BlockParserFactory apply(@NotNull DataHolder options) {
|
public BlockParserFactory apply(@NonNull DataHolder options) {
|
||||||
return new BlockFactory(options);
|
return new BlockFactory(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.vladsch.flexmark.util.ast.Document;
|
||||||
import com.vladsch.flexmark.util.ast.Node;
|
import com.vladsch.flexmark.util.ast.Node;
|
||||||
import com.vladsch.flexmark.util.data.DataHolder;
|
import com.vladsch.flexmark.util.data.DataHolder;
|
||||||
import com.vladsch.flexmark.util.sequence.BasedSequence;
|
import com.vladsch.flexmark.util.sequence.BasedSequence;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.springframework.lang.NonNull;
|
||||||
import run.halo.app.utils.footnotes.Footnote;
|
import run.halo.app.utils.footnotes.Footnote;
|
||||||
import run.halo.app.utils.footnotes.FootnoteBlock;
|
import run.halo.app.utils.footnotes.FootnoteBlock;
|
||||||
import run.halo.app.utils.footnotes.FootnoteExtension;
|
import run.halo.app.utils.footnotes.FootnoteExtension;
|
||||||
|
@ -33,14 +33,14 @@ public class FootnoteLinkRefProcessor implements LinkRefProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMatch(@NotNull BasedSequence nodeChars) {
|
public boolean isMatch(@NonNull BasedSequence nodeChars) {
|
||||||
return nodeChars.length() >= 3 && nodeChars.charAt(0) == '[' && nodeChars.charAt(1) == '^'
|
return nodeChars.length() >= 3 && nodeChars.charAt(0) == '[' && nodeChars.charAt(1) == '^'
|
||||||
&& nodeChars.endCharAt(1) == ']';
|
&& nodeChars.endCharAt(1) == ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Node createNode(@NotNull BasedSequence nodeChars) {
|
public Node createNode(@NonNull BasedSequence nodeChars) {
|
||||||
BasedSequence footnoteId = nodeChars.midSequence(2, -1).trim();
|
BasedSequence footnoteId = nodeChars.midSequence(2, -1).trim();
|
||||||
FootnoteBlock footnoteBlock =
|
FootnoteBlock footnoteBlock =
|
||||||
footnoteId.length() > 0 ? footnoteRepository.get(footnoteId.toString()) : null;
|
footnoteId.length() > 0 ? footnoteRepository.get(footnoteId.toString()) : null;
|
||||||
|
@ -55,39 +55,39 @@ public class FootnoteLinkRefProcessor implements LinkRefProcessor {
|
||||||
return footnote;
|
return footnote;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public BasedSequence adjustInlineText(@NotNull Document document, @NotNull Node node) {
|
public BasedSequence adjustInlineText(@NonNull Document document, @NonNull Node node) {
|
||||||
assert node instanceof Footnote;
|
assert node instanceof Footnote;
|
||||||
return ((Footnote) node).getText();
|
return ((Footnote) node).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowDelimiters(@NotNull BasedSequence chars, @NotNull Document document,
|
public boolean allowDelimiters(@NonNull BasedSequence chars, @NonNull Document document,
|
||||||
@NotNull Node node) {
|
@NonNull Node node) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateNodeElements(@NotNull Document document, @NotNull Node node) {
|
public void updateNodeElements(@NonNull Document document, @NonNull Node node) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Factory implements LinkRefProcessorFactory {
|
public static class Factory implements LinkRefProcessorFactory {
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public LinkRefProcessor apply(@NotNull Document document) {
|
public LinkRefProcessor apply(@NonNull Document document) {
|
||||||
return new FootnoteLinkRefProcessor(document);
|
return new FootnoteLinkRefProcessor(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getWantExclamationPrefix(@NotNull DataHolder options) {
|
public boolean getWantExclamationPrefix(@NonNull DataHolder options) {
|
||||||
return WANT_EXCLAMATION_PREFIX;
|
return WANT_EXCLAMATION_PREFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBracketNestingLevel(@NotNull DataHolder options) {
|
public int getBracketNestingLevel(@NonNull DataHolder options) {
|
||||||
return BRACKET_NESTING_LEVEL;
|
return BRACKET_NESTING_LEVEL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import run.halo.app.utils.footnotes.Footnote;
|
import run.halo.app.utils.footnotes.Footnote;
|
||||||
import run.halo.app.utils.footnotes.FootnoteBlock;
|
import run.halo.app.utils.footnotes.FootnoteBlock;
|
||||||
import run.halo.app.utils.footnotes.FootnoteExtension;
|
import run.halo.app.utils.footnotes.FootnoteExtension;
|
||||||
|
@ -100,9 +100,9 @@ public class FootnoteNodeFormatter
|
||||||
|
|
||||||
public static class Factory implements NodeFormatterFactory {
|
public static class Factory implements NodeFormatterFactory {
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public NodeFormatter create(@NotNull DataHolder options) {
|
public NodeFormatter create(@NonNull DataHolder options) {
|
||||||
return new FootnoteNodeFormatter(options);
|
return new FootnoteNodeFormatter(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.util.HashSet;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.springframework.lang.NonNull;
|
||||||
import run.halo.app.utils.footnotes.Footnote;
|
import run.halo.app.utils.footnotes.Footnote;
|
||||||
import run.halo.app.utils.footnotes.FootnoteBlock;
|
import run.halo.app.utils.footnotes.FootnoteBlock;
|
||||||
import run.halo.app.utils.footnotes.FootnoteExtension;
|
import run.halo.app.utils.footnotes.FootnoteExtension;
|
||||||
|
@ -53,8 +53,8 @@ public class FootnoteNodeRenderer implements PhasedNodeRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderDocument(@NotNull NodeRendererContext context, @NotNull HtmlWriter html,
|
public void renderDocument(@NonNull NodeRendererContext context, @NonNull HtmlWriter html,
|
||||||
@NotNull Document document, @NotNull RenderingPhase phase) {
|
@NonNull Document document, @NonNull RenderingPhase phase) {
|
||||||
if (phase == RenderingPhase.BODY_TOP) {
|
if (phase == RenderingPhase.BODY_TOP) {
|
||||||
if (recheckUndefinedReferences) {
|
if (recheckUndefinedReferences) {
|
||||||
// need to see if have undefined footnotes that were defined after parsing
|
// need to see if have undefined footnotes that were defined after parsing
|
||||||
|
@ -171,9 +171,9 @@ public class FootnoteNodeRenderer implements PhasedNodeRenderer {
|
||||||
|
|
||||||
public static class Factory implements NodeRendererFactory {
|
public static class Factory implements NodeRendererFactory {
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public NodeRenderer apply(@NotNull DataHolder options) {
|
public NodeRenderer apply(@NonNull DataHolder options) {
|
||||||
return new FootnoteNodeRenderer(options);
|
return new FootnoteNodeRenderer(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.springframework.lang.NonNull;
|
||||||
import run.halo.app.utils.footnotes.Footnote;
|
import run.halo.app.utils.footnotes.Footnote;
|
||||||
import run.halo.app.utils.footnotes.FootnoteBlock;
|
import run.halo.app.utils.footnotes.FootnoteBlock;
|
||||||
import run.halo.app.utils.footnotes.FootnoteExtension;
|
import run.halo.app.utils.footnotes.FootnoteExtension;
|
||||||
|
@ -79,19 +79,19 @@ public class FootnoteRepository extends NodeRepository<FootnoteBlock> {
|
||||||
super(FootnoteExtension.FOOTNOTES_KEEP.get(options));
|
super(FootnoteExtension.FOOTNOTES_KEEP.get(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public DataKey<FootnoteRepository> getDataKey() {
|
public DataKey<FootnoteRepository> getDataKey() {
|
||||||
return FootnoteExtension.FOOTNOTES;
|
return FootnoteExtension.FOOTNOTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public DataKey<KeepType> getKeepDataKey() {
|
public DataKey<KeepType> getKeepDataKey() {
|
||||||
return FootnoteExtension.FOOTNOTES_KEEP;
|
return FootnoteExtension.FOOTNOTES_KEEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Set<FootnoteBlock> getReferencedElements(Node parent) {
|
public Set<FootnoteBlock> getReferencedElements(Node parent) {
|
||||||
HashSet<FootnoteBlock> references = new HashSet<>();
|
HashSet<FootnoteBlock> references = new HashSet<>();
|
||||||
|
|
Loading…
Reference in New Issue