| {% pop site_items item %} |
| {% if item[page.page_mask] != true %} |
| |
| {% set_hash_entry item path item_path %} |
| {% set_hash_entry item url item_url %} |
| {% set_hash_entry item content item_content %} |
| {% set_hash_entry item title item_title %} |
| {% set_hash_entry item id item_id %} |
| |
| {% if visitedb contains item_title %} |
| {% comment %} <!-- ignore --> {% endcomment %} |
| {% elsif item['external'] %} |
| {% comment %} <!-- ignore --> {% endcomment %} |
| |
| {% else %} |
| {% capture pid %}{{ item.title | remove:'/' | replace:' ','-' | downcase }}{% endcapture %} |
| {% if item_content != null %} |
| <div id="contentsLink-{{pid}}" class="section-breaker section p-{{item_id}}"> |
| <span style="width: 100%"><h1>{{ item_title }}</h1><a href="#content-top" class="goToTop">^</a></span> |
| {% comment %} |
| <!-- |
| --This Section re-writes images so the base of their paths is the root docs directory. This allows the PDF to build properly. |
| --> |
| {% endcomment %} |
| {% comment %}<!-- Build the page directory by removing the file name from the item url -->{% endcomment %} |
| {% capture page_url %}{{ item_url | replace_regex:'[^\/]*$', '' }}{% endcapture %} |
| |
| {% capture new_img %}img src=".{{ page_url }}{% endcapture %} |
| |
| {% comment %}<!-- Build a regex which replaces the current path with an absolute one but leaves any sub folders such as /images -->{% endcomment %} |
| {% capture img_regex %}(img(.*?)src="{{ page_url | replace:'/','\/' }})|(img(.*?)src="){% endcapture %} |
| |
| {% comment %}<!-- Filter the content of the included page -->{% endcomment %} |
| {% capture content_filtered %}{{ item_content | replace_regex: img_regex, new_img | refactorURL: 'href="(.*?)"', site, site.pages, page.availablePages, page, item }}{% endcapture %} |
| |
| {{ content_filtered }} |
| </div> |
| {% endif %} |
| {% if item['menu'] %} |
| {% push visitedb item_title %} |
| {% push site_items item %} |
| {% assign last_item = site_items[-1] %} |
| {% for item in last_item['menu'] %} |
| {% push site_items item %} |
| {% include singlepage-content.html %} |
| {% endfor %} |
| {% pop site_items item %} |
| {% endif %} |
| {% endif %} |
| |
| {% endif %} |