Top Description Constructors Methods
org.jabref.htmltonode.internal

public final Class CssStyleParser

extends Object
Class Inheritance
Imports
java.util.LinkedHashMap, .Locale, .Map, .Optional, org.jabref.htmltonode.model.CssLength, .InlineStyle, org.jspecify.annotations.Nullable

Applies the subset of inline CSS (style="…" attributes) that occurs in JabRef preview HTML: citeproc-java spans (font-style, font-variant, font-weight, text-decoration), the search highlighter's background, cover-image sizing, and the AI raw template's white-space: pre-wrap.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static InlineStyle
apply(InlineStyle style, @Nullable String styleAttribute)

private static InlineStyle
private static InlineStyle
pack-priv static Map<String, String>
declarations(String styleAttribute)

private static String
private static String
firstToken(String value, boolean whole)

public static boolean
public static Optional<CssLength>
length(@Nullable String styleAttribute, String property)

Length of property (e.g. height) in a style attribute, if present and parseable.

private static Optional<Double>
parseFontSize(String lowerValue, double currentScale)

Returns the new absolute scale, em/%/larger/smaller being relative to currentScale.

private static int
parseFontWeight(String lowerValue, int current)

public static Optional<CssLength>
public static WhiteSpaceMode
whiteSpace(@Nullable String styleAttribute, WhiteSpaceMode current)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CssStyleParserback to summary
private CssStyleParser()

Method Detail

applyback to summary
public static InlineStyle apply(InlineStyle style, @Nullable String styleAttribute)
applyFontFamilyback to summary
private static InlineStyle applyFontFamily(InlineStyle style, String value)
applyTextDecorationback to summary
private static InlineStyle applyTextDecoration(InlineStyle style, String lowerValue)
declarationsback to summary
pack-priv static Map<String, String> declarations(String styleAttribute)
firstTokenback to summary
private static String firstToken(String value)
firstTokenback to summary
private static String firstToken(String value, boolean whole)
isDisplayBlockback to summary
public static boolean isDisplayBlock(@Nullable String styleAttribute)
lengthback to summary
public static Optional<CssLength> length(@Nullable String styleAttribute, String property)

Length of property (e.g. height) in a style attribute, if present and parseable.

parseFontSizeback to summary
private static Optional<Double> parseFontSize(String lowerValue, double currentScale)

Returns the new absolute scale, em/%/larger/smaller being relative to currentScale. px/pt are interpreted against the 16px CSS reference size.

parseFontWeightback to summary
private static int parseFontWeight(String lowerValue, int current)
parseLengthback to summary
public static Optional<CssLength> parseLength(String value)
whiteSpaceback to summary
public static WhiteSpaceMode whiteSpace(@Nullable String styleAttribute, WhiteSpaceMode current)