-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add extension point for excerpt generation
- Loading branch information
Showing
6 changed files
with
143 additions
and
26 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
api/src/main/java/run/halo/app/content/ExcerptGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package run.halo.app.content; | ||
|
||
import java.util.Set; | ||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
import org.pf4j.ExtensionPoint; | ||
import reactor.core.publisher.Mono; | ||
|
||
public interface ExcerptGenerator extends ExtensionPoint { | ||
|
||
Mono<String> generate(ExcerptGenerator.Context context); | ||
|
||
@Data | ||
@Accessors(chain = true) | ||
class Context { | ||
private String raw; | ||
/** | ||
* html content. | ||
*/ | ||
private String content; | ||
|
||
private String rawType; | ||
/** | ||
* keywords in the content to help the excerpt generation more accurate. | ||
*/ | ||
private Set<String> keywords; | ||
/** | ||
* Max length of the generated excerpt. | ||
*/ | ||
private int maxLength; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters