Skip to content

Commit

Permalink
Deployed 4bc4ce3 with MkDocs version: 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Aug 12, 2024
1 parent c9d9858 commit cb98ffc
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 2 deletions.
83 changes: 82 additions & 1 deletion csv_value_templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">


<a href="#applying-csv-calue-templates-to-rows-in-your-input-csv" class="md-skip">
Skip to content
</a>

</div>
<div data-md-component="announce">

Expand Down Expand Up @@ -376,10 +381,46 @@



<label class="md-nav__link md-nav__link--active" for="__toc">
CSV value templates
<span class="md-nav__icon md-icon"></span>
</label>

<a href="./" class="md-nav__link md-nav__link--active">
CSV value templates
</a>



<nav class="md-nav md-nav--secondary" aria-label="Table of contents">




<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>

<li class="md-nav__item">
<a href="#applying-csv-calue-templates-to-rows-in-your-input-csv" class="md-nav__link">
Applying CSV calue templates to rows in your input CSV
</a>

</li>

<li class="md-nav__item">
<a href="#applying-csv-calue-templates-to-paged-content" class="md-nav__link">
Applying CSV calue templates to paged content
</a>

</li>

</ul>

</nav>

</li>


Expand Down Expand Up @@ -912,6 +953,28 @@



<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>

<li class="md-nav__item">
<a href="#applying-csv-calue-templates-to-rows-in-your-input-csv" class="md-nav__link">
Applying CSV calue templates to rows in your input CSV
</a>

</li>

<li class="md-nav__item">
<a href="#applying-csv-calue-templates-to-paged-content" class="md-nav__link">
Applying CSV calue templates to paged content
</a>

</li>

</ul>

</nav>
</div>
</div>
Expand All @@ -936,6 +999,7 @@ <h1>CSV value templates</h1>
<p class="admonition-title">Note</p>
<p>This section describes using CSV <em>value</em> templates in your configuration file. For information on CSV <em>field</em> templates, see the "<a href="/islandora_workbench_docs/field_templates.md">CSV field templates</a>". For information on CSV <em>file</em> templates, see the "<a href="/islandora_workbench_docs/generating_csv_files/#csv-file-templates">CSV file templates</a>" section.</p>
</div>
<h2 id="applying-csv-calue-templates-to-rows-in-your-input-csv">Applying CSV calue templates to rows in your input CSV</h2>
<p>In <code>create</code> and <code>update</code> tasks, you can configure templates that are applied to all the values in a CSV column (or to each subvalue if you have multiple values in a single field) as if the templated text were present in the values in your CSV file. The templates are configured in the <code>csv_value_templates</code> option. An example looks like this:</p>
<pre><code class="language-text">csv_value_templates:
- field_linked_agent: relators:aut:person:$csv_value
Expand All @@ -949,7 +1013,7 @@ <h1>CSV value templates</h1>
IMG_2940.JPG,03,Looking across Burrard Inlet,25,&quot;relators:aut:person:Jordan, Mark|relators:aut:person:Cantelo, M.&quot;
</code></pre>
<p>This example configuration defines only one field/template pair, but <code>csv_value_templates</code> can define multiple field/template pairs, for example:</p>
<pre><code class="language-text">csv_value_templates:
<pre><code class="language-yaml">csv_value_templates:
- field_linked_agent: relators:aut:person:$csv_value
- field_subject: subject:$csv_value
- field_local_identifier: SFU-$uuid_string
Expand All @@ -972,6 +1036,23 @@ <h1>CSV value templates</h1>
<li>Values in the templated CSV output are validated against Drupal's configuration in the same way that values present in your CSV are validated.</li>
<li>By default, CSV value templates won't be applied to empty fields. However, if you want a template to be applied to a field if that field is empty, you can include the <code>allow_csv_value_templates_if_field_empty</code> setting in your config file defining a list of column names. For example, <code>allow_csv_value_templates_if_field_empty: [field_identifier]</code> will apply any templates defined for <code>field_identifier</code> in your <code>csv_value_templates</code> setting, even if <code>field_identifier</code> is empty in your input CSV.</li>
</ul>
<h2 id="applying-csv-calue-templates-to-paged-content">Applying CSV calue templates to paged content</h2>
<p>Paged content (or as sometimes referred to, children) created using the "<a href="/islandora_workbench_docs/paged_and_compound/#using-subdirectories">Using subdirectories</a> method do not have their own rows in input CSV files. However, you can apply CSV value templates to their node fields using. In this case:</p>
<ul>
<li>the CSV row that is used as the source of <code>$csv_value</code> is the page's (or child's) parent row</li>
<li>the <code>$file</code> variable is the name of the page/child's filename (and <code>filename_without_extension</code> is derived from this value)</li>
<li>the <code>$weight</code> variable is taken from the page/child's sequence indicator, e.g. a filename of <code>page-002.jpg</code> would result in a <code>$weight</code> value of "2".</li>
</ul>
<p>If you want to apply CSV field templates to page/child items using this technique, register the templates in the <code>csv_value_templates_for_paged_content</code> config setting. The structure of the field-to-template mappings is identical to those used in the <code>csv_value_templates</code> setting as illustrated above. For example:</p>
<pre><code class="language-yaml">csv_value_templates_for_paged_content:
- field_linked_agent: relators:aut:person:$csv_value
- field_edtf_date_issued: $csv_value
- field_local_identifier: $csv_value-$weight
</code></pre>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Fields that are configured to be required in a content type are automatically applied to paged/child items created using the "<a href="/islandora_workbench_docs/paged_and_compound/#using-subdirectories">Using subdirectories</a> method. However, you may still configure templates using the <code>csv_value_templates_for_paged_content</code> setting if you wish. If you do, the templates are applied in the same way as they would be if the field was configured to be optional.</p>
</div>



Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

Binary file modified sitemap.xml.gz
Binary file not shown.

0 comments on commit cb98ffc

Please sign in to comment.