Why sfcc use isml instead of html? - demandware

Why can't sfcc use html directly instead of isml. One reason I can see is to display dynamic content. But I wanted to know is there any other specific reason for it

using isml for templating sfcc allows the developer to do the following:
determine how B2C Commerce embeds live data into a page
determine how to format this data together with the regular HTML code
one more thing, is the huge utility of tags, helpers and commands that allows the developer to deal with different data models and views

The most basic difference:
ISML templates to generate dynamic storefront pages. Templates combine HTML with a proprietary language extension called Internet Store Markup Language (ISML). An ISML template consists of standard HTML markup, ISML tags, and script expressions. ISML templates are similar to Java Server Pages in that both are used to present dynamically generated web content.
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScript.(Static pages)
Ref:
https://en.wikipedia.org/wiki/HTML
https://documentation.b2c.commercecloud.salesforce.com/DOC2/topic/com.demandware.dochelp/content/b2c_commerce/topics/site_development/b2c_working_with_templates.html

Related

is it possible to view a question with a browser before importing it to Moodle?

I have created a XML file using R-exams out of just a single exercise to be imported to Moodle. I would like to view it before uploading it in the Moodle question bank. I tried to open it with Firefox and I can see some code but not the output and a message appear saying that the XML file does not seem to have a style sheet associated to it. Is there a way to find this style sheet and to see how the question comes out just using a browser like Firefox or Chrome?
To emulate how the R/exams exercises are converted to HTML by exams2moodle() and how Moodle displays mathematical content, it's best to use
exams2html(..., converter = "pandoc-mathjax")
In recent versions of R/exams the resulting HTML file then automatically loads the MathJax Javascript that enables correct rendering of mathematical content in all modern browsers (including Google Chrome). See also http://www.R-exams.org/tutorials/math/ for some general advice about math in HTML.
To the best of my knowledge there is no tool that would quickly display Moodle XML files in such a way that you can easily assess them.

Which JavaScript WYSIWYG editor supports merge/custom fields?

I am looking at creating custom document creation for a Rails application. Users will have ability to edit HTML document. I want to include custom/merge fields from the data objects like {{property.contact.name}} in HTML code. Is there a javascript rich text editor that has this capability? I have been searching for a while but could not locate one.

Which mode should I use for RDFa code in emacs?

For all my typing tasks I use emacs.
Which mode should I use for RDFa code?
The nearest I can find is the n3-mode-for-emacs. But there are some small differences.
From Wikipedia:
RDFa (or Resource Description Framework in Attributes) is a W3C Recommendation that adds a set of attribute-level extensions to HTML, XHTML and various XML-based document types for embedding rich metadata within Web documents.
Since RDFa lives inside HTML and XML attributes it makes sense to use an HTML or XML mode, depending on the format of the base file.
nxml-mode works very well for XML and XHTML. html-mode or web-mode would be a good choice for XHTML and HTML.

Using RazorEngine for Text and Html emails

I'm using RazorEngine v3.3 to create emails using template files (emails are sent using SendGrid Web API). I implemented a base template so I can use my own html helpers by overriding the WriteTo() method as shown here
.
My problem is that my emails are part Html and part Text. For the Html templates, I use razor's default implementation that html-encodes the #Model values. This is because some of the data comes from user input.
However, I can't use the same implementation for the text part as Html will not be interpreted when being read.
So the way I see it I have 3 options:
use #Raw(Model) in all my text based templates to ignore Html encoding
create an other base template for my text templates which doesn't encode to Html
modify my Html base template so the WriteTo() method doesn't encode anything
The 1st solution seems the safest, but I have about 50 text based templates to go through, and it reduces readability.
The 2nd solution seems the cleanest to me, however this would prevent the use of cache, as I would be constantly doing Razor.SetTemplateService() to reassign the right base template ?
What would you recommend doing ? Thanks

Best Way to Parse HTML to XML

Essentially, I currently have an iPhone app that can query and parse an XML file on my server. Right now, I currently have to manually update and upload my XML file every morning so my users can have the updated information. I would like to automate this process, which would essentially entail parsing various websites (NYTimes, iAmBored.com, etc), outputting the relevant information from each of these websites to an XML file, and uploading that file to my server.
Does anyone know the best way to accomplish this (parsing HTML to an XML file). Since I am a beginner, I'm not sure what languages this requires or what is the best way to do this?
Thanks a lot in advance!
You can try to translate HTML to XHTML (XHTML is based on XML so it's XML with some rules defined in a DTD).
You can also try to parse directly HTML with a SGML parser (As XHTML is based on XML, HTML is based on SGML).
The links are provided as inspiration.
If the content you need to scrape is in XHTML then you can easily use the XSLT language to transform original content in what you need inside the XML you provide to your users.
Otherwise any kind of scraping and XML producing solution will be fine, every programming language has its support to do such things.. but you could use XPath to select the elements you need from the page and then save them inside the output file.
Can you get what you need from the RSS/Atom feeds? That will simplify things greatly because they are XML rather than HTML and can be parsed by a standard XML parser. Of course, descriptions embedded inside RSS feeds will be HTML, so depending on your application, that may be when you need to parse HTML.
XSLT is a domain-specific programming language designed for processing XML, but you can also use any programming language that includes an XML parser for the task.
TagSoup - Just Keep On Truckin'
...a SAX-compliant parser written in Java
that, instead of parsing well-formed
or valid XML, parses HTML as it is
found in the wild: poor, nasty and
brutish, though quite often far from
short.
TagSoup is designed for people
who have to process this stuff using
some semblance of a rational
application design.
By providing a SAX
interface, it allows standard XML
tools to be applied to even the worst
HTML. TagSoup also includes a
command-line processor that reads HTML
files and can generate either clean
HTML or well-formed XML that is a
close approximation to XHTML.
Also, Taggle, a TagSoup in C++, available now