RDFa / Microformat - Recipe markup standards - microformats

I wonder if anyone can help?
After Google announced that it will take note of RDFa / Microformats for online recipes, I've been looking into this for a couple of recipe based sites I run. However we simply don't have all the required data to fulfill any of the standards.
Does this matter? Will search engine crawlers still make the most of what they do find, or by missing a few elements (like a review or recipe rating) will I be wasting my time implementing this?
Also, if, for formatting reasons, I have to add extra divs around the information, does that invalidate it all?
Cheers,
H

Have a look to hRecipe draft specification.
The hRecipe schema consists of the following properties:
* hrecipe
o fn. required. text. the name of the recipe.
o ingredient. required. 1 or more. text with optional valid (x)HTML markup.
+ value and type. optional. [experimental]
o yield. optional. text.
o instructions. optional. text with optional valid (x)HTML markup.
o duration. optional. 1 or more. text.
o photo. optional. 1 or more. using any element containing a URL, such as IMG. [experimental]
o summary. optional. text. [experimental]
o author. optional. 1 or more. [experimental]
o published. optional. [experimental]
o nutrition. optional. 1 or more. [experimental]
+ value and type. optional. [experimental]
o tag. optional. 1 or more. [experimental]
If you look at required fields fn and ingredient are mandatory, the others fields are optional.
The following example is a valid hRecipe recipe:
<div class="mydivclass1">
<h1 class="fn">Spaghetti al ragù</h1>
<div class="myfancydiv2>Ingredients:</div>
<span class="ingredient">
spaghetti
</span>
<span class="ingredient">
ragù
</span>
</div>
To check your microformats, you could use the cool Optimus validator.

The only "must have" tag is the name of the recipe, the fn class if you go with microformats. This however must be the child of a parent which has the hrecipe class name to help the indexers distinguish between the special data and standard text.
BUT! The support for this was just released and I can't tell you if including only the recipe name will help you in any way; since it's a matter of a few changes, you probably want to test it on a site, wait a few weeks and apply to the rest of the sites if it works.
Regarding the extra DIVs, it shouldn't make any difference.

Related

Vee-Validate: Dependent dropdown with multiple conditions

I have three dependent inputs ways for my form that requires validation.
First Dropdown
Second Dropdown
Third Free Text
I need help in implementing the required_if condition as the syntax is a bit confusing to make put it to work, and resolve the following
When [Issue Category] has the value 'Other (Enter Detail)', then [Issue] needs to be disabled, [Detail] field becomes required.
When [Issue] has the value 'Other (Enter Detail)' then [Detail] field becomes required.
v-bind:key is required for the second dropdown, but unsure how to use a number to remove the error that appears in the console.
CodeSandbox
First, please include the relevant code in your question in the future. The Code Sandbox is great, very helpful, but on Stack Overflow, the goal is to be able to find answers within the site (not needing to leave it to view parts of the question or answer).
You don't need to use required_if. Instead, use the object form of v-validate like so:
<b-input
type="textarea"
v-model="item.detail"
v-validate="{'required':(item.issue_category == 'Other (Enter Detail)')}"
name="detail">
</b-input>
For your other problem, it's essentially the same except you also forgot to give the select a name which is required. Also don't mix HTML5 required attributes in there, I don't think it helps:
<b-select
v-model="item.issue"
name="Issue"
v-validate="{'required':(item.issue_category != 'Other (Enter Detail)')}" >
That's it! See a working example here.

Show content based on whether the user has certain tag in Mailchimp

I went through the Merge Tags here and here, but couldn't figure out the syntax that would allow me to show content based on whether the user has certain Tag or not.
Help?
My goal in case it helps:
User subscribes, and is queued for a welcome mail one day later. In meantime that user may get tagged (my way of segmenting them), and so, the next day when that user receives the welcome mail, the content needs to be catered based on the tag that user got.
Got a response from their support saying
merge tags do not work with Tags just yet
here's the whole thing:
While we do have conditional merge tags available, I'm afraid we do
not have any that would work with Tags. To be transparent, Tags were
recently added a few months ago, and there are some features in our
application that has not updated to work with Tags just yet.
Because conditional merge tags do not work with tags yet, the best
option would be to create multiple automations and send them out based
on each tags. If you do it that way, you'll be able to target those in
specific tags with specific content
Dug a little deeper from the first link. There is another link Use Conditional Merge Tag Blocks which contained the below code:
Name
IF-ELSE
Definition
Use ELSE to indicate alternative content to display if the *|MERGE|* tag value is false.
Example
*|IF:MERGE|* content to display *|ELSE:|* alternative content to display *|END:IF|*
Name
ELSEIF
Definition
Use ELSEIF to specify a new *|MERGE|* tag to be matched against if the first *|MERGE|* tag value is false.
Example
*|IF:TRANSACTIONS >= 20|* Enjoy this 40% off coupon! *|COUPON40|*
*|ELSEIF:TRANSACTIONS >= 10|* Enjoy this 20% off coupon! *|COUPON20|*
*|ELSE:|* Enjoy this 10% off coupon! *|COUPON10|* *|END:IF|*
More examples with definitions can be found here.
Hope this is the answer you were after.

Is there a way to do string replacement/substitution in sql?

I have some records in a CMS that include HTML fragments with custom tags for a widget tool. The maker of the CMS has apparently updated their CMS without providing proper data conversion. Their widgets use keys for layout based on screen width such as block_lg, block_md, block_sm. The problem kicks in with the fact they used to have a block_xs and they have now shifted them all -- dropping the block_xs and instead placing a block_xl on the other end.
We don't really use these things, but their widget configurations do. What this means for us is the values for each key are identical. The problem occurs when the updated CMS code is looking for the 'block_xl' in any widget definition tags, it can't find it and errors out.
What I'm thinking then is that the new code will appear to 'ignore' the block_xs due to how it reads the tags. (and similarly, the old code will ignore block_xl) Since the values for each are identical, I need to basically read any widget definition and add a block_xl value to it matching the value of [any one of] the other width parameters.
Since the best place order-wise would be 'before' the block_lg value, it's probably easiest to do it as follows:
Replace any thing matching posix style regex matching /block_lg(="\d+,\d+")/ with: block_xl="$1" block_lg="$1"
Or whatever the equivalent of that would be.
Example of an existing CMS block with multiple widget definitions:
<div>{{widget type="CleverSoft\CleverBlock\Block\Widget"
widget_title="The Album" classes="highlight-bottom modish greenfont font52 fontlight"
enable_fullwidth="0" block_ids="127" lazyload="0"
block_lg="127,12," block_md="127,12," block_sm="127,12," block_xs="127,12,"
template="widget/block.phtml" scroll="0" background_overlay_o="0"}}</div>
<!-- Image Block -->
<div>{{widget type="CleverSoft\CleverBlock\Block\Widget"
widget_title="What’s Your Favorite Cover Style?"
classes="zoo-widget-style2 modish grey font26 fontlight"
enable_fullwidth="0" block_ids="126" lazyload="0"
block_lg="126,12," block_md="126,12," block_sm="126,12," block_xs="126,12,"
template="widget/block.phtml" scroll="0" background_overlay_o="0"}}</div>
What I would prefer to end up with from the above (adding block_xl):
<div>{{widget type="CleverSoft\CleverBlock\Block\Widget"
widget_title="The Album" classes="highlight-bottom modish greenfont font52 fontlight"
enable_fullwidth="0" block_ids="127" lazyload="0"
block_xl="127,12," block_lg="127,12," block_md="127,12," block_sm="127,12," block_xs="127,12,"
template="widget/block.phtml" scroll="0" background_overlay_o="0"}}</div>
<!-- Image Block -->
<div>{{widget type="CleverSoft\CleverBlock\Block\Widget"
widget_title="What’s Your Favorite Cover Style?"
classes="zoo-widget-style2 modish grey font26 fontlight"
enable_fullwidth="0" block_ids="126" lazyload="0"
block_xl="126,12," block_lg="126,12," block_md="126,12," block_sm="126,12," block_xs="126,12,"
template="widget/block.phtml" scroll="0" background_overlay_o="0"}}</div>
I know how to do it in php and if necessary, I will just replace it on my local DB and write an sql script to update the modified records, but the html blocks can be kind of big in some cases. It would be preferable, if it is possible, to make the substitutions right in the SQL but I'm not sure how to do it or if it's even possible to do.
And yes, there can be more than one instance of a widget in any given cms page or block. (i.e. there may be a need for more than one such substitutions with different local 'values' assigned to the block_lg)
If anyone can help me do it in SQL, it would be greatly appreciated.
for reference, the tables effected are called cms_page and cms_block, the name of the row in both cases is content
SW

How to create function for count number of tags in SQL Server

In SQL Server 2014, I need a function that can count the number of tags, and if not equal the number of tags open and close tags, tag if the tag is low, add the appropriate package.
For this example or source code of page of website:
<div>
<ul>
<li>John</li>
<li>sara</li>
<li>mack</li>
<li>jane<li>
</div>
count (<) = count (>)
count (<tag>) = count (</tag>)
if count(<) < count(>) --> add < before element of tag
if count(<tag>) > count(</tag>) then add </tag> in correct position or delete.
The fact, that you tag your question with xml (and the same with your other question you placed shortly) shows clearly, that you have a deep misconception of XML...
XML is not HTML!!!
Many people think, that they are related, almost the same, but - despite the fact, that both use markups in <> brackets - they aren't...
We might discuss about XTHML, but your examples (here and in your other question) are not xml-safe... XHTML is an hybrid of HTML and XML. Every element must be closed correctly, no <br> is allows, only <br/>, no unclosed tags like <ul> in your example... XML is absolutely strict with character escaping, namespaces and nesting hierachies.
SQL Server offers great help to deal with valid XML, but this cannot help you out. You have to analyse this on string base. But SQL Server is rather poor with string operations and is - for sure! - not the right tool to analyse poorly designed web pages.

How to generate rdoc-style collapsable code sections?

I am creating internal documentation for a C++ project using Doxygen. I am having Doxygen include the source for methods, etc., but this makes the page kind of hard to scan. I'd like it to behave like rdoc and hide the source in a block that is collapsed by default.
I thought that HTML_DYNAMIC_SECTIONS might let me do this, but alas, the changelog says that option only affects diagrams and graphs.
Maybe I could do it by editing the LAYOUT_FILE?
Anyhow, smart people, how can I coerce Doxygen to generate collapsable code sections?
if includ[ing] the source for methods, etc, [...] makes the page kind of hard to scan, why don't you just link to it (SOURCE_BROWSER = YES) instead of including it (INLINE_SOURCES = YES)? this would make the pages easier to scan and faster to load, and the source would still be accessible (at the expense of one more source page load). depends on how often you actually need to access the source, i guess.
that being said, there is a way to generate collapsible code sections (you will have to modify the source and recompile Doxygen, though):
collapsible sections in Doxygen's HTML output are marked with two nested <div>s like so:
<div class="dynheader"><div class="dynsection">
[collapsible section]
</div></div>
included code sections are marked like so: <div class="fragment"><pre class="fragment">...</pre></div>
thus, to make the included code sections collapsible, you have to either
modify the code that generates the <div class="fragment"><pre class="fragment">...</pre></div> to generate <div class="dynheader"><div class="dynsection">...</div></div> (and probably adjust some css), or
change the javascript initDynSections() function that scans and collapses the collapsible sections to recognize <div class="fragment"><pre class="fragment"> as one of them.
the implementation (or going the SOURCE_BROWSER route :)) is left as an exercise for the reader. good luck!
oh, and if you should succeed with a patch, it would be great if you could submit it to dimitri so that he can include it in a future version. thanks!
coming along here using the search engine of my choice i just want to leave a note here that it is not absolutely necessary to modify any doxygen source.
When this question was asked there was probably no possibility to embed pure html using the htmlonly tag but with this in mind one is able to create foldable container sections abusing a function named toggleVisibility
function toggleVisibility(linkObj)
{
var base = $(linkObj).attr('id');
var summary = $('#'+base+'-summary');
var content = $('#'+base+'-content');
var trigger = $('#'+base+'-trigger');
var src=$(trigger).attr('src');
if (content.is(':visible')===true) {
content.hide();
summary.show();
$(linkObj).addClass('closed').removeClass('opened');
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
content.show();
summary.hide();
$(linkObj).removeClass('closed').addClass('opened');
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
}
return false;
}
that is currently available every time the documentation is generated in a file called dynsections.js placed in the documentation root.
Regarding this code one gets to know the conditions to be able to create foldable code from his/her own documentation using Javascript avoiding inner execution faults in this function and preventing further javascript code from being uninterpreted.
dom element with a unique identifier id
another encapsulated dom element with unique identifier id-summary
another encapsulated dom element with unique identifier id-content
another encapsulated dom element with unique identifier id-trigger
the id-trigger element must contain a src attribute with at least 1 character
the class attributes of the main containers do not matter
With theese conditions in mind one can create the following code.
## Fold me
## <div id="example-div">
## <div id="example-div-summary"></div>
## <div id="example-div-content">
## <pre>
## foo
## bar
## </pre>
## </div>
## <div id="example-div-trigger" src="-"></div>
## </div>
## #htmlonly <script type="text/javascript">$("#example-div").ready(function() { toggleVisibility($("#example-div")); });</script> #endhtmlonly
The doxygen code above is used to document bash code using bash-doxygen so it might look a bit different from pure doxygen code. The first part involving the div containers is already described mentioning the conditions to fit the source of the function toggleVisibility and make it executable without any errors adjusting the doxygen comments for our needs.
The unique id prefix used in here is example-div. In line one there is a hyperref link setup to unfold a section using javascript directly in conjunction with some jQuery code.
What's left is the one liner at the end. It contains the jQuery script need to be run to initially fold the specific segment. For the bash-doxygen (and probably other languages) the block needs to be a one liner because of the script's block scope
Normally the contents between \htmlonly and \endhtmlonly is inserted as-is. When you want to insert a HTML fragment that has block scope like a table or list which should appear outside <p>..</p>, this can lead to invalid HTML. You can use \htmlonly[block] to make doxygen end the current paragraph and restart it after \endhtmlonly.
as noticed in the doxygen documentation and a comment below the right marked solution of the stackoverflow answer on including script tags in doxygen documentations.
Thank you for reading.
Hope this helps some people that come along here.