HUGO

ERROR 2020/10/10 09:09:49 posts/hugo-configuration.adoc: asciidoctor: DEBUG: Finding 'svgbob' in attributes

Every time the svgbob diagram changes and I save the file, I get the following:

ERROR 2020/10/13 07:06:22 hugo/developing-in-virtual-machine.adoc: asciidoctor: DEBUG: Finding 'svgbob' in attributes
ERROR 2020/10/13 07:06:22 hugo/developing-in-virtual-machine.adoc: asciidoctor: DEBUG: Finding 'svgbob' in environment
ERROR 2020/10/13 07:06:22 hugo/developing-in-virtual-machine.adoc: asciidoctor: DEBUG: Found '/usr/local/bin/svgbob' in environment
ERROR 2020/10/13 07:06:22 hugo/developing-in-virtual-machine.adoc: asciidoctor: DEBUG: Executing ["/usr/local/bin/svgbob", "-o", "/var/folders/1j/fkfrvhf53vz7p2f998b2skdw0000gp/T/svgbob20201013-25272-qsnhch.svg"] with options {:stdin_data=>"\n  .----------------------------------------.\n  |           Host Computer                |\n  |                                        |\n  |                                        |\n  |                                        |\n  |                                        |\n  |                                        |\n  |                                        |\n  |                                        |\n  |                                        |\n  |                                        |\n  |                                        |\n  |                                        |\n  +-------+--------------------------------+\n  | Start |                                |\n  '----------------------------------------'\n"}
INFO 2020/10/13 07:06:22 Rendering hugo/the_index.adoc with /Users/my_home/.rvm/gems/ruby-2.7.0/bin/asciidoctor using asciidoctor args [-r asciidoctor-html5s -r asciidoctor-diagram -a icons=font -a my-base-url=/static/ -a source-highlighter=pygments --base-dir /Users/my_home/prj/content/hugo -a outdir=/Users/my_home/prj/dev_server/hugo/the_index --no-header-footer --verbose --trace -] ...
Total in 1782 ms
ERROR 2020/10/13 07:06:23 Rebuild failed:

ERROR 2020/10/13 07:06:23 Logged 4 error(s)
INFO 2020/10/13 07:06:23 Received System Events: ["/Users/my_home/prj/content/hugo/developing-in-virtual-machine.adoc": CHMOD]


The second time I save, everything seems to work fine, the page renders OK.

If I do this:

$ which svgbob
/usr/local/bin/svgbob

In my config.toml file, I have the following

    [markup.asciidocExt.attributes]
        svgbob = "/usr/local/bin/svgbob"

The diagram code looks like this:

[svgbob]
....

  .----------------------------------------.
  |           Host Computer                |
  |                                        |
  |                                        |
  |                                        |
  |                                        |
  |                                        |
  +-------+--------------------------------+
  | Start |                                |
  '----------------------------------------'

....

Why does Hugo output that error every time I change the diagram, but renders fine second time I save the document?

What is the output of:

cat filetoyoursvg | /usr/local/bin/svgbob 

Something seems to be returned that irritates Hugo.

OK so if I create a file temp_svgbobob_data with the following content:

 +-------+
 |       |
 +-------+
$ cat temp_svgbob_data | /usr/local/bin/svgbob
<svg class="bob" font-family="arial" font-size="14" height="48" width="80" xmlns="http://www.w3.org/2000/svg">
<defs>
<marker id="triangle" markerHeight="8" markerWidth="8" orient="auto" refX="4" refY="2" viewBox="0 0 8 4">
<polygon class="fg_fill" points="0,0 0,4 8,2 0,0"/>
</marker>
<marker id="clear_triangle" markerHeight="10" markerWidth="10" orient="auto" refX="1" refY="7" viewBox="0 0 20 14">
<polygon class="bg_fill" points="2,2 2,12 18,7 2,2"/>
</marker>
<marker id="circle" markerHeight="5" markerWidth="5" orient="auto" refX="10" refY="10" viewBox="0 0 20 20">
<circle class="fg_fill" cx="10" cy="10" r="8"/>
</marker>
<marker id="square" markerHeight="5" markerWidth="5" orient="auto" refX="10" refY="10" viewBox="0 0 20 20">
<rect class="fg_fill" height="20" width="20" x="0" y="0"/>
</marker>
<marker id="open_circle" markerHeight="10" markerWidth="10" orient="auto" refX="10" refY="10" viewBox="0 0 20 20">
<circle class="bg_fill" cx="10" cy="10" r="4"/>
</marker>
<marker id="big_open_circle" markerHeight="20" markerWidth="20" orient="auto" refX="20" refY="20" viewBox="0 0 40 40">
<circle class="bg_fill" cx="20" cy="20" r="6"/>
</marker>
</defs>
<style type="text/css">

rect.backdrop {
    fill: white;
}
text{
    fill: black;
}

circle {
    fill: none;
    stroke: black;
    stroke-width: 2;
}

line {
    stroke: black;
    stroke-width: 2;
    stroke-opacity: 1;
    fill-opacity: 1;
    stroke-linecap: round;
    stroke-linejoin: miter;
}

path {
    fill: none;
    stroke: black;
    stroke-width: 2;
    stroke-opacity: 1;
    fill-opacity: 1;
    stroke-linecap: round;
    stroke-linejoin: miter;
}

line.dashed {
    stroke-dasharray: 5;
}

.fg_fill {
    fill: black;
}


.bg_fill {
    fill: white;
    stroke: black;
    stroke-width: 2;
}

tspan.head{
    fill: none;
    stroke: none;
}

</style>
<rect class="backdrop" height="48" width="80" x="0" y="0"/>
<g>
<line x1="12" x2="12" y1="8" y2="40"/>
<line x1="12" x2="76" y1="8" y2="8"/>
<line x1="12" x2="76" y1="40" y2="40"/>
<line x1="76" x2="76" y1="8" y2="40"/>
</g>
</svg>

What I find strange is the DEBUG output in Hugo, if I break it into 3 lines:

ERROR 2020/10/14 07:04:25 hugo/developing-in-virtual-machine.adoc: asciidoctor: DEBUG: Executing
["/usr/local/bin/svgbob", "-o", "/var/folders/1j/fkfrvhf53vz7p2f998b2skdw0000gp/T/svgbob20201014-34535-i4135x.svg"]
with options
{:stdin_data=>"\n +-------+\n |       |\n |       |\n +-------+\n"}

So if I translate that to command line and test it, I get this:

$ echo  "+-------+\n |       |\n +-------+ " | /usr/local/bin/svgbob -o my.svg

There is no output to terminal, but a new file is created. Maybe SvgBob expects an active response in terminal but does not get it?

I would go more in the direction of the line endings. Maybe you save them with the wrong format? Like Windows line endings on a Mac? The \n should tell every program that this is a line change, but as far as I know on Macs you need \n\r for line changes.