<commit_before>    class="container content-block %globals_asset_metadata_jcu.features.theme^eq:content:jcu-content%" aria-label="%asset_metadata_template.title.title^striphtml% %asset_metadata_template.title.subtitle^striphtml%">
    <div class="row">
        <div class="col-xs-12 col-md-10 col-md-offset-1 container">

            %begin_asset_metadata_template.title.display^eq:show%
            <h3 class="%asset_metadata_template.title.alignment%">
              <script runat="server">JCU.printPhrasingHtmlFromKeyword('globals_asset_metadata_template.title.title:%asset_assetid%');</script>
              <script runat="server">JCU.printPhrasingHtmlFromKeyword('globals_asset_metadata_template.title.subtitle:%asset_assetid%', {prepend: '<br><span class="lead m-t-2">', append: '</span>'});</script>
            </h3>
            %end_asset%

            <!-- content container asset contents -->
            <script runat="server">
              print(parts.innerHTML) //Hack for #72: %asset_assetid%
            </script>

        <!--    Now draw the summary card list    -->

        <script runat="server">

          var assets = []
          var assetList = "%asset_metadata_template.list.items%"

          if (assetList.length > 0) {
            assetList = assetList.slice(1,-1);
            assets = assetList.split(",");
          }
          
          var imageShape = '%asset_metadata_template.card.image.shape^replace:circle:img-circle^replace:natural: %';
          var imageShapeClass = 'image-shape-' + '%asset_metadata_template.card.image.shape%';
          var flairText = '%asset_metadata_template.card.initial.flair%';
          var cardLayout = '%asset_metadata_template.card.layout%';
          var columnCount = 0; // required by drawThumbnailGridCard

          if (assets.length > 0) {
            if (cardLayout == "mosaicGrid") {
              print('<div class="card-columns ' + imageShapeClass + '">');
              assets.forEach(drawGridCard);
              print('</div>');
            } else if (cardLayout == "column") {
              print('<div class="' + imageShapeClass + '">');
              assets.forEach(drawColumnCard);
              print('</div>');
            } else if (cardLayout == "thumbnails") {
              print('<div class="row ' + imageShapeClass + '">');
              assets.forEach(drawThumbnailGridCard);
              print('</div>');
            } else
              print('<div class="alert alert-warning">Card layout ' + cardLayout + ' not supported yet </div>');
          } else
              print('<div class="alert alert-info">No items to display </div>');



          function buildCardHref(assetId) {
            // if there is an override.url set then use that, otherwise get the url for the original asset
            // override.urls should open in a separate window
            const externalUrlTarget = ' target="_blank" rel="external noopener" ';

            return('%globals_asset_metadata_jcu.summarycard.override.url:' + assetId + '^prepend_if:' + externalUrlTarget + 'href="^empty:href="./?a=' + assetId +'^append_if:"%');
          }   // buildCardHref

          function buildCardImage(assetId, imageWrapper) {
            //  if there is an image then build the tag, otherwise return nothing

            imageWrapper = imageWrapper || { prepend : '', append : ''};

            var imageTag = { prepend: '<img class="img-fluid ' + imageShape + '" src="./?a=', append: '\\:v3"/>' };
            var result = '%globals_asset_thumbnail_assetid:' + assetId +
             '^prepend_if:' + imageWrapper.prepend + imageTag.prepend +
             '^append_if:' + imageTag.append + imageWrapper.append +
             '%'
/*
            var debugResult = result.replace('%', '')
            print('<!-- buildCardImage result(' + debugResult + ') -->')
*/
            return(result)
          }

          function buildCardLinkedImage(assetId, imageContainer) {
            //  If there is an image set then build an image tag for it
            //  Wrap the image tag (or the lack of it) with a link tag and any wrapper tags
            //  passed in via imageContainer.
            //  It was intended to use conditional keywords to not output the link if the image
            //  didn't exist but they don't work in SSJS.

            imageContainer = imageContainer || { prepend : '', append : ''};

            var linkTagOpen = imageContainer.prepend + '<a ' + buildCardHref(assetId) + '>';
            var linkTagClose = '</a>' + imageContainer.append;

            return linkTagOpen + buildCardImage(assetId) + linkTagClose;
          }   // buildCardLinkedImage
<commit_msg>Handle the case where the user has selected an image variety rather than the original image<commit_after>    class="container content-block %globals_asset_metadata_jcu.features.theme^eq:content:jcu-content%" aria-label="%asset_metadata_template.title.title^striphtml% %asset_metadata_template.title.subtitle^striphtml%">
    <div class="row">
        <div class="col-xs-12 col-md-10 col-md-offset-1 container">

            %begin_asset_metadata_template.title.display^eq:show%
            <h3 class="%asset_metadata_template.title.alignment%">
              <script runat="server">JCU.printPhrasingHtmlFromKeyword('globals_asset_metadata_template.title.title:%asset_assetid%');</script>
              <script runat="server">JCU.printPhrasingHtmlFromKeyword('globals_asset_metadata_template.title.subtitle:%asset_assetid%', {prepend: '<br><span class="lead m-t-2">', append: '</span>'});</script>
            </h3>
            %end_asset%

            <!-- content container asset contents -->
            <script runat="server">
              print(parts.innerHTML) //Hack for #72: %asset_assetid%
            </script>

        <!--    Now draw the summary card list    -->

        <script runat="server">
          const imageVariety = "newsdetails"
          var assets = []
          var assetList = "%asset_metadata_template.list.items%"

          if (assetList.length > 0) {
            assetList = assetList.slice(1,-1);
            assets = assetList.split(",");
          }
          
          var imageShape = '%asset_metadata_template.card.image.shape^replace:circle:img-circle^replace:natural: %';
          var imageShapeClass = 'image-shape-' + '%asset_metadata_template.card.image.shape%';
          var flairText = '%asset_metadata_template.card.initial.flair%';
          var cardLayout = '%asset_metadata_template.card.layout%';
          var columnCount = 0; // required by drawThumbnailGridCard

          if (assets.length > 0) {
            if (cardLayout == "mosaicGrid") {
              print('<div class="card-columns ' + imageShapeClass + '">');
              assets.forEach(drawGridCard);
              print('</div>');
            } else if (cardLayout == "column") {
              print('<div class="' + imageShapeClass + '">');
              assets.forEach(drawColumnCard);
              print('</div>');
            } else if (cardLayout == "thumbnails") {
              print('<div class="row ' + imageShapeClass + '">');
              assets.forEach(drawThumbnailGridCard);
              print('</div>');
            } else
              print('<div class="alert alert-warning">Card layout ' + cardLayout + ' not supported yet </div>');
          } else
              print('<div class="alert alert-info">No items to display </div>');



          function buildCardHref(assetId) {
            // if there is an override.url set then use that, otherwise get the url for the original asset
            // override.urls should open in a separate window
            const externalUrlTarget = ' target="_blank" rel="external noopener" ';

            return('%globals_asset_metadata_jcu.summarycard.override.url:' + assetId + '^prepend_if:' + externalUrlTarget + 'href="^empty:href="./?a=' + assetId +'^append_if:"%');
          }   // buildCardHref

          function buildCardImage(assetId, imageWrapper) {
            //  if there is an image then build the tag, otherwise return nothing

            imageWrapper = imageWrapper || { prepend : '', append : ''};
            var imageTag = { prepend: '<img class="img-fluid ' + imageShape + '" src="', append: '"/>' };

            var result = '%globals_asset_thumbnail_v_' + imageVariety + '_url:' + assetId + 
              '^empty:{globals_asset_thumbnail_url:' + assetId + '}' +
             '^prepend_if:' + imageWrapper.prepend + imageTag.prepend +
             '^append_if:' + imageTag.append + imageWrapper.append +
             '%'

            return(result)
          }

          function buildCardLinkedImage(assetId, imageContainer) {
            //  If there is an image set then build an image tag for it
            //  Wrap the image tag (or the lack of it) with a link tag and any wrapper tags
            //  passed in via imageContainer.
            //  It was intended to use conditional keywords to not output the link if the image
            //  didn't exist but they don't work in SSJS.

            imageContainer = imageContainer || { prepend : '', append : ''};

            var linkTagOpen = imageContainer.prepend + '<a ' + buildCardHref(assetId) + '>';
            var linkTagClose = '</a>' + imageContainer.append;

            return linkTagOpen + buildCardImage(assetId) + linkTagClose;
          }   // buildCardLinkedImage

{'fraction_non_alphanumeric': 0.13063780112490714, 'fraction_numerical': 0.0032898227740634617, 'mean_word_length': 2.3288590604026846, 'pattern_counts': {'":': 0, '<': 62, '<?xml version=': 0, '>': 68, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5529057', 'n_tokens_mistral': 2593, 'n_tokens_neox': 2522, 'n_words': 592}