In the LightningVLM module, there is an IMAGE concept with an url property.
I tried in my F-Alloy specification to write the following:
guard_mapImage(n:Node,i:IMAGE){
i.url="/path/to/myImage.png"
}
but images are not displayed (I get red crosses instead).
What did I do wrong ?
The "url" property of the "IMAGE" concept needs to be set to a valid URL.
You could use "file:///path/to/image.png" to refer to an image on your computer.
In addition, it's also possible to use Eclipse Platform URLs to refer to files inside your Eclipse workspace, eg. "platform:/resource/MyLightningProject/MyLanguage/image.png".
Related
Imagine I have a huge CSS file with e.g. more than 40000 lines, like https://cdn.jsdelivr.net/npm/semantic-ui#2.4.2/dist/semantic.css
I want to explore this file and for example search for class definitions containing "hidden" in their name. How can this be done? The word "hidden" can also appear in the definition of the class, so a normal text search is not sufficient. So I am looking for a tool which is able to interpret the CSS file and then allows me to semantically search in it, understanding the difference between "hidden" in a class name and "hidden" in a class definition.
Any tips on this? Thanks!
Update: I am using Visual Studio Code, if there is a matching extension for it, that would be great. A separate tool would also be fine.
I’m not sure which text editor/IDE you are using but most IDE’s allow you to search for classes by name, in which case you could just use “hidden” as the input. In IntelliJ, the command for this is Ctrl+N. You’ll have to check your editor or IDE for the shortcut but a simple Google search should give you the answer.
I have a Plone 4 site where I currently use the following method to embed objects (e.g. images, videos, tables …) in user-editable HTML content:
I have a custom transform browser which takes HTML text and transforms all a and img elements which refer to an element by UID (i.e., which have an href="…/resolveuid/abc123…" or src="…/resolveuid/abc123…").
My view templates read the text field and let that browser transform it;
the browser has a Python dict TYPE2TEMPLATE which has portal_type keys and template_id values;
for each a or img which refers to an object by UID,
the object is fetched by o = brain._unrestrictedGetObject()
the template id t_id is taken from the TYPE2TEMPLATE dict
the "embed" method is fetched by method = o.unrestrictedTraverse(t_id)
that method is called (in some cases with some keyword arguments), and the result - which is contained in one top HTML element - replaces the "raw" a or img element.
Now that I'm developing an additional customization package (which contains new object types, now using Dexterity), I wonder whether there is some more "plonish" way. Is there, for example, some embed action?
i don't know of a package that does the same and what you're doing sounds sane to me ;-)
i just would use https://pypi.python.org/pypi/plone.outputfilters instead of your transform BrowserView.
if it's possible to explicitly mark links that should not be auto-embedded (eg via span.noEmbed a.internal-link selector) this could become a useful addon.
i guess for portal_type=='File' you'll need to check the mimetype too in order to decide if you're embedding a video file or something else...
other products i know of embed content outside of your plone site (eg. collective.embedly)
another approach would be a to use a tinymce plugin to genereate the proper embed html when editing the html-body of your page (i personally would not go this route because there are different tiny versions to support for 4.3 and 5.0 and we're not sure if tiny woun't be replaced as default editor in the future)
I'm trying to register a custom content type, similar to this question on MSDN forums: I want to register a custom extension that is essentially an HTML file, e.g.:
[Export]
[DisplayName("My Custom Markup")]
[Name("mycustom")
[BaseDefinition("html")]
internal static ContentTypeDefinition MyCustomContentType;
[Export]
[FileExtension(".mycustom")]
[ContentType("mycustom")]
internal static FileExtensionToContentTypeDefinition MyCustomFileExtensionDefinition;
So by specifying BaseDefinition as html, I am able to get HTML highlighting in .mycustom files, unfortunately I get nothing else, in particular, the HTML intellisense. From the above link it seems that the only way to have Visual Studio recognize custom extensions as a specific editor type, but I'd have to hack the registry (or more specifically, provide this via the ProvideEditorExtension attribute, but it's only applicable on a VSPackage).
So my question is, basically, is there an alternative way to register a custom extension to an editor programmatically, but without creating a custom VSPackage for it? Other than hacking the registry, of course?
(I could be totally wrong with the approach, in which case your help is very much appreciated!)
The easiest way is to use the technique demoed here:
http://blogs.msdn.com/b/noahric/archive/2010/03/01/new-extension-css-is-less.aspx
This is effectively "hacking the registry" but in a supported way. You're simply wrapping the needed keys in a .pkgdef file (essentially a .reg file) that can be contained in an editor extension.
We have a Tridion use case related to curated content where we are creating multimedia components for images associated with our content which are pointing to External resource types instead of uploaded resource types.
One of the issues we have run into with this use case is that despite explicitly setting the Multimedia Type for the resource, if the URL of the image has either a query string in it: http://cdn.hw.net/UploadService/1c8b7f28-bb12-4e02-b888-388fdff5836e.jpg?w=160&h=120&mode=crop&404=default or uses a ‘friendly url’: http://www.somewhere.com/images/myimage/ when we save the component, Tridion barfs with error messages similar to : ‘Invalid value for property 'Filename'. Unexpected file extension: jpg?w=160&h=120&mode=crop&404=default. Expecting: jpg,jpeg,jpe.’
So far, the only way we’ve been able to figure out to potentially get around this issue is to do something hacky like appending an extra query string parameter to the very end of the urls which end with the expected file extension: http://cdn.hw.net/UploadService/1c8b7f28-bb12-4e02-b888-388fdff5836e.jpg?w=160&h=120&mode=crop&404=default&ext=.jpg Obviously, this is not the best solution and in fact may not work for some images if the site they are being served from strictly validates the requested URL.
Does anyone have any ideas on how we can work around this issue?
Unfortunately I can't really think of an easy solution to this, since Tridion "detects" the Mime type by checking the file extension.
You could perhaps add it while saving and remove it when reading (via Event System)? Definitely a worthwhile enhancement request, to my knowledge this behavior has not been changed for the soon-coming Tridion 2013... See comment below, it has been changed for 2013.
+1 for Nuno's answer. Recognizing that the title of your question is specific to multimedia components, you may want to consider another approach which is to use normal Components, not Multimedia Components. You can create a normal component schema called something like "External Image" that has an External Url field to store your extentionless url.
Content authors will then include these images via regular component linking mechanisms in the Tridion GUI.
You will then need a custom link resolver TBB that will parse the Output item (via Regex) looking for any Tridion anchor tags <a tridion:href="tcm:x-y-z"> and for each one replace them with an <img src=...> tag where the src path would come from this linked component.
For an example of a similar approach, but with videos, and sample code for a custom link resolver TBB have a look at the code in the following post: http://www.tridiondeveloper.com/integration-sdl-tridion-jw-media-player.
With the FCKEditor, you can specifiy paths where the editor must be included. Eg.
node/add/email
Which works great, until you need to go back and EDIT that node. Which means you end at a path like so:
node/284/edit
Now, the fck editor no longer works, because the path isn't valid.
Is there any way that one can get the FCKEditor to work for both the normal path and the edit path of ONE SPECIFIC CONTENT TYPE?
I'm not sure if you can do this with stock the FCKEditor module. However, you can do it by using the WYSIWYG API module, which allows you to specify WYWIWYG editors on a per-input-filter basis, and Better Formats, which allows you to set input filter formats on a per-node-type basis.