From e1cec74bdc11a3476d77b9fb5f71c8ea48e64079 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 6 Dec 2019 14:57:05 -0500 Subject: checks on markup: yaml headers & reading images --- org/meta_conf_make_meta.org | 13 ++++++------- org/metaverse.org | 9 +++++---- src/doc_reform/meta/conf_make_meta_yaml.d | 13 ++++++------- src/doc_reform/meta/metadoc_from_src.d | 9 +++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index 9fad67a..c3da874 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -1856,14 +1856,13 @@ static template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { M _manifested, ) { Node _yaml_root; - if (header_src.match(rgx.yaml_header_meta_title)) { - try { - _yaml_root = Loader.fromString(header_src).load(); - } catch { - import std.stdio; - writeln("ERROR failed to read document header, not parsed as yaml"); - } + try { + _yaml_root = Loader.fromString(header_src).load(); + } catch { + import std.stdio; + writeln("ERROR failed to read document header, not parsed as yaml"); } + // need test for _yaml_root content auto _header_and_make_and_meta_struct = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml_root, _manifested, "header"); return _header_and_make_and_meta_struct; diff --git a/org/metaverse.org b/org/metaverse.org index f184d9e..644bc0a 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -2354,11 +2354,12 @@ auto _image_dimensions(O,M)(O obj, M manifested) { int w, h, chans; real _w, _h; int max_width = 640; - foreach (m; obj.text.matchAll(rgx.inline_image_without_dimensions)) { - debug(images) { - writeln(manifested.src.image_dir_path ~ "/" ~ m["img"]); + foreach (img; obj.text.matchAll(rgx.inline_image_without_dimensions)) { + try { + read_image_info(manifested.src.image_dir_path ~ "/" ~ img["img"], w, h, chans); // + } catch (Exception ex) { + writeln("WARNING, image not found: ", img["img"], "\n ", manifested.src.image_dir_path ~ "/" ~ img["img"]); } - read_image_info(manifested.src.image_dir_path ~ "/" ~ m["img"], w, h, chans); // calculate, decide max width and proportionally reduce to keep w & h within it debug(images) { writeln("width: ", w, ", height: ", h); diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index 3d39471..a01a025 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -822,14 +822,13 @@ static template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { M _manifested, ) { Node _yaml_root; - if (header_src.match(rgx.yaml_header_meta_title)) { - try { - _yaml_root = Loader.fromString(header_src).load(); - } catch { - import std.stdio; - writeln("ERROR failed to read document header, not parsed as yaml"); - } + try { + _yaml_root = Loader.fromString(header_src).load(); + } catch { + import std.stdio; + writeln("ERROR failed to read document header, not parsed as yaml"); } + // need test for _yaml_root content auto _header_and_make_and_meta_struct = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml_root, _manifested, "header"); return _header_and_make_and_meta_struct; diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 35d70d5..0e6c38e 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -1784,11 +1784,12 @@ template docAbstraction() { int w, h, chans; real _w, _h; int max_width = 640; - foreach (m; obj.text.matchAll(rgx.inline_image_without_dimensions)) { - debug(images) { - writeln(manifested.src.image_dir_path ~ "/" ~ m["img"]); + foreach (img; obj.text.matchAll(rgx.inline_image_without_dimensions)) { + try { + read_image_info(manifested.src.image_dir_path ~ "/" ~ img["img"], w, h, chans); // + } catch (Exception ex) { + writeln("WARNING, image not found: ", img["img"], "\n ", manifested.src.image_dir_path ~ "/" ~ img["img"]); } - read_image_info(manifested.src.image_dir_path ~ "/" ~ m["img"], w, h, chans); // calculate, decide max width and proportionally reduce to keep w & h within it debug(images) { writeln("width: ", w, ", height: ", h); -- cgit v1.2.3