Which mode should I use for RDFa code in emacs? - 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.

Related

Why sfcc use isml instead of html?

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

Can a CSS file be used to generate PDF output?

Does DITA-OT support generation of PDF output with CSS customizations? I think it supports PDF generation using Apache FOP.
I generate both HTML and PDF output and want to use CSS.
Thanks...
The DITA Open Toolkit does not come with default support for using CSS to create PDF. But it can be done. Here is general info on a few ways to do it, to give you an idea:
If you have a late-model version of the Oxygen XML editor, you can use the transformation scenario called DITA Map PDF - based on HTML5 & CSS. This is probably the easiest way to go. If you want to have this capability on a server, there is an extra charge. See Oxygen PDF Chemistry for more info: https://www.oxygenxml.com/chemistry-html-to-pdf-converter.html
The XML Rocks DITA OT plugin, which requires a commercial PDF processor, one of these: Antenna House Formatter, PDFReactor, Vivliostyle or Prince. https://github.com/xmlrocks/dita-ot-pdf-css-page
Do it yourself. One way I have done this is to create normal XHTML output from the DITA OT, and then use a PDF processor and CSS to transform the XHTML to PDF. I have used Antenna House, but other commercial PDF processors (see above) can work also. You should make the XHTML all in one file (all DITA topics merged into one file) by adding this attribute to the <map> element: <map chunk="to-content">

Where can I find the code that converts PR descriptions into HTML

Pull requests' (PRs) descriptions use Markdown that's documented here, and when the PR is viewed in a browser, that Markdown content is converted into HTML and looks "pretty".
Where can I find the code that converts it from Markdown to HTML, so I can leverage the same algorithms in my (internal-only) code?
Unfortunately we can not see the source code. It should be something like the Markdown editor/viewer.
So if you mean you want to render the Markdown with the "pretty" formatting offline, then you can use the existing Markdown editor/Tools such as markdown-it or showdown or any others.
Showdown is a JavaScript Markdown to HTML converter, based on the
original works by John Gruber. Showdown can be used client side (in
the browser) or server side (with Node.js).
If you are interested in the codes, then you can reference the open source code of markdown-it or showdown on GitHub.
Other related questions:
How to render Markdown Text from database in a Razor view?

Translation of XHTML page with MathML

We have few XHTML pages with MathML in them. All are generated using Amaya. We have a requirement to translate them to different languages, but Amaya doesn't seem to support Unicode text encoding. Right now we plan to replace the text in XHTML manually.
I would be happy to know of other possible ways of implementing this translation process. Translation should maintain structure of the MathML.
Use XML to create a translation dictionary with Math entities. The translation can be done programmatically using XSLT and Amaya or E4X and AS3.

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