Skip to content

Commit

Permalink
Add support for Recipe component
Browse files Browse the repository at this point in the history
  • Loading branch information
dlh01 committed Feb 11, 2025
1 parent ef8c813 commit 0fa6028
Show file tree
Hide file tree
Showing 14 changed files with 2,616 additions and 195 deletions.
33 changes: 25 additions & 8 deletions admin/settings/class-admin-apple-settings-section-advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ public function __construct( $page ) {

// Add the settings.
$this->settings = [
'component_alerts' => [
'component_alerts' => [
'label' => __( 'Component Alerts', 'apple-news' ),
'type' => [ 'none', 'warn', 'fail' ],
'description' => __( 'If a post has a component that is unsupported by Apple News, choose "none" to generate no alert, "warn" to provide an admin warning notice, or "fail" to generate a notice and stop publishing.', 'apple-news' ),
],
'use_remote_images' => [
'use_remote_images' => [
'label' => __( 'Use Remote Images?', 'apple-news' ),
'type' => [ 'yes', 'no' ],
'description' => __( 'Allow the Apple News API to retrieve images remotely rather than bundle them. This setting is recommended if you are having any issues with publishing images. If your images are not publicly accessible, such as on a development site, you cannot use this feature.', 'apple-news' ),
],
'full_bleed_images' => [
'full_bleed_images' => [
'label' => __( 'Use Full-Bleed Images?', 'apple-news' ),
'type' => [ 'yes', 'no' ],
'description' => __( 'If set to yes, images that are centered or have no alignment will span edge-to-edge rather than being constrained within the body margins.', 'apple-news' ),
],
'deduplicate_cover_media' => [
'deduplicate_cover_media' => [
'label' => __( 'Deduplicate Cover Media?', 'apple-news' ),
'type' => [ 'yes', 'no' ],
'description' => __( 'If set to yes, any image, video, or other content selected as an article\'s Cover Media will not appear again in the article body in Apple News.', 'apple-news' ),
],
'html_support' => [
'html_support' => [
'label' => __( 'Enable HTML support?', 'apple-news' ),
'type' => [ 'yes', 'no' ],
'description' => sprintf(
Expand All @@ -62,21 +62,34 @@ public function __construct( $page ) {
'</a>'
),
],
'in_article_position' => [
'in_article_position' => [
'label' => __( 'Position of In Article Module', 'apple-news' ),
'type' => 'number',
'min' => 3,
'max' => 99,
'step' => 1,
'description' => __( 'If you have configured an In Article module via Customize JSON, the position that the module should be inserted into. Defaults to 3, which is after the third content block in the article body (e.g., the third paragraph).', 'apple-news' ),
],
'aside_component_class' => [
'aside_component_class' => [
'label' => __( 'Aside Content CSS Class', 'apple-news' ),
'type' => 'text',
'size' => 100,
'description' => __( 'Enter a CSS class name that will be used to generate the Aside component. Do not prefix with a period.', 'apple-news' ),
'required' => false,
],
'excluded_selectors' => [
'recipe_component_class' => [
'label' => __( 'Recipe Content CSS Class', 'apple-news' ),
'type' => 'text',
'size' => 100,
'description' => __( 'Enter a CSS class name that will be used to generate the Recipe component. Do not prefix with a period.', 'apple-news' ),
'required' => false,
],
'recipe_component_use_schema' => [
'label' => __( 'Build Recipe Component From Structured Data', 'apple-news' ),
'type' => [ 'yes', 'no' ],
'description' => __( 'Set to yes if you want the recipe JSON-LD to replace the HTML markup inside the specified CSS class. Set to no if you want to render the HTML markup inside the specified CSS class as-is.', 'apple-news' ),
],
'excluded_selectors' => [
'label' => __( 'Selectors', 'apple-news' ),
'type' => 'text',
'size' => 100,
Expand Down Expand Up @@ -111,6 +124,10 @@ public function __construct( $page ) {
'label' => __( 'Aside Component', 'apple-news' ),
'settings' => [ 'aside_component_class' ],
],
'recipe' => [
'label' => __( 'Recipe Component', 'apple-news' ),
'settings' => [ 'recipe_component_class', 'recipe_component_use_schema' ],
],
'selectors' => [
'label' => __( 'Excluded Elements', 'apple-news' ),
'settings' => [ 'excluded_selectors' ],
Expand Down
42 changes: 42 additions & 0 deletions assets/themes/classic.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,48 @@
"pullquote_size": 27,
"pullquote_tracking": -2,
"pullquote_transform": "none",
"recipe_background_color": "#d3d3d3",
"recipe_body_background_color": "#d3d3d3",
"recipe_body_color": "#000000",
"recipe_body_font": "Georgia",
"recipe_body_line_height": 23,
"recipe_body_link_color": "#5c5c5c",
"recipe_body_size": 17,
"recipe_body_tracking": 0,
"recipe_caption_background_color": "#d3d3d3",
"recipe_caption_color": "#000000",
"recipe_caption_font": "Georgia",
"recipe_caption_line_height": 23,
"recipe_caption_link_color": "#5c5c5c",
"recipe_caption_size": 17,
"recipe_caption_tracking": 0,
"recipe_details_background_color": "#d3d3d3",
"recipe_details_color": "#000000",
"recipe_details_font": "Georgia",
"recipe_details_line_height": 23,
"recipe_details_link_color": "#5c5c5c",
"recipe_details_size": 17,
"recipe_details_tracking": 0,
"recipe_header2_color": "#000000",
"recipe_header2_font": "Helvetica",
"recipe_header2_line_height": 32,
"recipe_header2_size": 23,
"recipe_header2_tracking": -2,
"recipe_header3_color": "#000000",
"recipe_header3_font": "Helvetica",
"recipe_header3_line_height": 29,
"recipe_header3_size": 21,
"recipe_header3_tracking": -2,
"recipe_header4_color": "#000000",
"recipe_header4_font": "Helvetica",
"recipe_header4_line_height": 27,
"recipe_header4_size": 19,
"recipe_header4_tracking": -2,
"recipe_title_color": "#000000",
"recipe_title_font": "Helvetica",
"recipe_title_line_height": 35,
"recipe_title_size": 25,
"recipe_title_tracking": -2,
"slug_color": "#000000",
"slug_font": "Helvetica-Bold",
"slug_line_height": 24,
Expand Down
42 changes: 42 additions & 0 deletions assets/themes/colorful.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,48 @@
"pullquote_size": 36,
"pullquote_tracking": -5,
"pullquote_transform": "none",
"recipe_background_color": "#ffff00",
"recipe_body_background_color": "#ffff00",
"recipe_body_color": "#3045ca",
"recipe_body_font": "Optima-Regular",
"recipe_body_line_height": 22,
"recipe_body_link_color": "#3045ca",
"recipe_body_size": 17,
"recipe_body_tracking": 0,
"recipe_caption_background_color": "#ffff00",
"recipe_caption_color": "#3045ca",
"recipe_caption_font": "Optima-Regular",
"recipe_caption_line_height": 22,
"recipe_caption_link_color": "#3045ca",
"recipe_caption_size": 17,
"recipe_caption_tracking": 0,
"recipe_details_background_color": "#ffff00",
"recipe_details_color": "#3045ca",
"recipe_details_font": "Optima-Regular",
"recipe_details_line_height": 22,
"recipe_details_link_color": "#3045ca",
"recipe_details_size": 17,
"recipe_details_tracking": 0,
"recipe_header2_color": "#3045ca",
"recipe_header2_font": "Georgia",
"recipe_header2_line_height": 28,
"recipe_header2_size": 28,
"recipe_header2_tracking": -3,
"recipe_header3_color": "#3045ca",
"recipe_header3_font": "Georgia",
"recipe_header3_line_height": 26,
"recipe_header3_size": 26,
"recipe_header3_tracking": -3,
"recipe_header4_color": "#3045ca",
"recipe_header4_font": "Georgia",
"recipe_header4_line_height": 24,
"recipe_header4_size": 24,
"recipe_header4_tracking": -3,
"recipe_title_color": "#3045ca",
"recipe_title_font": "Georgia",
"recipe_title_line_height": 36,
"recipe_title_size": 36,
"recipe_title_tracking": -3,
"slug_color": "#000000",
"slug_font": "Optima-Regular",
"slug_line_height": 26,
Expand Down
42 changes: 42 additions & 0 deletions assets/themes/dark.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,48 @@
"pullquote_size": 29,
"pullquote_tracking": -2,
"pullquote_transform": "none",
"recipe_background_color": "",
"recipe_body_background_color": "",
"recipe_body_color": "#e2e2e2",
"recipe_body_font": "Georgia",
"recipe_body_line_height": 23,
"recipe_body_link_color": "#ffe890",
"recipe_body_size": 17,
"recipe_body_tracking": 0,
"recipe_caption_background_color": "",
"recipe_caption_color": "#e2e2e2",
"recipe_caption_font": "Georgia",
"recipe_caption_line_height": 23,
"recipe_caption_link_color": "#ffe890",
"recipe_caption_size": 17,
"recipe_caption_tracking": 0,
"recipe_details_background_color": "",
"recipe_details_color": "#e2e2e2",
"recipe_details_font": "Georgia",
"recipe_details_line_height": 23,
"recipe_details_link_color": "#ffe890",
"recipe_details_size": 17,
"recipe_details_tracking": 0,
"recipe_header2_color": "#ffffff",
"recipe_header2_font": "HelveticaNeue-Thin",
"recipe_header2_line_height": 31,
"recipe_header2_size": 27,
"recipe_header2_tracking": 0,
"recipe_header3_color": "#ffffff",
"recipe_header3_font": "HelveticaNeue-Thin",
"recipe_header3_line_height": 28,
"recipe_header3_size": 25,
"recipe_header3_tracking": 0,
"recipe_header4_color": "#ffffff",
"recipe_header4_font": "HelveticaNeue-Thin",
"recipe_header4_line_height": 26,
"recipe_header4_size": 23,
"recipe_header4_tracking": 0,
"recipe_title_color": "#ffffff",
"recipe_title_font": "HelveticaNeue-Thin",
"recipe_title_line_height": 33,
"recipe_title_size": 29,
"recipe_title_tracking": 0,
"slug_color": "#e2e2e2",
"slug_font": "Helvetica-Bold",
"slug_line_height": 26,
Expand Down
42 changes: 42 additions & 0 deletions assets/themes/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,48 @@
"pullquote_size": 48,
"pullquote_tracking": 0,
"pullquote_transform": "uppercase",
"recipe_background_color": "#e1e1e1",
"recipe_body_background_color": "#e1e1e1",
"recipe_body_color": "#4f4f4f",
"recipe_body_font": "AvenirNext-Regular",
"recipe_body_line_height": 24,
"recipe_body_link_color": "#428bca",
"recipe_body_size": 18,
"recipe_body_tracking": 0,
"recipe_caption_background_color": "#e1e1e1",
"recipe_caption_color": "#4f4f4f",
"recipe_caption_font": "AvenirNext-Regular",
"recipe_caption_line_height": 24,
"recipe_caption_link_color": "#428bca",
"recipe_caption_size": 18,
"recipe_caption_tracking": 0,
"recipe_details_background_color": "#e1e1e1",
"recipe_details_color": "#4f4f4f",
"recipe_details_font": "AvenirNext-Regular",
"recipe_details_line_height": 24,
"recipe_details_link_color": "#428bca",
"recipe_details_size": 18,
"recipe_details_tracking": 0,
"recipe_header2_color": "#333333",
"recipe_header2_font": "AvenirNext-Bold",
"recipe_header2_line_height": 28,
"recipe_header2_size": 24,
"recipe_header2_tracking": 0,
"recipe_header3_color": "#333333",
"recipe_header3_font": "AvenirNext-Bold",
"recipe_header3_line_height": 26,
"recipe_header3_size": 21,
"recipe_header3_tracking": 0,
"recipe_header4_color": "#333333",
"recipe_header4_font": "AvenirNext-Bold",
"recipe_header4_line_height": 24,
"recipe_header4_size": 18,
"recipe_header4_tracking": 0,
"recipe_title_color": "#333333",
"recipe_title_font": "AvenirNext-Bold",
"recipe_title_line_height": 36,
"recipe_title_size": 32,
"recipe_title_tracking": 0,
"slug_color": "#4f4f4f",
"slug_font": "AvenirNext-Medium",
"slug_line_height": 26,
Expand Down
42 changes: 42 additions & 0 deletions assets/themes/modern.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,48 @@
"pullquote_size": 36,
"pullquote_tracking": -5,
"pullquote_transform": "none",
"recipe_background_color": "#e6f7ff",
"recipe_body_background_color": "#e6f7ff",
"recipe_body_color": "#30bcff",
"recipe_body_font": "Optima-Regular",
"recipe_body_line_height": 22,
"recipe_body_link_color": "#30bcff",
"recipe_body_size": 17,
"recipe_body_tracking": 0,
"recipe_caption_background_color": "#e6f7ff",
"recipe_caption_color": "#30bcff",
"recipe_caption_font": "Optima-Regular",
"recipe_caption_line_height": 22,
"recipe_caption_link_color": "#30bcff",
"recipe_caption_size": 17,
"recipe_caption_tracking": 0,
"recipe_details_background_color": "#e6f7ff",
"recipe_details_color": "#30bcff",
"recipe_details_font": "Optima-Regular",
"recipe_details_line_height": 22,
"recipe_details_link_color": "#30bcff",
"recipe_details_size": 17,
"recipe_details_tracking": 0,
"recipe_header2_color": "#000000",
"recipe_header2_font": "AvenirNext-Bold",
"recipe_header2_line_height": 46,
"recipe_header2_size": 48,
"recipe_header2_tracking": -4,
"recipe_header3_color": "#000000",
"recipe_header3_font": "AvenirNext-Bold",
"recipe_header3_line_height": 34,
"recipe_header3_size": 36,
"recipe_header3_tracking": -4,
"recipe_header4_color": "#000000",
"recipe_header4_font": "AvenirNext-Bold",
"recipe_header4_line_height": 22,
"recipe_header4_size": 24,
"recipe_header4_tracking": -4,
"recipe_title_color": "#000000",
"recipe_title_font": "AvenirNext-Bold",
"recipe_title_line_height": 58,
"recipe_title_size": 60,
"recipe_title_tracking": -4,
"slug_color": "#000000",
"slug_font": "AvenirNext-Regular",
"slug_line_height": 26,
Expand Down
42 changes: 42 additions & 0 deletions assets/themes/pastel.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,48 @@
"pullquote_size": 22,
"pullquote_tracking": 5,
"pullquote_transform": "uppercase",
"recipe_background_color": "#ffebe0",
"recipe_body_background_color": "#ffebe0",
"recipe_body_color": "#000000",
"recipe_body_font": "Georgia",
"recipe_body_line_height": 23,
"recipe_body_link_color": "#000000",
"recipe_body_size": 17,
"recipe_body_tracking": 0,
"recipe_caption_background_color": "#ffebe0",
"recipe_caption_color": "#000000",
"recipe_caption_font": "Georgia",
"recipe_caption_line_height": 23,
"recipe_caption_link_color": "#000000",
"recipe_caption_size": 17,
"recipe_caption_tracking": 0,
"recipe_details_background_color": "#ffebe0",
"recipe_details_color": "#000000",
"recipe_details_font": "Georgia",
"recipe_details_line_height": 23,
"recipe_details_link_color": "#000000",
"recipe_details_size": 17,
"recipe_details_tracking": 0,
"recipe_header2_color": "#000000",
"recipe_header2_font": "AvenirNext-Italic",
"recipe_header2_line_height": 31,
"recipe_header2_size": 23,
"recipe_header2_tracking": 12,
"recipe_header3_color": "#000000",
"recipe_header3_font": "AvenirNext-Italic",
"recipe_header3_line_height": 29,
"recipe_header3_size": 21,
"recipe_header3_tracking": 12,
"recipe_header4_color": "#000000",
"recipe_header4_font": "AvenirNext-Italic",
"recipe_header4_line_height": 26,
"recipe_header4_size": 19,
"recipe_header4_tracking": 12,
"recipe_title_color": "#000000",
"recipe_title_font": "AvenirNext-Italic",
"recipe_title_line_height": 34,
"recipe_title_size": 25,
"recipe_title_tracking": 12,
"slug_color": "#000000",
"slug_font": "AvenirNext-Bold",
"slug_line_height": 26,
Expand Down
1 change: 1 addition & 0 deletions includes/apple-exporter/class-component-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public static function initialize(
self::register_component( 'author', '\\Apple_Exporter\\Components\\Author' );
self::register_component( 'date', '\\Apple_Exporter\\Components\\Date' );
self::register_component( 'slug', '\\Apple_Exporter\\Components\\Slug' );
self::register_component( 'recipe', '\\Apple_Exporter\\Components\\Recipe' );
self::register_component( 'end-of-article', '\\Apple_Exporter\\Components\\End_Of_Article' );
self::register_component( 'in-article', '\\Apple_Exporter\\Components\\In_Article' );

Expand Down
Loading

0 comments on commit 0fa6028

Please sign in to comment.