Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Export by file name extension

AuthorDaveJarvis <email>
Date2022-01-06 22:34:39 GMT-0800
Commit69196dee0dfd9de741680d393d55b5ce3b1c383c
Parent8350e8d
Delta12 lines added, 6 lines removed, 6-line increase
src/main/java/com/keenwrite/processors/ProcessorFactory.java
final Processor<String> processor;
- if( preview == null && outputType == MARKDOWN_PLAIN ) {
- processor = inputType == RMARKDOWN
- ? createInlineRProcessor( successor, context )
- : createMarkdownProcessor( successor, context );
+ // When there's no preview, determine processor by file name extension.
+ if( preview == null ) {
+ if( outputType == MARKDOWN_PLAIN ) {
+ processor = inputType == RMARKDOWN
+ ? createInlineRProcessor( successor, context )
+ : createVariableProcessor( successor, context );
+ }
+ else {
+ processor = createMarkdownProcessor( successor, context );
+ }
}
else {
src/main/java/com/keenwrite/io/MediaTypeExtension.java
MEDIA_TEXT_R_MARKDOWN( TEXT_R_MARKDOWN, of( "Rmd" ) ),
MEDIA_TEXT_PROPERTIES( TEXT_PROPERTIES, of( "properties" ) ),
- MEDIA_TEXT_XHTML( TEXT_XHTML, of( "xhtml" ) ),
+ MEDIA_TEXT_XHTML( TEXT_XHTML, of( "html", "xhtml" ) ),
MEDIA_TEXT_XML( TEXT_XML ),
MEDIA_TEXT_YAML( TEXT_YAML, of( "yaml", "yml" ) ),
* @return The associated {@link MediaType} as defined by IANA.
*/
- static MediaType getMediaType( final String extension ) {
+ public static MediaType fromExtension( final String extension ) {
final var sanitized = sanitize( extension );