Asciidoc: How can I format text in a user defined attribute? - asciidoc

When writing H~2~O in the text of an asciidoc document, it is rendered "H subscript(2) O",
However trying to define an attribute: :water: H~2~O and refer to the attribute in the text as {water} it is replaced by the verbatim definition of :water: or H~2~O. (the subscript formatting is not processed). And the question is: Can I define attributes with text formatting? (a workaround would be to use 'sed' for example, but it would be more elegant to do within asciidoc, if possible).

From this page of the documentation:
inline formatting in an attribute value isn’t interpreted
However, this can be changed by using the inline pass macro.
For example:
:water: pass:quotes[H~2~O]

Related

Why does Sphinx+MyST put spaces inside HTML tags in the generated output?

I'm new to MyST and Sphinx, so perhaps this has an obvious explanation, but it is not obvious to me. Whenever I use any construct in my Markdown source, such as bold facing or italics or even an html element such as <span>, the result in the formatted HTML output contains spaces inside the HTML tags. For example, an input such as
* **Barcode**: the barcode identifying the item
* **Title**: the title of the item.
* **Author**: the author of the item.
produces this:
Note the space before the :. Inspecting the HTML reveals that the bold-faced element contains unexpected space characters:
Note the spaces inside the <strong>...</strong>. Why is this happening? What am I doing wrong? More importantly, how do I make it stop?
I'm using Sphinx 3.4.3 with myst-parser 0.13.3. My conf.py defines extensions as 'myst_parser', 'sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', and 'sphinx.ext.napoleon'.

How to use the output of a tiddlywiki widget itself as a value for another wikitext expression?

Currently I'm trying to create a macro. The macro will be used within a $list widget which will cycle through a collection of tiddlers (chosen as per certain filter criteria which themselves aren't relevant here).
Within the above $list widget, for each tiddler, the macro will go through all of the fields of the tiddler that have a certain prefix (which is "link_"). These fields contain as their value internet URLs.
Not only do I wish to display these URLs (for each tiddler) as a list, I wish them to act as hyperlinks to said URLs.
Now so far the below macro has worked for the moment:
\define myMacro(prefix:"")
<$list filter="[fields[]prefix[$prefix$]sort[title]]" variable="fieldName">
<$transclude field=<<fieldName>>/>
</$list>
\end
What the above does is simply print the value (the URL) of that field while making sure it also acts as a hyperlink to that particular URL.
BUT
I wish to improve this further. Instead of the text of those links being the link itself, I want it to be a custom text.
For eg:
https://en.wikipedia.org/wiki/Computer_programming
vs.
Computer Programming (hyperlink to the same page but with custom hyperlink text)
But doing the above is seemingly impossible with the above $transclude method unless there is a way of using the output of a widget itself as a value.
I've already checked something direct like:
[[Custom link name|<$transclude field=<<fieldName>>/>]]
or
<a href=<$transclude field=<<fieldName>>/> >Custom link name</a>
Doesn't work.
I've tried other methods too but they don't work. How do they not work?
Let's say there is a variable in that particular tiddler called list_1 and it's value is https://en.wikipedia.org/wiki/Computer_programming. I wish to use the https://en.wikipedia.org/wiki/Computer_programming as the href value of an <a> tag.
But with all the methods I've tried, at best I can access the value list_1 itself via <<fieldName>>.
Only the $transclude method itself allows me to use the value of list_1 itself (ie https://en.wikipedia.org/wiki/Computer_programming), but it doesn't allow you AFAIK to use it as a value in an another wikitext expression.
So how do I achieve my aforementioned objective? Is there a way to use the output of a widget itself as a value for another wikitext expression or is there some other way to accomplish my objective?
Thanks in advance.
not sure I understand your goal but this is definately wrong:
<a href=<$transclude field=<<fieldName>>/> >Custom link name</a>
you should use the <$link widget to create links and a filter for attribute values
<$link to={{{[[title]get<fieldName>]}}}>Custom link name</$link>
or
<$link to={{{[<variableWithTitle>get<fieldName>]}}}>Custom link name</$link>
Edit: added title to filter

Are there cases of editing HTML output by Aspose.Word with CKEditor?

I am in trouble with the event that the sentence edited in CKEditor are not output to Word as a result of inheriting attributes of “-aw-import:ignore”.
A tag with this attribute is a tag that conveys the attribute of the original word when converting from html to word, and it is not output as word as a meta tag.
If the sentence entered in CKEditor inherits the attributes, it will not be output as word by mistake.
Aspose.Words writes this "-aw-import:ignore" only when it needs to make certain elements visible in HTML that would otherwise be collapsed and hidden by web browsers e.g. empty paragraphs, space sequences, etc.
Currently we mark only the following elements with “-aw-import:ignore”:
Sequences of spaces and non-breaking spaces that are used to simulate
padding on native list item (<li>) elements.
Non-breaking spaces that are used to prevent empty paragraphs from collapsing.
However, note that this list is not fixed and we may add more cases to it in the future.
Also, please note that Aspose.Words write   instead of because is not defined in XML. And by default Aspose.Words generate XHTML documents (i.e. HTML documents that comply with XML rules).
I work with Aspose as Developer Evangelist.
Please find below list of custom styles that Aspose.Words uses to save extra information in output HTML and usually this information is used for Aspose.Words-HTML-Aspose.Words round-trip. We will add description of these entities in documentation as soon as possible.
-aw-comment-author
-aw-comment-datetime
-aw-comment-initial
-aw-comment-start
-aw-comment-end
-aw-footnote-type
-aw-footnote-numberstyle
-aw-footnote-startnumber
-aw-footnote-isauto
-aw-headerfooter-type
-aw-bookmark-start
-aw-bookmark-end
-aw-different-first-page
-aw-tabstop-align
-aw-tabstop-pos
-aw-tabstop-leader
-aw-field-code
-aw-wrap-type
-aw-left-pos
-aw-top-pos
-aw-rel-hpos
-aw-rel-vpos
-aw-revision-author
-aw-revision-datetime

How to apply formatting to content of a span

With CkEditor, When I create an A tag and later apply some custom formatting (like color text for instance), the resulting source looks like this:
<p><span style="color:#1abc9c;">some text</span></p>
As you can see, the formatting is around the text but INSIDE the A tag.
I have a personal plugin that outputs a SPAN tag with a specific class. In the wysiwyg editor, when I select the text and apply the same formatting, I get this:
<p><span style="color:#1abc9c;"><span class="command3d">Some text</span></span></p>
This time, the formatting is not simply around the text. It is applied around the SPAN tag.
How can I control this behaviour? I would like to get this result instead:
<p><span class="command3d"><span style="color:#1abc9c;">Some text</span></span></p>
Thanks
Unfortunately there is no ability to control the order of inline styles (based on span tags) inside editor's instance. The only sensible way to achieve desired result is to start with applying text color and then apply your custom style.
However there are two methods to convert output of the editor to the correct format. The first is to add custom handler to editor's data processor via toDataFormat event to check ancestors of span.command3d and swap them in places if necessary. However it's a little bit troublesome as you must traverse through all content, therefore it's easier way: add element callback to editor's filter. Example.

How to add default value to text field that cannot be changed (Ruby on Rails)

I am trying to create a formatted text field that will have its contents then parsed into a Ruby Date object. I think I have the logic for taking a value from a text field and turning that into a date, but I can't figure out the formatting part.
I want a text field that would already have separators in it by default, that the user could not overwrite. So I would want the text field to look like:
__/__/__
And when they tab into the field, the text they type fills in the spaces instead of overwriting everything in there.
Thanks!
not sure about the ruby but you can use jQuery like so:
http://digitalbush.com/projects/masked-input-plugin/
jQuery(function($){
$("#key").mask("aaaaa-aaaaa-aaaaa-aaaaa-aaaaa");
});
and simply use <noscript> in your page header to make sure anyone's viewing your page has the javascript enabled.

Resources