Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.demcha.compose.document.templates.components;

import com.demcha.compose.document.templates.core.text.MarkdownText;

import com.demcha.compose.document.node.*;
import com.demcha.compose.document.style.DocumentInsets;
import com.demcha.compose.document.style.DocumentTextStyle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.demcha.compose.document.templates.cv.v2.components;
package com.demcha.compose.document.templates.core.text;

import com.demcha.compose.document.dsl.RichText;
import com.demcha.compose.document.node.InlineRun;
import com.demcha.compose.document.node.InlineTextRun;
import com.demcha.compose.document.style.DocumentTextStyle;
import com.demcha.compose.document.templates.components.MarkdownText;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -15,8 +14,8 @@
* (non-emphasised) segments.
*
* <p>Honours {@code **bold**}, {@code *italic*}, {@code _italic_} via
* the shared {@link MarkdownText} parser. Lives in the components
* layer because every body / row / entry renderer calls it.</p>
* the shared {@link MarkdownText} parser. Part of the neutral core text
* layer, shared by every template family's body / row / entry rendering.</p>
*
* <p><strong>Inline links (since v1.6.8).</strong> Recognises the
* standard Markdown {@code [label](url)} syntax and emits a clickable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.demcha.compose.document.templates.components;
package com.demcha.compose.document.templates.core.text;

import com.demcha.compose.document.node.InlineRun;
import com.demcha.compose.document.node.InlineTextRun;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.demcha.compose.document.templates.cv.v2.components;
package com.demcha.compose.document.templates.core.text;

import com.demcha.compose.document.dsl.SectionBuilder;
import com.demcha.compose.document.node.TextAlign;
import com.demcha.compose.document.style.DocumentInsets;
import com.demcha.compose.document.style.DocumentTextStyle;

/**
* Reusable rich paragraph primitive for CV presets that need explicit
* Reusable rich paragraph primitive for any preset that needs explicit
* style, line spacing, and margin while still honouring inline markdown.
*/
public final class RichParagraphRenderer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.demcha.compose.document.templates.cv.v2.components;
package com.demcha.compose.document.templates.core.text;

import java.util.Locale;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.demcha.compose.document.templates.cv.v2.components;
package com.demcha.compose.document.templates.core.text;

import com.demcha.compose.document.style.DocumentColor;
import com.demcha.compose.document.style.DocumentTextDecoration;
Expand All @@ -8,8 +8,8 @@
/**
* Small factory for preset-local text styles.
*/
public final class CvTextStyles {
private CvTextStyles() {
public final class TextStyles {
private TextStyles() {
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* <h2>Core — neutral text rendering (text)</h2>
*
* <p>Family-agnostic text primitives shared by every template family. They turn
* text plus a {@link com.demcha.compose.document.style.DocumentTextStyle} (or a
* theme-derived style) into DSL nodes, and depend on no document family's data
* model — so invoice, proposal, CV, and cover-letter all build on the same text
* layer.</p>
*
* <ul>
* <li>{@link com.demcha.compose.document.templates.core.text.MarkdownText}
* — parse inline {@code **bold**} / {@code *italic*} markdown into inline runs.</li>
* <li>{@link com.demcha.compose.document.templates.core.text.MarkdownInline}
* — append parsed inline markdown into a {@code RichText} run.</li>
* <li>{@link com.demcha.compose.document.templates.core.text.RichParagraphRenderer}
* — render a markdown paragraph into a section.</li>
* <li>{@link com.demcha.compose.document.templates.core.text.TextStyles}
* — {@code DocumentTextStyle} factory helpers.</li>
* <li>{@link com.demcha.compose.document.templates.core.text.TextOrnaments}
* — spaced-caps, pipe-joins, and other small string helpers.</li>
* </ul>
*/
package com.demcha.compose.document.templates.core.text;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.demcha.compose.document.style.DocumentTextStyle;
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.components.Header;
import com.demcha.compose.document.templates.components.MarkdownText;
import com.demcha.compose.document.templates.core.text.MarkdownText;
import com.demcha.compose.document.templates.coverletter.layouts.LetterFormat;
import com.demcha.compose.document.templates.coverletter.spec.CoverLetterHeader;
import com.demcha.compose.document.templates.coverletter.spec.CoverLetterSpec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.demcha.compose.document.style.DocumentTextDecoration;
import com.demcha.compose.document.style.DocumentTextStyle;
import com.demcha.compose.document.templates.coverletter.v2.data.CoverLetterDocument;
import com.demcha.compose.document.templates.cv.v2.components.CvTextStyles;
import com.demcha.compose.document.templates.cv.v2.components.RichParagraphRenderer;
import com.demcha.compose.document.templates.core.text.TextStyles;
import com.demcha.compose.document.templates.core.text.RichParagraphRenderer;
import com.demcha.compose.document.templates.core.theme.BrandTheme;

/**
Expand Down Expand Up @@ -58,7 +58,7 @@ public static void render(SectionBuilder host, CoverLetterDocument doc,
*/
public static void render(SectionBuilder host, CoverLetterDocument doc,
BrandTheme theme, double bodySize) {
DocumentTextStyle bodyStyle = CvTextStyles.of(
DocumentTextStyle bodyStyle = TextStyles.of(
theme.typography().bodyFont(),
bodySize,
DocumentTextDecoration.DEFAULT,
Expand All @@ -80,7 +80,7 @@ public static void render(SectionBuilder host, CoverLetterDocument doc,
// The signed name sits on the line directly below the sign-off
// (standard letter convention), so it gets only a small gap.
double signatureGap = bodySize * 0.4;
DocumentTextStyle signatureStyle = CvTextStyles.of(
DocumentTextStyle signatureStyle = TextStyles.of(
theme.typography().bodyFont(),
bodySize,
DocumentTextDecoration.ITALIC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.coverletter.v2.components.LetterBody;
import com.demcha.compose.document.templates.coverletter.v2.data.CoverLetterDocument;
import com.demcha.compose.document.templates.cv.v2.components.CvTextStyles;
import com.demcha.compose.document.templates.core.text.TextStyles;
import com.demcha.compose.document.templates.cv.v2.data.CvIdentity;
import com.demcha.compose.document.templates.core.theme.BrandTheme;
import com.demcha.compose.document.templates.cv.v2.widgets.ContactLine;
Expand Down Expand Up @@ -122,7 +122,7 @@ public void compose(DocumentSession document, CoverLetterDocument doc) {
}

private DocumentTextStyle subheadlineStyle() {
return CvTextStyles.of(theme.typography().headlineFont(), 8.6,
return TextStyles.of(theme.typography().headlineFont(), 8.6,
DocumentTextDecoration.DEFAULT, theme.palette().muted());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.coverletter.v2.components.LetterBody;
import com.demcha.compose.document.templates.coverletter.v2.data.CoverLetterDocument;
import com.demcha.compose.document.templates.cv.v2.components.CvTextStyles;
import com.demcha.compose.document.templates.core.text.TextStyles;
import com.demcha.compose.document.templates.cv.v2.data.CvIdentity;
import com.demcha.compose.document.templates.core.theme.BrandTheme;
import com.demcha.compose.document.templates.cv.v2.widgets.ContactLine;
Expand Down Expand Up @@ -128,21 +128,21 @@ private void addHeader(PageFlowBuilder flow, CvIdentity identity,
}

private DocumentTextStyle contactMetaStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.DEFAULT,
theme.palette().muted());
}

private DocumentTextStyle contactLinkStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.UNDERLINE,
ACCENT);
}

private DocumentTextStyle contactSeparatorStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.DEFAULT,
theme.palette().rule());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.coverletter.v2.components.LetterBody;
import com.demcha.compose.document.templates.coverletter.v2.data.CoverLetterDocument;
import com.demcha.compose.document.templates.cv.v2.components.CvTextStyles;
import com.demcha.compose.document.templates.core.text.TextStyles;
import com.demcha.compose.document.templates.cv.v2.data.CvIdentity;
import com.demcha.compose.document.templates.core.theme.BrandTheme;
import com.demcha.compose.document.templates.cv.v2.widgets.ContactLine;
Expand Down Expand Up @@ -150,25 +150,25 @@ private void addHeader(PageFlowBuilder flow, CvIdentity identity,
}

private DocumentTextStyle headerNameStyle() {
return CvTextStyles.of(theme.typography().headlineFont(),
return TextStyles.of(theme.typography().headlineFont(),
theme.typography().sizeHeadline(),
DocumentTextDecoration.BOLD, DocumentColor.WHITE);
}

private DocumentTextStyle headerMetaStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.DEFAULT, HEADER_SOFT);
}

private DocumentTextStyle headerLinkStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.UNDERLINE, LINK_CYAN);
}

private DocumentTextStyle headerSeparatorStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.DEFAULT, SEPARATOR_GRAY);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.coverletter.v2.components.LetterBody;
import com.demcha.compose.document.templates.coverletter.v2.data.CoverLetterDocument;
import com.demcha.compose.document.templates.cv.v2.components.CvTextStyles;
import com.demcha.compose.document.templates.core.text.TextStyles;
import com.demcha.compose.document.templates.core.theme.BrandTheme;
import com.demcha.compose.document.templates.cv.v2.widgets.Masthead;
import com.demcha.compose.font.FontName;
Expand Down Expand Up @@ -110,13 +110,13 @@ public void compose(DocumentSession document, CoverLetterDocument doc) {
}

private Masthead.Style mastheadStyle() {
DocumentTextStyle nameStyle = CvTextStyles.of(FontName.HELVETICA_BOLD,
DocumentTextStyle nameStyle = TextStyles.of(FontName.HELVETICA_BOLD,
theme.typography().sizeHeadline(),
DocumentTextDecoration.BOLD, NAME_COLOR);
DocumentTextStyle titleStyle = CvTextStyles.of(FontName.HELVETICA,
DocumentTextStyle titleStyle = TextStyles.of(FontName.HELVETICA,
10.0, DocumentTextDecoration.DEFAULT,
theme.palette().ink());
DocumentTextStyle linkStyle = CvTextStyles.of(FontName.HELVETICA,
DocumentTextStyle linkStyle = TextStyles.of(FontName.HELVETICA,
theme.typography().sizeContact(),
DocumentTextDecoration.UNDERLINE,
theme.palette().rule());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.coverletter.v2.components.LetterBody;
import com.demcha.compose.document.templates.coverletter.v2.data.CoverLetterDocument;
import com.demcha.compose.document.templates.cv.v2.components.CvTextStyles;
import com.demcha.compose.document.templates.cv.v2.components.MarkdownInline;
import com.demcha.compose.document.templates.core.text.TextStyles;
import com.demcha.compose.document.templates.core.text.MarkdownInline;
import com.demcha.compose.document.templates.cv.v2.data.CvIdentity;
import com.demcha.compose.document.templates.cv.v2.data.CvLink;
import com.demcha.compose.document.templates.core.theme.BrandTheme;
Expand Down Expand Up @@ -182,24 +182,24 @@ private void addContactStack(SectionBuilder section, CvIdentity identity) {
}

private DocumentTextStyle nameStyle() {
return CvTextStyles.of(theme.typography().headlineFont(),
return TextStyles.of(theme.typography().headlineFont(),
theme.typography().sizeHeadline(),
DocumentTextDecoration.BOLD, DocumentColor.WHITE);
}

private DocumentTextStyle subtitleStyle() {
return CvTextStyles.of(theme.typography().bodyFont(), 7.6,
return TextStyles.of(theme.typography().bodyFont(), 7.6,
DocumentTextDecoration.BOLD, SUBTITLE_COLOR);
}

private DocumentTextStyle contactMetaStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.DEFAULT, CONTACT_META);
}

private DocumentTextStyle contactLinkStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.UNDERLINE, CONTACT_LINK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.coverletter.v2.components.LetterBody;
import com.demcha.compose.document.templates.coverletter.v2.data.CoverLetterDocument;
import com.demcha.compose.document.templates.cv.v2.components.CvTextStyles;
import com.demcha.compose.document.templates.cv.v2.components.TextOrnaments;
import com.demcha.compose.document.templates.core.text.TextStyles;
import com.demcha.compose.document.templates.core.text.TextOrnaments;
import com.demcha.compose.document.templates.cv.v2.data.CvIdentity;
import com.demcha.compose.document.templates.cv.v2.data.CvLink;
import com.demcha.compose.document.templates.core.theme.BrandTheme;
Expand Down Expand Up @@ -195,28 +195,28 @@ private void addLinkRow(SectionBuilder section, CvIdentity identity) {
}

private DocumentTextStyle nameStyle() {
return CvTextStyles.of(FontName.POPPINS,
return TextStyles.of(FontName.POPPINS,
theme.typography().sizeHeadline(),
DocumentTextDecoration.BOLD,
PRIMARY_NAME);
}

private DocumentTextStyle metaStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.DEFAULT,
theme.palette().ink());
}

private DocumentTextStyle linkRowBodyStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeBody(),
DocumentTextDecoration.DEFAULT,
theme.palette().ink());
}

private DocumentTextStyle linkRowLinkStyle() {
return CvTextStyles.of(theme.typography().bodyFont(),
return TextStyles.of(theme.typography().bodyFont(),
theme.typography().sizeBody(),
DocumentTextDecoration.UNDERLINE,
ACCENT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import com.demcha.compose.document.templates.api.DocumentTemplate;
import com.demcha.compose.document.templates.coverletter.v2.components.LetterBody;
import com.demcha.compose.document.templates.coverletter.v2.data.CoverLetterDocument;
import com.demcha.compose.document.templates.cv.v2.components.CvTextStyles;
import com.demcha.compose.document.templates.cv.v2.components.TextOrnaments;
import com.demcha.compose.document.templates.core.text.TextStyles;
import com.demcha.compose.document.templates.core.text.TextOrnaments;
import com.demcha.compose.document.templates.cv.v2.data.CvIdentity;
import com.demcha.compose.document.templates.core.theme.BrandTheme;
import com.demcha.compose.document.templates.cv.v2.widgets.Headline;
Expand Down Expand Up @@ -388,13 +388,13 @@ private void addBandedMasthead(SectionBuilder section,
}

private DocumentTextStyle mastheadNameStyle() {
return CvTextStyles.of(theme.typography().headlineFont(),
return TextStyles.of(theme.typography().headlineFont(),
theme.typography().sizeHeadline(),
DocumentTextDecoration.DEFAULT, nameColor);
}

private DocumentTextStyle taglineStyle() {
return CvTextStyles.of(theme.typography().headlineFont(),
return TextStyles.of(theme.typography().headlineFont(),
theme.typography().sizeContact(),
DocumentTextDecoration.BOLD, accent);
}
Expand Down
Loading
Loading