RW7&8 resource macro compiler bug

For more than a year I have been plagued with a crazy bug in the Rapidweaver 7 and 8 compiler that produces useless code when trying to set up a resource macro for displaying images on a web page. I have finally become frustrated enough to spend the time to document the bug. Note Realmac has known about this bug for some time as will be shown by a search of this site. Nothing has been done to fix it. Unaccetable!!!

The bug seems to be random in that when inserting resource macros in a web page some will be just fine; then something will kick off the bug. Once created it will affect many subsequent macros.

Only fix I found was to create a space of several empty lines on a page. Then carefully type in the resource macro code. With care the “fresh” resource macro text will not be bastardized by the compiler (i.e. conversion to code shown in Preview and exported)

I created a web page to figure out what was going on.

I started with a problematic resource macro from a working webpage.

I then played a combination of detective and “monkey at the keyboard” to try to track down the problem.

Here is a summary demonstrating the bug:
Copy of lines of code produced by RW7 4 Apr 2019

I have inserted line returns [LR] to make this clearer; actual code is continuous

Text between [Junk Code Start] and [Junk Code End] is inserted by compiler. There is no visual evidence for why this should happen. It renders the resource macro useless.

Sample of working and non functioning code:

Line starting with:

6 is a correctly functioning resource macro

7 is a correctly functioning resource macro

8.0 Is the problematic resource macro with bogus commands inserted by compiler

8.0.0.0.1 is a correctly functioning macro created by inserting a return after line of problematic macro and then typing the exact same resource macro text. It functions normally. No junk formatting code has been inserted by the compiler.

The following is code shown when Show Source menu command is used:

Copy of lines of code produced by RW7 4 Apr 2019

I have inserted line returns [LR] to make this clearer; actual code is continuous

Text between [Junk Code Start] and [Junk Code End] is inserted by compiler. There is no visual evidence for why this should happen. It renders the resource macro useless.

Sample of working and non functioning code:
Line starting with:
6 is a correctly functioning resource macro

7 is a correctly functioning resource macro

8.0 Is the problematic resource macro with bogus commands inserted by compiler

8.0.0.0.1 is a correctly functioning macro created by inserting a return after line of problematic macro and then typing the exact same resource macro text. It functions normally. No junk formatting code has been inserted by the compiler.

The following is code shown when Show Source menu command is used:

6



[LR]
7
<img src=“resources/StrawMarket2.jpg”








[LR]


[LR]
8.0 4 Apr 19 start
[Junk Code Start]
</ [Junk Code End] does not work [Junk Code Start]</ [Junk Code End]</
<img src= [Junk Code Start]</
"% [Junk Code End]</resource(StrawMarket2.jpg)%" width=“400”>
[LR]


[LR]
8.0.0.0.1 Retype of macro; now works
<img src=resources/StrawMarket2.jpg width=“400”
[LR]

You are talking about RapidWeaver 7, correct?

I am working with RW7. When the problem ocurred, I downloaded RW8 as a demo to evaluate if the upgrade to RW8 would fix the problem. I tested the issue with RW8. The problem persisted – same bug; not fixed. I decided it was not worth the investment to move to RW8. Realmac seems more interested in adding new features (that frankly are of little value to me) than fixing an important bug.

1 Like

I hope @dan can check.

Note to readers:
I just noticed due to a cut & paste error, there is redundant information in my original post.

Here is code exactly as shown in View Source – without annotations:
6


7
<img src=“resources/Straw Market 2.jpg"







8.0 4 Apr 19 start; did not work; removed spaces from image file name;</ does not work</</
<img src=</
”%</resource(StrawMarket2.jpg)%" width=“400”>
8.0.0.0.1 Retype of macro; now works
<img src=resources/StrawMarket2.jpg width=“400”

This forum software is actually changing the text of the problematic code I am trying to show.

Baaaahhhh!

To type code in a forum like here you need to make it as such, if you want it inline then surround the text with the backward single quote (key to the left of Z on your keyboard)

If you want a block of code then surround it with 3 of them

this is my 1st line
this is my 2nd line
this is my 3rd line

How the above looks as its being written:

CloudApp

You can go back and edit your posts to add the quote marks by clicking the pencil icon in the bottom right of your post(s)

Paul,
Thank you for the information.
Please excuse my frustration.
…Joe

Here is a repost of my problem. Hopefully with the advice of Paul, the text will appear as it should.

Copy of lines of code produced by RW7 4 Apr 2019

I have inserted line returns [LR] to make this clearer; actual code is continuous.

Text between [Junk Code Start] and [Junk Code End] is inserted by compiler. There is no visual evidence for why this should happen. It renders the resource macro useless.

Sample of working and non functioning code shown when “Show Source” menu command is used:

Note:  Line starting with:
6  is a correctly functioning resource macro

7 is a correctly functioning resource macro

8.0 Is the problematic resource macro with bogus commands inserted by compiler

8.0.0.0.1 is a correctly functioning macro created by inserting a return after line of problematic macro and then typing the exact same resource macro text.  It functions normally.  No junk formatting code has been inserted by the compiler.

Here is the code with my annotations:

6<br /><img src="resources/PhotoFolder2/PeggyKeyWest.JPG" height="auto" width="300" ><br /><br />
[LR]
7<br /><img src="resources/Straw Market 2.jpg"<br /><br /><br /><br /><br /><br /><br /><br />
[LR]
</span></p><p style="text-align:left;"><span style="color:#000000;">
[LR]
8.0 4 Apr 19 start; did not work; removed spaces from image file name; [Junk Code Start]</span></ [Junk Code End] does not work [Junk Code Start]</<span style="color:#000000;"> [Junk Code End]</<br /><img src= [Junk Code Start]</</span>"<span style="color:#000000;">%</span><span style="color:#353535;"> [Junk Code End]</resource(</span>StrawMarket2.jpg)%" width="400">
[LR]
<br />
[LR] 
8.0.0.0.1  Retype of macro; now works<br /><img src=resources/StrawMarket2.jpg width="400"
[LR]


Here is code as shown in "View Source" -- no annotations
6<br /><img src="resources/PhotoFolder2/PeggyKeyWest.JPG" height="auto" width="300" ><br /><br />7<br /><img src="resources/Straw Market 2.jpg"<br /><br /><br /><br /><br /><br /><br /><br /></span></p><p style="text-align:left;"><span style="color:#000000;">8.0 4 Apr 19 start; did not work; removed spaces from image file name;</span></ does not work</<span style="color:#000000;"></<br /><img src=</</span>"<span style="color:#000000;">%</span><span style="color:#353535;"></resource(</span>StrawMarket2.jpg)%" width="400"><br />8.0.0.0.1  Retype of macro; now works<br /><img src=resources/StrawMarket2.jpg width="400"

The key point here is that the Edit window of RW7 / 8 shows no difference in text formatting between the functional macro and the non-functional macro. Yet for some mysterious reason the compiler has inserted junk html formatting commands.

It might be more useful to show the “continuous code” without [lr]'s and embedded comments.
You also mention “Edit window of RW7 / 8”, are you talking about a “styled text” page main edit area? Or are you referring to something else?

If you are in fact talking about “styled text” Are you marking the resource macros to ignore formatting?
The errors above appear to be added by the styled text editor thinking you are “styling”.

Any native HTML code (including resource Macros) showed be marked selected(highlighted) and marked as “ignore formatting” cmd+ . (also available iunder the format menu).

Doug,

I am referring to the Edit window in either a Styled Text pages or a Stacks-Text page.

The compiler bug affects both Styled Text pages and in Stacks-Text pages.

If you check my most recent post, you will see the continuous text string shown by “Show Source”.

I think you are missing the point: I did not add any formatting.

The RW compiler that translates the text typed on a Styled Text page or a Sacks-Text page into html code, inserts the formatting for some crazy seemingly random reason.

The problem exists with both RW7 and RW8

If it will help, I will paste the entire “Show Source” text into a plain text file and forward it to you if you give me instructions.

I didn’t miss the point at all. styled text (or stacks page using the text stack) is “formatting” text for you. The styled text editor(also used by stacks text stack) converts the text you enter into HTML. It is mistaken the text (HTML that includes a resource macro) for something else. When you mark the code you placed into the styled text editor as “ignore formatting” you are telling the editor NOT to try to apply any styled text rules to this portion.

Just using styled text (weather stacks or not) is in fact “adding formatting”.

Try marking the lines as “ignore formatting” and I bet the problem will go away.

1 Like

Doug,
I appreciate your rapid response and insights.

I do understand that working with the Styled-Text or Stacks-Text pages involves formatting.

The issue is, the compiler should not be inserting style code unless I have directed it to do so. The problematic resource macro occurs when style code is inserted by the compiler for no apparent reason.

I took your advice and ran a test.

I took the problematic resource macro line of text, I highlighted it in Edit window. Then I applied the menu command: Format/Ignore Formatting

The problematic resource macro then worked normally. The problematic styling html does not appear in the resource macro in “Show Source”

In all my previous searches for a solution to this problem over the last 2 years, I have never come across the instruction to use of the “Ignore Formatting” command with resource macros. Perhaps I missed it… If so, please show us where it is.

I strongly suggest that until you fix the compiler bug, Realmac publish updated instructions on how to use resource macros that direct that "ignore Formatting? be applied to the macro text.

Cheers,
…Joe

Not really a bug, so I wouldn’t expect it to be fixed. It’s just the way “styled text” works.

From the RapidWeaver 7 manual(page 39):

Using HTML Code in Styled Text pages

RapidWeaver’s Styled Text pages, and any other page types that use the styled text areas available to plugins, also allow you to paste in HTML. To ensure your code appears as you expect, you should identify blocks of code as such by choosing Format > Ignore Formatting. By using this option, you’re telling RapidWeaver not to alter or stylise the content.

So what should you do if you’ve got code that you want to show as an example on your website? Highlight the block of code and then use the Format > HTML > Code. This will apply the appropriate HTML tags to ensure the code is displayed properly when previewing and publishing the site.

I’m not really sure I quite follow. Nor do you really need to explain it to me – I don’t think I can assist in fixing – but sometimes I’m good at documenting bugs. And I do know a lot about how the Styled Text processing engine works.

I was wondering – could you give me the simplest steps so that i can make this bug happen on my machine? Feel free to use any version or page-type or whatever – just just explain in steps like i’m 4 years old – not because i actually am, but because i want to make sure i perform the steps perfectly without any deviation – so i can see the bug in all it’s terrible glory.

Isaiah

Isaiah,

Here is a step-by- step process:

Start with a new page for a website by adding either a Styled Text Page or a Stacks Page with a Text box to a project.

Select a image file and add it to Resources

Create a resource macro to display the image on the webpage; either by directly typing all the code or by copying the the component of the macro available from the Resources inspection panel for the image and insert it to the balance of needed code that you type in.

Select Preview window for webpage.

This usually results in the image being displayed as desired.

Now add more content

Add additional image(s) to Resources.

Copy and paste the resource macro for image 1 in the spot desired for new image to be displayed.

Edit the new resource macro to reference the new image.

Select Preview

The images will usually be displayed correctly.

Now do something more complicated.

Cut and paste one of the working macros in a new location on the webpage.

Edit it. Perhaps by typing, perhaps by pasting in an image name. [e.g. decide to change the sequence of how images are displayed by copying the file name for image 1 and past it in place of the name for image 2 and vice versa] I have not been able to determine exactly what causes the “bug” to kick in – it is a mystery. But it is associated with editing a macro which originally worked.

The new (edited) macro(s) looks exactly like the original macro in the edit window. Absolutely no visible difference in text.

Select Preview
The macro(s) does not work.

Select View Source.

Search for the problematic macro(s).

You will find that bogus formatting code has been inserted by the compiler somewhere in the macro text-- this renders the macro non-functional.

Switch back to Edit window

Do as I just learned from Doug. Highlight the problematic resource macro. Select menu command Edit/Ignore Formatting.

Open Preview window

Macro displays image normally.

The key point is that in changing text in a macro that results in no other visual change other than the change in text (think changing “happy” to “glad”) the compiler decides to insert other formatting commands that are “invisible” to you in the edit window yet render the macro inoperative.

Let me know if this helps.

Now here is what really bothers me.

The following is a direct cut and paste of Rapidweaver 7 manual on use of resource macros:

" If you need to embed the image or have a use for the image’s address, instead of hardcoding the link you can use what’s known as a resource macro. Whenever a resource macro is found in your project, RapidWeaver will substitute it for a link to the resource.

%resource(image.jpg)% becomes a path to a resource called image.jpg . If the resource is inside a folder, be sure to include the name of the folder in your macro: %resource(folder-name/image.jpg)% .

Note: To save time, RapidWeaver can generate a macro for you. Hold Option while clicking on the link button to copy the resource’s macro to the clipboard."

What they need to add is:
“Remember the resource macro is code. You need to be sure it is not misinterpreted so when you have written the resource macro, highlight the text, select menu command Edit/Ignore Formatting. This will make sure the page compiler dos not introduce unwanted formatting instructions which will render the resource macro inoperative.”

As I write this, all the many hours wasted because of this has boiled up and I am tempted to say that they should also add the following:

[ This will cause you hundreds of hours and much $ while you attempt to correct for this bug which we either don’t know about or don’t care enough to fix or tell you about.]

Let me know if this helps.
…Joe

i was with you up to this point.

i’ve got a file with a couple different images and a Styled Text page with a couple different macros. they’re all A-OK before this. but i’m unsure of what to do to make the bug happen.

i mean, i can mangle the macros – like if the macro is “flower.jpg” i can make it “tree.jpg” and it will definitely stop working LOL – but i kind of doubt that’s what you mean. any hints on exactly what i should change and where?

are you changing things in the resource window? or in the Styled Text page? can you give me a specific example how a macro that you changed that broke. like paste in the exact text before/after the break?

or could you capture a video (in Mojave you can do Cmd-Option-5 i think and it will capture video now)

or share a zipped project file (with resources embedded) that has a broken macro that we can see.

i think the “devil is in the details” of this particular part of it. if we can figure that part out – i’m sure we can get to the bottom of this thing.

isaiah

Isaiah,
I appreciate the attention you are giving this issue.

The most frustrating issue is that I really have no exact idea of what triggers the bug!

I’m sure you have authored websites. So you are busy adding new content to several different pages. You use the idea of cloning: get a piece of text or text that is a resource macro that works and you copy and paste it somewhere else in the site and make a few edits so it does the job you need. You have a of things you are working on. All is well – then you do something and the cloned macro that worked fine a line or two earlier - or on a different page – suddenly doesn’t work,

I’ve now discovered that if I View Source, I will see the macro has been corrupted with bogus formatting code, AND I stress there is NO visual evidence of a difference between the text of the working macro and the non-functional macro.

I haven’t tested this but I think it may be due to pasting text inside the macro: e.g. copy the text for image1 from one webpage, and paste it to replace imageB in the cloned macro.

Note: Ive done exactly the above many times and the macro works. Then I do it another time and it doesn’t.

I may try to pare down the test website I use to evaluate new techniques (and used to track down what was going on with this bug). If I can do so, how do I upload it to you?

I write this as i sail N along Cat I in the Bahamas – this helps keep me peaceful as I write about this frustration.

Cheers
Joe

Don’t worry, it’s kind of my job. :yum:

That is always the challenge. Especially when it comes to fixing bugs. If you can’t make it happen, how do you even begin to fix it!?

But keep trying – if you discover the magic, let us know. Until then though – it’s sort of like going to the car mechanic and telling them to fix the squeak – only the squeak never happens for the mechanic!!! it’s always that way for me!!! :triumph: and then they don’t know what to fix – so they fix the wrong thing or nothing at all.

The same will probably happen here unfortunately. But I’ll keep poking at it to see if I can make something interesting happen.

A few. Yes.

You must be very careful copying and pasting text here and there. Macros are like tiny computer programs – one character off – one character in the wrong style and blammo the whole thing is a train wreck. HTML, like any programming language, is not very forgiving.

There are many small details that matter greatly to web browsers that look nearly (and sometimes totally) unremarkable. A common problem is that copying and pasting from one place to another sometimes adds “Smart Quotes” – some apps insert them automatically. Smart quotes are fancy curly quote characters. They look great typographically – but they are not equivalent in HTML. The ' and " characters are A-OK but the ‛ and ‟ are off limits. The same goes for ligatures like “ff” which is actually a single character even though it looks like two. These subtle things can be very difficult to spot for someone unaccustomed to looking for them.

My recommendation is to keep copying and pasting away from macros. And if you find you have a good example of such a problem, take a screenshot of the macro in question right inside RW. Or save the file and share it with us via dropbox (you don’t need to save the whole file – just the page in question – or even just the stack in question saved to another empty file – just so long as we can see the problem with our own eyes). With more concrete details of the problem we can likely help you avoid it and help document the issue so that it can be fixed by Realmac.

To be honest, I’m not 100% sure what you mean by this. And perhaps your meaning of “macro” is different than my understanding of that word in the context of RW. I think having a screenshot or a file to show us the issue directly is essential.

That sounds blissful. Some of my favorite places in the world are down that way. I dropped out of college for a semester to spend all my money backpacking around the carrabean. Truly the best days of my life.

Isaiah

Isaiah
Thanks for feedback.
I have been careful to limit use copy & paste between macros to macro text only.
I’m well aware of what one character wrong can do – in the 70s I wrote software to control electronic equipment writing in PDP11 machine & assembly language for time-critical processes.

I will seek to provide you an example of the resource macro files.

However, if it were the RW developer, I would design my text-to-html compiler to prevent erroneous html code from being included in something so important to a site’s operation as resource macro code.

…Joe