Skip to content

Commit

Permalink
Merge pull request #208 from Bernardo-MG/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Bernardo-MG authored Jul 17, 2021
2 parents 159bb5d + 0d96b3c commit 141f5ef
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 36 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
},
"dependencies": {
"@fortawesome/fontawesome-free": "~5.15.3",
"bootstrap": "~5.0.1",
"bootswatch": "~5.0.1",
"bootstrap": "~5.0.2",
"bootswatch": "~5.0.2",
"clean-css-cli": "~5.3.0",
"csslint": "~1.0.5",
"html5shiv": "~3.7.3"
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<groupId>com.bernardomg.maven.skins</groupId>
<artifactId>docs-maven-skin</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>

<name>Docs Maven Skin</name>
<description>A Maven skin for using Maven Site as a documentation site</description>
Expand Down
5 changes: 4 additions & 1 deletion src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@
Corrected images on dark shine.
</action>
</release>
<release version="2.3.0" date="2021-07-04" description="">
<release version="2.2.4" date="2021-07-17" description="Dark theme image support">
<action dev="bmg" type="fix">
Additional corretion to images on dark shine.
</action>
</release>
</body>
</document>
14 changes: 13 additions & 1 deletion src/main/resources/META-INF/maven/macros/config-macros.vm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* Receives:
* shine: value where the CSS color shine will be stored
* bgshine: value where the CSS color shine for the background will be stored
* figshine: value where the CSS color shine for the figures will be stored
*
* Makes use of the following variables:
* config.shine: value of the style color shine
Expand All @@ -38,7 +39,7 @@
*
*#
#*--------------------------------------------------*#
#macro( loadShineConfig $shine $bgshine )
#macro( loadShineConfig $shine $bgshine $figshine )

#**##if ( $config.shine )
#* *##set( $shine = $config.shine.getValue() )
Expand All @@ -56,6 +57,17 @@
#**##else
#* *##set( $bgshine = "light" )
#**##end
#**##if ( $config.figshine )
#* *##set( $figshine = $config.figshine.getValue() )
#**##elseif ( $config.shine )
#* *##if ( $config.shine.getValue() == "dark" )
#* *##set( $figshine = "dark" )
#* *##else
#* *##set( $figshine = $config.figshine.getValue() )
#* *##end
#**##else
#* *##set( $figshine = "white" )
#**##end
#end
#*

Expand Down
11 changes: 5 additions & 6 deletions src/main/resources/META-INF/maven/macros/setup-macros.vm
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
#**
* Sets up the body content modifying it with various utilities.
*
* Receives:
* figshine: CSS color shine for figures
*
*#
#*--------------------------------------------------*#
#macro( setUp )
#macro( setUp $figshine )
#**
* Parses body content.
*#
Expand Down Expand Up @@ -96,11 +99,7 @@
#**##set( $empty = $siteTool.transformImagesToFigures( $bodyContentParsed ) )
#**##set( $empty = $htmlTool.wrap($bodyContentParsed, 'figure', '<div class="d-inline-flex"></div>') )
#**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'figure', 'shadow' ) )
#**##if ( $config.shine && $config.shine.getValue() == "dark" )
#* *##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'figure', 'bg-dark' ) )
#**##else
#* *##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'figure', 'bg-white' ) )
#**##end
#**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'figure', "bg-$figshine" ) )
#**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'figure', 'rounded' ) )
#**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'figure', 'p-2' ) )
#**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'figure > img', 'img-fluid' ) )
Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/META-INF/maven/site.vm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
* Body content is modified and edited by the various utilities.
*#
#*--------------------------------------------------*#
#setUp()
#set( $shine = "" )
#set( $bgshine = "" )
#set( $figshine = "" )
#loadShineConfig( $shine $bgshine $figshine )
#setUp( $figshine )
<!DOCTYPE html>
<!--
Generated by Apache Maven Doxia#if( $doxiaVersion ) $doxiaVersion#end the $dateFormat.format( $currentDate )
Expand Down Expand Up @@ -114,9 +118,6 @@
<![endif]-->

</head>
#set( $shine = "" )
#set( $bgshine = "" )
#loadShineConfig( $shine $bgshine )
<body class="d-flex flex-column">
<header>
<nav id="navbar-main" class="navbar navbar-expand-md navbar-$shine bg-$bgshine">
Expand Down
18 changes: 17 additions & 1 deletion src/site/markdown/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ For example, to set up the Darkly theme add this to your *site.xml* file:

### Background shine

By default dark menus will be set for the primary color. This can be overriden with the `bgshine` option.
By default dark menus will use the primary color. This can be overriden with the `bgshine` option.

```xml
<custom>
Expand All @@ -48,4 +48,20 @@ By default dark menus will be set for the primary color. This can be overriden w
</custom>
```

### Figure shine

By default images will receive the white background, or the dark one for dark themes. To change this use the `figshine` option.

```xml
<custom>
<skinConfig>
<!-- Use the sketchy style -->
<bootswatchStyle>darkly</bootswatchStyle>
<shine>dark</shine>
<bgshine>primary</bgshine>
<bgshine>white</bgshine>
</skinConfig>
</custom>
```

[bootswatch]: https://bootswatch.com/
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Site With Images
# Site With Images and Dark Theme

This is an example for a Maven Site with images.
This is an example for a Maven Site with images and a dark theme.

![Dice class diagram][dice-class_diagram]

Expand Down
12 changes: 0 additions & 12 deletions src/test/resources/it/image_shine_dark/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,4 @@ def body = parsed.body()

// Images
def fig = body.select( 'figure' ).first()
assert fig.hasClass( 'shadow' )
assert fig.hasClass( 'bg-dark' )
assert fig.hasClass( 'rounded' )
assert fig.hasClass( 'p-2' )

def firstImg = fig.select( 'img' ).first()
assert firstImg.attr( 'src' ).contains( './images/example_class_diagram.png' )
assert firstImg.attr( 'alt' ).contains( 'Dice class diagram' )
assert firstImg.hasClass( 'img-fluid' )

def firstCaption = fig.select( 'figcaption' ).first()
assert firstCaption.html().contains( 'Dice class diagram' )
assert firstCaption.hasClass( 'font-italic' )
52 changes: 52 additions & 0 deletions src/test/resources/it/image_shine_dark_overriden/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<!-- ********************************************** -->
<!-- **************** PROJECT INFO **************** -->
<!-- ********************************************** -->

<groupId>com.bernardomg.maven.skins</groupId>
<artifactId>image-shine-dark-overriden</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

<!-- ********************************************** -->
<!-- **************** PROPERTIES ****************** -->
<!-- ********************************************** -->

<properties>
<!-- Plugins versions -->
<plugin.site.version>@plugin.site.version@</plugin.site.version>
<!-- Maven Site -->
<site.skin.version>@project.version@</site.skin.version>
</properties>

<!-- ********************************************** -->
<!-- ******************* BUILD ******************** -->
<!-- ********************************************** -->

<build>
<defaultGoal>clean package install</defaultGoal>
<plugins>
<plugin>
<!-- Site -->
<!-- Generates the Maven Site -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${plugin.site.version}</version>
<dependencies>
<dependency>
<!-- Docs Maven Skin -->
<groupId>com.bernardomg.maven.skins</groupId>
<artifactId>docs-maven-skin</artifactId>
<version>${site.skin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Site With Images and Invalid Dark Theme

This is an example for a Maven Site with images and a dark theme which looks bad for images.

![Dice class diagram][dice-class_diagram]

## Big Image

![Big image][big-image]

[big-image]: ./images/Fronalpstock_big.jpg
[dice-class_diagram]: ./images/example_class_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/test/resources/it/image_shine_dark_overriden/src/site/site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/DECORATION/1.8.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.8.0 http://maven.apache.org/xsd/decoration-1.8.0.xsd">

<skin>
<groupId>com.bernardomg.maven.skins</groupId>
<artifactId>docs-maven-skin</artifactId>
<version>${site.skin.version}</version>
</skin>

<custom>
<skinConfig>
<bootswatchStyle>spacelab</bootswatchStyle>
<shine>dark</shine>
<bgshine>primary</bgshine>
<figshine>white</figshine>
</skinConfig>
</custom>

</project>
14 changes: 14 additions & 0 deletions src/test/resources/it/image_shine_dark_overriden/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This script verifies that a minimal site contains only the barebones of a site.

import org.jsoup.Jsoup

// Acquires the sample HTML content
def html = new File(basedir, 'target/site/index.html').text

// Parses HTML
def parsed = Jsoup.parse(html)
def body = parsed.body()

// Images
def fig = body.select( 'figure' ).first()
assert fig.hasClass( 'bg-white' )

0 comments on commit 141f5ef

Please sign in to comment.