From bf7a36a47d38a670d038bda6104ebc5d220983a0 Mon Sep 17 00:00:00 2001 From: Kevin Fodness <2650828+kevinfodness@users.noreply.github.com> Date: Thu, 25 Apr 2024 11:15:52 -0400 Subject: [PATCH 1/6] WIP: APPLE-173 From c390ebf94e175ba8cb8cf700f9b0f90e98d8c3fc Mon Sep 17 00:00:00 2001 From: Kevin Fodness <2650828+kevinfodness@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:00:02 -0400 Subject: [PATCH 2/6] APPLE-173 Make tag styles editable in Customize JSON --- .../builders/class-text-styles.php | 76 ++++--------------- .../apple-exporter/components/class-body.php | 63 +++++++++++++++ 2 files changed, 77 insertions(+), 62 deletions(-) diff --git a/includes/apple-exporter/builders/class-text-styles.php b/includes/apple-exporter/builders/class-text-styles.php index 4668563a..2797288b 100644 --- a/includes/apple-exporter/builders/class-text-styles.php +++ b/includes/apple-exporter/builders/class-text-styles.php @@ -11,8 +11,11 @@ namespace Apple_Exporter\Builders; +use Apple_Exporter\Component_Spec; +use Apple_Exporter\Components\Body; use Apple_Exporter\Exporter_Content; use Apple_Exporter\Exporter_Content_Settings; +use Apple_Exporter\Theme; /** * A class which is used to set top-level text styles. @@ -89,69 +92,18 @@ public function register_style( $name, $values ) { * @access private */ private function add_html_styles() { - - // Get information about the currently loaded theme. - $theme = \Apple_Exporter\Theme::get_used(); - - $conditional = []; - if ( ! empty( $theme->get_value( 'monospaced_color_dark' ) ) ) { - $conditional = [ - 'conditional' => [ - 'textColor' => $theme->get_value( 'monospaced_color_dark' ), - 'conditions' => [ - 'minSpecVersion' => '1.14', - 'preferredColorScheme' => 'dark', - ], - ], - ]; + // Try to get the text styles spec from the body component. + $body = new Body(); + $specs = $body->get_specs(); + $text_styles = $specs['default-text-styles']; + if ( empty( $text_styles ) || ! $text_styles instanceof Component_Spec ) { + return; } - // Add style for tags. - $this->register_style( - 'default-tag-code', - array_merge( - [ - 'fontName' => $theme->get_value( 'monospaced_font' ), - 'fontSize' => intval( $theme->get_value( 'monospaced_size' ) ), - 'tracking' => intval( $theme->get_value( 'monospaced_tracking' ) ) / 100, - 'lineHeight' => intval( $theme->get_value( 'monospaced_line_height' ) ), - 'textColor' => $theme->get_value( 'monospaced_color' ), - ], - $conditional - ) - ); - - // Add style for
 tags.
-		$this->register_style(
-			'default-tag-pre',
-			array_merge(
-				[
-					'textAlignment'          => 'left',
-					'fontName'               => $theme->get_value( 'monospaced_font' ),
-					'fontSize'               => intval( $theme->get_value( 'monospaced_size' ) ),
-					'tracking'               => intval( $theme->get_value( 'monospaced_tracking' ) ) / 100,
-					'lineHeight'             => intval( $theme->get_value( 'monospaced_line_height' ) ),
-					'textColor'              => $theme->get_value( 'monospaced_color' ),
-					'paragraphSpacingBefore' => 18,
-					'paragraphSpacingAfter'  => 18,
-				],
-				$conditional
-			)
-		);
-
-		// Add style for  tags.
-		$this->register_style(
-			'default-tag-samp',
-			array_merge(
-				[
-					'fontName'   => $theme->get_value( 'monospaced_font' ),
-					'fontSize'   => intval( $theme->get_value( 'monospaced_size' ) ),
-					'tracking'   => intval( $theme->get_value( 'monospaced_tracking' ) ) / 100,
-					'lineHeight' => intval( $theme->get_value( 'monospaced_line_height' ) ),
-					'textColor'  => $theme->get_value( 'monospaced_color' ),
-				],
-				$conditional
-			)
-		);
+		// Get the computed specs for the text styles including any overrides from the theme via Customize JSON and apply them.
+		$computed_styles = $text_styles->substitute_values( [] );
+		foreach ( $computed_styles as $name => $values ) {
+			$this->register_style( $name, $values );
+		}
 	}
 }
diff --git a/includes/apple-exporter/components/class-body.php b/includes/apple-exporter/components/class-body.php
index ba1cd211..a654eacb 100644
--- a/includes/apple-exporter/components/class-body.php
+++ b/includes/apple-exporter/components/class-body.php
@@ -196,6 +196,12 @@ public function register_specs(): void {
 				$conditional
 			)
 		);
+
+		$this->register_spec(
+			'default-text-styles',
+			__( 'Default Text Styles', 'apple-news' ),
+			$this->get_default_text_styles()
+		);
 	}
 
 	/**
@@ -433,6 +439,63 @@ private function get_default_style_values() {
 		];
 	}
 
+	/**
+	 * Compile default text styles applied to the document as a whole based on HTML tags.
+	 *
+	 * @return array
+	 */
+	private function get_default_text_styles() {
+		$theme       = Theme::get_used();
+		$conditional = [];
+		if ( ! empty( $theme->get_value( 'monospaced_color_dark' ) ) ) {
+			$conditional = [
+				'conditional' => [
+					'textColor'  => '#monospaced_color_dark#',
+					'conditions' => [
+						'minSpecVersion'       => '1.14',
+						'preferredColorScheme' => 'dark',
+					],
+				],
+			];
+		}
+
+		return [
+			'default-tag-code' => array_merge(
+				[
+					'fontName'   => '#monospaced_font#',
+					'fontSize'   => '#monospaced_size#',
+					'tracking'   => '#monospaced_tracking#',
+					'lineHeight' => '#monospaced_line_height#',
+					'textColor'  => '#monospaced_color',
+				],
+				$conditional
+			),
+			'default-tag-pre'  => array_merge(
+				[
+					'textAlignment'          => 'left',
+					'fontName'               => '#monospaced_font#',
+					'fontSize'               => '#monospaced_size#',
+					'tracking'               => '#monospaced_tracking#',
+					'lineHeight'             => '#monospaced_line_height#',
+					'textColor'              => '#monospaced_color#',
+					'paragraphSpacingBefore' => 18,
+					'paragraphSpacingAfter'  => 18,
+				],
+				$conditional
+			),
+			'default-tag-samp' => array_merge(
+				[
+					'fontName'   => '#monospaced_font#',
+					'fontSize'   => '#monospaced_size#',
+					'tracking'   => '#monospaced_tracking#',
+					'lineHeight' => '#monospaced_line_height#',
+					'textColor'  => '#monospaced_color#',
+				],
+				$conditional
+			),
+		];
+	}
+
 	/**
 	 * Set the default style for the component.
 	 *

From 6192f15f8811beb55a3afe55c322cc425d8e047e Mon Sep 17 00:00:00 2001
From: Kevin Fodness <2650828+kevinfodness@users.noreply.github.com>
Date: Mon, 29 Apr 2024 16:36:42 -0400
Subject: [PATCH 3/6] APPLE-173 Add cite tag styles

---
 includes/apple-exporter/class-theme.php       | 43 +++++++++++++++++++
 .../apple-exporter/components/class-body.php  | 33 +++++++++++---
 2 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/includes/apple-exporter/class-theme.php b/includes/apple-exporter/class-theme.php
index 0056a784..cd9fe455 100644
--- a/includes/apple-exporter/class-theme.php
+++ b/includes/apple-exporter/class-theme.php
@@ -1164,6 +1164,37 @@ private static function initialize_options() {
 				'callback'    => [ get_called_class(), 'render_meta_component_order' ],
 				'type'        => 'array',
 			],
+			'cite_color'                         => [
+				'default' => '#4f4f4f',
+				'label'   => __( 'Citation font color', 'apple-news' ),
+				'type'    => 'color',
+			],
+			'cite_color_dark'                    => [
+				'default' => '',
+				'label'   => __( 'Citation font color', 'apple-news' ),
+				'type'    => 'color',
+			],
+			'cite_font'                          => [
+				'default' => 'AvenirNext-Italic',
+				'label'   => __( 'Citation font face', 'apple-news' ),
+				'type'    => 'font',
+			],
+			'cite_line_height'                   => [
+				'default' => 24.0,
+				'label'   => __( 'Citation line height', 'apple-news' ),
+				'type'    => 'float',
+			],
+			'cite_size'                          => [
+				'default' => 16,
+				'label'   => __( 'Citation font size', 'apple-news' ),
+				'type'    => 'integer',
+			],
+			'cite_tracking'                      => [
+				'default'     => 0,
+				'description' => __( '(Percentage of font size)', 'apple-news' ),
+				'label'       => __( 'Citation tracking', 'apple-news' ),
+				'type'        => 'integer',
+			],
 			'monospaced_color'                   => [
 				'default' => '#4f4f4f',
 				'label'   => __( 'Monospaced font color', 'apple-news' ),
@@ -2435,6 +2466,18 @@ private function initialize_groups() {
 					'table_header_color_dark',
 				],
 			],
+			'cite'            => [
+				'label'    => __( 'Citation ()', 'apple-news' ),
+				'settings' => [
+					'cite_font',
+					'cite_size',
+					'cite_line_height',
+					'cite_tracking',
+					'cite_color',
+					'dark_mode_colors_heading',
+					'cite_color_dark',
+				],
+			],
 			'monospaced'      => [
 				'label'    => __( 'Monospaced (
, , )', 'apple-news' ),
 				'settings' => [
diff --git a/includes/apple-exporter/components/class-body.php b/includes/apple-exporter/components/class-body.php
index a654eacb..41e487f4 100644
--- a/includes/apple-exporter/components/class-body.php
+++ b/includes/apple-exporter/components/class-body.php
@@ -445,10 +445,21 @@ private function get_default_style_values() {
 	 * @return array
 	 */
 	private function get_default_text_styles() {
-		$theme       = Theme::get_used();
-		$conditional = [];
+		$theme        = Theme::get_used();
+		$conditionals = [];
+		if ( ! empty( $theme->get_value( 'cite_color_dark' ) ) ) {
+			$conditionals['cite'] = [
+				'conditional' => [
+					'textColor'  => '#cite_color_dark#',
+					'conditions' => [
+						'minSpecVersion'       => '1.14',
+						'preferredColorScheme' => 'dark',
+					],
+				],
+			];
+		}
 		if ( ! empty( $theme->get_value( 'monospaced_color_dark' ) ) ) {
-			$conditional = [
+			$conditionals['monospaced'] = [
 				'conditional' => [
 					'textColor'  => '#monospaced_color_dark#',
 					'conditions' => [
@@ -460,6 +471,16 @@ private function get_default_text_styles() {
 		}
 
 		return [
+			'default-tag-cite' => array_merge(
+				[
+					'fontName'   => '#cite_font#',
+					'fontSize'   => '#cite_size#',
+					'tracking'   => '#cite_tracking#',
+					'lineHeight' => '#cite_line_height#',
+					'textColor'  => '#cite_color',
+				],
+				$conditionals['cite']
+			),
 			'default-tag-code' => array_merge(
 				[
 					'fontName'   => '#monospaced_font#',
@@ -468,7 +489,7 @@ private function get_default_text_styles() {
 					'lineHeight' => '#monospaced_line_height#',
 					'textColor'  => '#monospaced_color',
 				],
-				$conditional
+				$conditionals['monospaced']
 			),
 			'default-tag-pre'  => array_merge(
 				[
@@ -481,7 +502,7 @@ private function get_default_text_styles() {
 					'paragraphSpacingBefore' => 18,
 					'paragraphSpacingAfter'  => 18,
 				],
-				$conditional
+				$conditionals['monospaced']
 			),
 			'default-tag-samp' => array_merge(
 				[
@@ -491,7 +512,7 @@ private function get_default_text_styles() {
 					'lineHeight' => '#monospaced_line_height#',
 					'textColor'  => '#monospaced_color#',
 				],
-				$conditional
+				$conditionals['monospaced']
 			),
 		];
 	}

From f70fb1f39d788af25917a59da67f9c8a33df0842 Mon Sep 17 00:00:00 2001
From: Kevin Fodness <2650828+kevinfodness@users.noreply.github.com>
Date: Tue, 30 Apr 2024 17:08:38 -0400
Subject: [PATCH 4/6] APPLE-173 Add upgrade routine for cite default styles in
 themes

---
 .../apple-exporter/components/class-body.php  |  8 ++---
 .../components/class-footnotes.php            |  2 +-
 includes/class-apple-news.php                 | 20 ++++++-----
 tests/test-class-apple-news.php               | 34 ++++++++++++++-----
 4 files changed, 43 insertions(+), 21 deletions(-)

diff --git a/includes/apple-exporter/components/class-body.php b/includes/apple-exporter/components/class-body.php
index 41e487f4..e2893621 100644
--- a/includes/apple-exporter/components/class-body.php
+++ b/includes/apple-exporter/components/class-body.php
@@ -479,7 +479,7 @@ private function get_default_text_styles() {
 					'lineHeight' => '#cite_line_height#',
 					'textColor'  => '#cite_color',
 				],
-				$conditionals['cite']
+				$conditionals['cite'] ?? []
 			),
 			'default-tag-code' => array_merge(
 				[
@@ -489,7 +489,7 @@ private function get_default_text_styles() {
 					'lineHeight' => '#monospaced_line_height#',
 					'textColor'  => '#monospaced_color',
 				],
-				$conditionals['monospaced']
+				$conditionals['monospaced'] ?? []
 			),
 			'default-tag-pre'  => array_merge(
 				[
@@ -502,7 +502,7 @@ private function get_default_text_styles() {
 					'paragraphSpacingBefore' => 18,
 					'paragraphSpacingAfter'  => 18,
 				],
-				$conditionals['monospaced']
+				$conditionals['monospaced'] ?? []
 			),
 			'default-tag-samp' => array_merge(
 				[
@@ -512,7 +512,7 @@ private function get_default_text_styles() {
 					'lineHeight' => '#monospaced_line_height#',
 					'textColor'  => '#monospaced_color#',
 				],
-				$conditionals['monospaced']
+				$conditionals['monospaced'] ?? []
 			),
 		];
 	}
diff --git a/includes/apple-exporter/components/class-footnotes.php b/includes/apple-exporter/components/class-footnotes.php
index 8753b6b4..e3ebed90 100644
--- a/includes/apple-exporter/components/class-footnotes.php
+++ b/includes/apple-exporter/components/class-footnotes.php
@@ -77,7 +77,7 @@ protected function build( $html ) { // phpcs:ignore VariableAnalysis.CodeAnalysi
 			$count = $key + 1;
 			$text  = preg_replace(
 				'/(.*?)<\/li>/',
-				"${count}. $2

", + "{$count}. $2

", $item ); preg_match( '/id="(.*?)"/', $text, $matches ); diff --git a/includes/class-apple-news.php b/includes/class-apple-news.php index 426b67dc..b09c5bd7 100644 --- a/includes/class-apple-news.php +++ b/includes/class-apple-news.php @@ -1110,11 +1110,10 @@ public function upgrade_to_2_4_0(): void { public function upgrade_to_2_5_0(): void { $registry = Theme::get_registry(); foreach ( $registry as $theme_name ) { - $theme_object = Admin_Apple_Themes::get_theme_by_name( $theme_name ); - $save_theme = false; + $theme_object = Admin_Apple_Themes::get_theme_by_name( $theme_name ); + $json_templates = $theme_object->get_value( 'json_templates' ); // Migrate heading layouts from being centrally defined to being defined per heading level. - $json_templates = $theme_object->get_value( 'json_templates' ); if ( ! empty( $json_templates['heading']['heading-layout'] ) ) { $heading_layout = $json_templates['heading']['heading-layout']; unset( $json_templates['heading']['heading-layout'] ); @@ -1122,13 +1121,18 @@ public function upgrade_to_2_5_0(): void { $json_templates['heading'][ 'heading-layout-' . $heading_level ] = $heading_layout; } $theme_object->set_value( 'json_templates', $json_templates ); - $save_theme = true; } - // Save the theme if there were changes. - if ( $save_theme ) { - $theme_object->save(); - } + // Set defaults for new styles based on caption settings. + $theme_object->set_value( 'cite_color', $theme_object->get_value( 'caption_color' ) ); + $theme_object->set_value( 'cite_color_dark', $theme_object->get_value( 'caption_color_dark' ) ); + $theme_object->set_value( 'cite_font', $theme_object->get_value( 'caption_font' ) ); + $theme_object->set_value( 'cite_line_height', $theme_object->get_value( 'caption_line_height' ) ); + $theme_object->set_value( 'cite_size', $theme_object->get_value( 'caption_size' ) ); + $theme_object->set_value( 'cite_tracking', $theme_object->get_value( 'caption_tracking' ) ); + + // Save our changes. + $theme_object->save(); } } diff --git a/tests/test-class-apple-news.php b/tests/test-class-apple-news.php index eb833130..4cec7199 100644 --- a/tests/test-class-apple-news.php +++ b/tests/test-class-apple-news.php @@ -286,7 +286,7 @@ public function test_support_info() { */ public function test_upgrade_to_2_5_0(): void { /* - * Set legacy theme settings for heading layout. + * Set legacy theme settings. * * We have to do this in the database directly because it will fail validation with the updated theme code. */ @@ -305,6 +305,18 @@ public function test_upgrade_to_2_5_0(): void { 'heading-layout' => $custom_heading_layout, ], ]; + unset( $theme_data['cite_color'] ); + unset( $theme_data['cite_color_dark'] ); + unset( $theme_data['cite_font'] ); + unset( $theme_data['cite_line_height'] ); + unset( $theme_data['cite_size'] ); + unset( $theme_data['cite_tracking'] ); + $theme_data['caption_color'] = '#abc123'; + $theme_data['caption_color_dark'] = '#def456'; + $theme_data['caption_font'] = 'AvenirNext-Bold'; + $theme_data['caption_line_height'] = 123; + $theme_data['caption_size'] = 234; + $theme_data['caption_tracking'] = 345; update_option( Theme::theme_key( 'Default' ), $theme_data ); // Run the upgrade. @@ -313,13 +325,19 @@ public function test_upgrade_to_2_5_0(): void { $theme = Theme::get_used(); $theme->load(); $json = $theme->get_value( 'json_templates' ); - $this->assertTrue( empty( $json['heading']['heading-layout'] ) ); - $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-1'] ); - $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-2'] ); - $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-3'] ); - $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-4'] ); - $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-5'] ); - $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-6'] ); + $this->assertTrue( empty( $json['heading']['heading-layout'] ), 'Expected the generic heading layout to be removed by the upgrade.' ); + $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-1'], 'Expected the custom heading layout to be migrated to heading level 1 during the upgrade.' ); + $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-2'], 'Expected the custom heading layout to be migrated to heading level 2 during the upgrade.' ); + $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-3'], 'Expected the custom heading layout to be migrated to heading level 3 during the upgrade.' ); + $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-4'], 'Expected the custom heading layout to be migrated to heading level 4 during the upgrade.' ); + $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-5'], 'Expected the custom heading layout to be migrated to heading level 5 during the upgrade.' ); + $this->assertEquals( $custom_heading_layout, $json['heading']['heading-layout-6'], 'Expected the custom heading layout to be migrated to heading level 6 during the upgrade.' ); + $this->assertEquals( '#abc123', $theme->get_value( 'cite_color' ), 'Expected the custom caption color to be applied to the cite color as part of the upgrade.' ); + $this->assertEquals( '#def456', $theme->get_value( 'cite_color_dark' ), 'Expected the custom caption dark color to be applied to the cite dark color as part of the upgrade.' ); + $this->assertEquals( 'AvenirNext-Bold', $theme->get_value( 'cite_font' ), 'Expected the custom caption font to be applied to the cite font as part of the upgrade.' ); + $this->assertEquals( 123, $theme->get_value( 'cite_line_height' ), 'Expected the custom caption line height to be applied to the cite line height as part of the upgrade.' ); + $this->assertEquals( 234, $theme->get_value( 'cite_size' ), 'Expected the custom caption size to be applied to the cite size as part of the upgrade.' ); + $this->assertEquals( 345, $theme->get_value( 'cite_tracking' ), 'Expected the custom caption tracking to be applied to the cite tracking as part of the upgrade.' ); } /** From 54e8917babbb97d7571ce0726868fea7ffa61481 Mon Sep 17 00:00:00 2001 From: Kevin Fodness <2650828+kevinfodness@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:23:01 -0400 Subject: [PATCH 5/6] APPLE-173 Add cite styles to theme JSON definitions --- assets/themes/classic.json | 5 +++++ assets/themes/colorful.json | 5 +++++ assets/themes/dark.json | 5 +++++ assets/themes/default.json | 5 +++++ assets/themes/modern.json | 5 +++++ assets/themes/pastel.json | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/assets/themes/classic.json b/assets/themes/classic.json index 7396bbbd..a949dd86 100644 --- a/assets/themes/classic.json +++ b/assets/themes/classic.json @@ -40,6 +40,11 @@ "caption_line_height": 19, "caption_size": 14, "caption_tracking": -1, + "cite_color": "#333333", + "cite_font": "Helvetica-Bold", + "cite_line_height": 19, + "cite_size": 14, + "cite_tracking": -1, "dropcap_background_color": "", "dropcap_color": "#000000", "dropcap_font": "Baskerville", diff --git a/assets/themes/colorful.json b/assets/themes/colorful.json index 64d0c8a6..9f0412a3 100644 --- a/assets/themes/colorful.json +++ b/assets/themes/colorful.json @@ -40,6 +40,11 @@ "caption_line_height": 22, "caption_size": 14, "caption_tracking": -3, + "cite_color": "#3045ca", + "cite_font": "Georgia", + "cite_line_height": 22, + "cite_size": 14, + "cite_tracking": -3, "date_color": "#000000", "date_font": "Optima-Regular", "date_format": "#F j, Y#", diff --git a/assets/themes/dark.json b/assets/themes/dark.json index ba767f19..92d1f709 100644 --- a/assets/themes/dark.json +++ b/assets/themes/dark.json @@ -40,6 +40,11 @@ "caption_line_height": 19, "caption_size": 14, "caption_tracking": -1, + "cite_color": "#999999", + "cite_font": "Helvetica-Light", + "cite_line_height": 19, + "cite_size": 14, + "cite_tracking": -1, "date_color": "#e2e2e2", "date_font": "Helvetica-Bold", "date_format": "#F j \\a\\t g:i A#", diff --git a/assets/themes/default.json b/assets/themes/default.json index 2614d155..b75513c3 100644 --- a/assets/themes/default.json +++ b/assets/themes/default.json @@ -40,6 +40,11 @@ "caption_line_height": 24, "caption_size": 16, "caption_tracking": 0, + "cite_color": "#4f4f4f", + "cite_font": "AvenirNext-Italic", + "cite_line_height": 24, + "cite_size": 16, + "cite_tracking": 0, "date_color": "#7c7c7c", "date_font": "AvenirNext-Medium", "date_format": "#M j, Y | g:i A#", diff --git a/assets/themes/modern.json b/assets/themes/modern.json index 55cf68ae..b0552b55 100644 --- a/assets/themes/modern.json +++ b/assets/themes/modern.json @@ -40,6 +40,11 @@ "caption_line_height": 17, "caption_size": 14, "caption_tracking": 0, + "cite_color": "#000000", + "cite_font": "AvenirNext-DemiBold", + "cite_line_height": 17, + "cite_size": 14, + "cite_tracking": 0, "date_color": "#000000", "date_font": "AvenirNext-Regular", "date_format": "#F j, Y, g:ia#", diff --git a/assets/themes/pastel.json b/assets/themes/pastel.json index 2fe5a333..ad122e23 100644 --- a/assets/themes/pastel.json +++ b/assets/themes/pastel.json @@ -40,6 +40,11 @@ "caption_line_height": 19, "caption_size": 14, "caption_tracking": -1, + "cite_color": "#333333", + "cite_font": "AvenirNext-Regular", + "cite_line_height": 19, + "cite_size": 14, + "cite_tracking": -1, "date_color": "#000000", "date_font": "AvenirNext-Bold", "date_format": "#F j \\a\\t g:i A#", From 13298a386380b995675d1cbad215b12cfc3d4342 Mon Sep 17 00:00:00 2001 From: Kevin Fodness <2650828+kevinfodness@users.noreply.github.com> Date: Wed, 1 May 2024 10:14:42 -0400 Subject: [PATCH 6/6] APPLE-173 Better check for successful extraction of default text styles spec from Body component --- includes/apple-exporter/builders/class-text-styles.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/apple-exporter/builders/class-text-styles.php b/includes/apple-exporter/builders/class-text-styles.php index 2797288b..cfee65b9 100644 --- a/includes/apple-exporter/builders/class-text-styles.php +++ b/includes/apple-exporter/builders/class-text-styles.php @@ -93,15 +93,14 @@ public function register_style( $name, $values ) { */ private function add_html_styles() { // Try to get the text styles spec from the body component. - $body = new Body(); - $specs = $body->get_specs(); - $text_styles = $specs['default-text-styles']; - if ( empty( $text_styles ) || ! $text_styles instanceof Component_Spec ) { + $body = new Body(); + $specs = $body->get_specs(); + if ( empty( $specs['default-text-styles'] ) || ! $specs['default-text-styles'] instanceof Component_Spec ) { return; } // Get the computed specs for the text styles including any overrides from the theme via Customize JSON and apply them. - $computed_styles = $text_styles->substitute_values( [] ); + $computed_styles = $specs['default-text-styles']->substitute_values( [] ); foreach ( $computed_styles as $name => $values ) { $this->register_style( $name, $values ); }