-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Head Parsing to ease porting to main branch
- Loading branch information
1 parent
589b744
commit b5b676a
Showing
6 changed files
with
67 additions
and
50 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,16 +1,17 @@ | ||
= Exposed metadata | ||
:asciidoctor-docs-url: https://docs.asciidoctor.org/asciidoc/latest | ||
:maven-site-plugin-docs-url: https://maven.apache.org/plugins/maven-site-plugin | ||
|
||
The Asciidoctor Maven Site integration integrates with Doxia to expose some of its information. | ||
The Asciidoctor Maven Site integration collaborates with Doxia to expose some of its information. | ||
|
||
== Document Header metadata | ||
|
||
The following information from the {asciidoctor-docs-url}/document/header/[header] is extracted: | ||
The following elements from the {asciidoctor-docs-url}/document/header/[header] are integrated: | ||
|
||
document title:: used to inform the breadcrumb line when these are enabled. | ||
document title:: used to inform the {maven-site-plugin-docs-url}/examples/sitedescriptor.html#Breadcrumbs[breadcrumb] line when these are enabled. | ||
|
||
author(s):: full representation (full name and email) will be present as HTML `<meta name="author" ... >` tags inside the HTML `<head>`. | ||
In case of multiple authors, each one will appear in a distinct meta element. | ||
In case of multiple authors, each one will appear in a distinct `meta` element. | ||
|
||
revision date:: the header revision date value wll be presented as-is in a `<meta name="date" ... >` element. | ||
revision date:: the header revision date value will be presented as-is in a `<meta name="date" ... >` element. | ||
Alternatively, if not set, the generated value of `docdatetime` will be used. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.asciidoctor.maven.site; | ||
|
||
import org.apache.maven.doxia.sink.Sink; | ||
|
||
import java.util.Optional; | ||
|
||
class HeadParser { | ||
|
||
private final Sink sink; | ||
|
||
HeadParser(Sink sink) { | ||
this.sink = sink; | ||
} | ||
|
||
void parse(SiteConverterDecorator.HeaderMetadata headerMetadata) { | ||
sink.head(); | ||
sink.title(); | ||
sink.text(Optional.ofNullable(headerMetadata.getTitle()).orElse("[Untitled]")); | ||
sink.title_(); | ||
|
||
for (String author : headerMetadata.getAuthors()) { | ||
sink.author(); | ||
sink.text(author.toString()); | ||
sink.author_(); | ||
} | ||
|
||
sink.date(); | ||
sink.text(headerMetadata.getDateTime()); | ||
sink.date_(); | ||
sink.head_(); | ||
} | ||
} |
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