All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.maven.macros.setup-macros.vm Maven / Gradle / Ivy

#*
 * The MIT License (MIT)
 * 
 * Copyright (c) 2015-2021 Bernardo Martínez Garrido
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *###
#*--------------------------------------------------*###
#*--------------------------------------------------*###
#**
 * Sets up the body content modifying it with various utilities.
 *
 * Receives:
 *        figshine: CSS color shine for figures
 *
 *###
#*--------------------------------------------------*###
#macro( setUp $figshine )
#**
 * Parses body content.
 *###
#**##set( $bodyContentParsed = $htmlTool.parse( $bodyContent ) )##
#*



*###
#**
 * Updates code sections.
 *###
#**##set( $empty = $htmlTool.wrap( $bodyContentParsed, 'pre.source', '
' ) )## #**##set( $empty = $htmlTool.removeClass( $bodyContentParsed, 'pre.source', 'source' ) )## #**##set( $empty = $htmlTool.retag( $bodyContentParsed, 'div.source', 'code' ) )## #**##set( $empty = $htmlTool.unwrap( $bodyContentParsed, 'code > code' ) )## #**##set( $empty = $htmlTool.swapTagWithParent( $bodyContentParsed, 'code > pre' ) )## #**##set( $empty = $htmlTool.removeClass( $bodyContentParsed, 'code.source', 'source' ) )## #**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'pre', 'border' ) )## #**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'pre', 'shadow' ) )## #**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'pre', 'rounded' ) )## #* *### #** * Updates section divs. *### #**##set( $empty = $htmlTool.retag( $bodyContentParsed, 'div.section', 'section' ) )## #**##set( $empty = $htmlTool.removeClass( $bodyContentParsed, 'section.section', 'section' ) )## #* *### #** * Fixes internal links. *### #**##set( $empty = $html5UpdateTool.removePointsFromAttr( $bodyContentParsed, '[id]', 'id' ) )## #**##set( $empty = $html5UpdateTool.removePointsFromAttr( $bodyContentParsed, '[href^=\"#\"]', 'href' ) )## #* *### #** * Removes external links. *### #**##set( $empty = $htmlTool.removeClass( $bodyContentParsed, 'a.externalLink', 'externalLink' ) )## #* *### #** * Updates tables. *### #**##set( $empty = $htmlTool.removeClass( $bodyContentParsed, 'table.bodyTable', 'bodyTable' ) )## #**##set( $empty = $html5UpdateTool.updateTableHeads( $bodyContentParsed ) )## #**##set( $empty = $htmlTool.removeAttribute( $bodyContentParsed, 'table[border]', 'border' ) )## #**##set( $empty = $htmlTool.removeClass( $bodyContentParsed, 'tr.a', 'a' ) )## #**##set( $empty = $htmlTool.removeClass( $bodyContentParsed, 'tr.b', 'b' ) )## #**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'table', 'table' ) )## #**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'table', 'table-striped' ) )## #**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'table', 'table-bordered' ) )## #* *### #** * Fixes reports. *### #**##set( $empty = $siteTool.fixReport($bodyContentParsed, $config.fileId) )## #**##set( $empty = $siteTool.transformIcons( $bodyContentParsed ) )## #**##set( $empty = $siteTool.fixHeadingIds($bodyContentParsed) )## #**##set( $empty = $siteTool.fixAnchorLinks($bodyContentParsed) )## #* *### #** * Updates images. *### #**##set( $empty = $htmlTool.removeAttribute( $bodyContentParsed, 'img[alt=""]', 'alt' ) )## #**##set( $empty = $siteTool.transformImagesToFigures( $bodyContentParsed ) )## #**##set( $empty = $htmlTool.wrap($bodyContentParsed, 'figure', '
') )## #**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'figure', 'shadow' ) )## #**##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' ) )## #**##set( $empty = $htmlTool.addClass( $bodyContentParsed, 'figure > figcaption', 'font-italic' ) )## #* *### #** * Updates header. *### #**##set( $empty = $htmlTool.wrap($bodyContentParsed, 'h1:first-of-type', '
') )## ## #** * Recovers body content. *### #**##set( $bodyContent = $bodyContentParsed.html() )## ## #end #* *###




© 2015 - 2025 Weber Informatics LLC | Privacy Policy