Transform reST list item for rst2html output - transform

I have a reStructuredText document with todo list items:
Vim
===
- ✓ (2021-11-05) RST Section text object
(drop it in favor of env text object)
Probably should be based on the output of ``:Toc`` command to properly
identify all sub sections if this is needed.
- ✓ (2021-11-05) RST "Environment" text object
Which could be setup in vim to have nicely colored unicode checkmark and (date)
Regular rst2html.py knows nothing about those checkmarks and dates, but it looks like it is possible to use Transform feature of docutils to add css classes to those list items.
Probably documentation of the docutils is written for the more experienced people, but I could not find an easy guide on how to:
create your own Transform
apply it to your reStructuredText document.
PS, I could get the structure of the document with rst2pseudoxml.py and I can see elements I should change:
<bullet_list bullet="-">
<list_item>
<paragraph>
вњ“ (2021-11-05) RST Section text object
(drop it in favor of env text object)
But have no clue where to start from.

Related

Pimcore 6 CSV Importing

Pimcore newbie here. I'm struggling a bit with the csv import procedure, the docs are a bit shallow and I couldn't find a more comprehensive developer reference.
I'm not getting how Resolver Settings work. What's the meaning of setting a strategy? (ID throws Pimcore\DataObject\Import\Resolver\ImportErrorException: Could not resolve object with id. Filename runs, but then it seems that I don't have control on how objects get labeled)
I have two date columns in my imported csv, so I'd like to fill my object with those. Still, the dates are written like "2016-05-30T14:36:03" so I guess that I need to process a bit to transform the string in a format that could be recognized by pimcore. Do I need to do this in Column Configuration (by converting the specific column as an Operator PHP Code. BTW, do I need to create a class for every column, or I can group them by data format?) or more globally by setting the Resolver Strategy as Code and editing all the row properties at once?
About the resolver
When importing a CSV, Pimcore has for each row basically two options: create a new DataObject or update an existing one. When you want Pimcore to update existing DataObjects then you need some logic to retrieve that specific DataObject based on some info in the CSV. That's where the Resolver comes in place.
Pimcore supports 5 different resolver strategies:
Id: your CSV needs to contain a column with the DataObject id, and that value is used to fetch the corresponding DataObject to update
Filename: same as above, but for the filename (= key) of the DataObject
Fullpath: same as above, but for the full path of the DataObject
GetByAttribute: same as above, but for a given attribute within the DataObject (for example if you have a field ProductCode in it)
Code: a custom PHP class containing logic to retrieve the existing DataObject
The Id operator has one drawback, which you are currently running into:
Resolves the objects via the object ID. The object has to exist, otherwise an error is thrown.
Based on your question, I have the feeling that you are only inserting new DataObjects (at least for now, maybe you might also want to update later on).
When creating DataObjects you need to specify a key/filename (most likely you already noticed that when creating an object manually), so your CSV should already (if it doesn't you should add it) contain a column with either that key/filename or with the full path for the new DataObjects. That same column can/should be used to resolve any (potentially already) existing DataObjects.
So you should use either the Filename or Fullpath Resolver. Both have options what to do if the object already exists (update it? ignore it?) and (more important in your situation) what to do when it doesn't exist yet.
About the dates
Looking at the code, any string that can be parsed by the PHP's method strtotime can be entered in your CSV. Your value 2016-05-30T14:36:03 parses just fine.

search in divs within a DataTable

I'm currently on a project in which I included partialviews in every single row of a datatable.
it used to not be in a datatable at all, but I thought it could be a good idea for the use of the search function.
but of course, the partialview contains many text spans, even an external js called summernote, which includes lots of hidden text spans itself, and the search results are including every text within the global div. no need to say this isn't as accurate as I thought it would be.
I've seen that the search plugin could let us filter, for example, every div that has some class, but what I'm looking for is a functionnality that lets us filter on text contained in divs that have some class. this way I could ignore every other unrelevant text, hidden or not.
is it even remotely possible ?
thanks
There is no plain magic thing which let you filter a div containing a text combined with the question for a class which has to be also included. but you may write such a thing byself or use data attributes. Here is something which might be useful. filter multiple data attributes

Inno Setup built-in control names

I frequently find that I need the names of built-in controls e.g. WizardForm.StatusLabel. Is there a definitive reference to all the built-in control names somewhere, and if not, how do you go about finding these? As a worked example, how would I find the name of the control that shows the filename that is being extracted on the WizardForm.InstallingPage i.e. the label underneath the WizardForm.StatusLabel?
The only public documentation is TWizardForm reference. It lists names of all controls. But in a rather random order.
I find it way easier to check Wizard.dfm in Inno Setup source code repository. It defines the controls in their hierarchy. So if you search for InstallingPage, you will find that there are these controls:
object FInstallingPage: TNewNotebookPage
object FFilenameLabel: TNewStaticText
...
end
object FStatusLabel: TNewStaticText
...
end
object FProgressGauge: TNewProgressBar
...
end
end
For a use in Pascal Script, drop the F prefix (e.g. instead of FFilenameLabel, use FilenameLabel).

Attach data element to tkinter Listbox element

I am using tkinter with python 3.2
I am making an audio tag editor, and need a way to display the audio files after the user imports them. I am using a Listbox to do this. For the string I am passing into the insert method, I am using the file name, but I need a way to store the full path. It needs to be associated with the list element it corresponds to, so that when the user selects the element, I can look at the file using the full path and display the current audio tags for editing.
Is there a way to make this kind of association, so that every list element points to a data structure of some sort (string containing the file path in this example)? I can trigger the logic to access it with a binding on the listbox itself, but I need to know how to associate the data structure with each list element.
to get more information on the methods of the listbox you can use this reference.
You can use a dict to associate the file names to their full paths:
files_to_show = {os.path.basename(name):name
for name in FULL_PATHS_SOURCE}
then on the listbox you can use the .curselection() to get the indices of the current selection then the .get() method to get the text for each entry:
(listbox.get(i) for i in listbox.curselection())
then to get the full path just look it up in the dict:
selected_full_paths = [files_to_show[listbox.get(i)]
for i in listbox.curselection()]
or more verbosely:
selected_full_paths = []
for selected_i in listbox.curselection():
selected_text = listbox.get(i)
full_path = files_to_show[selected_text]
selected_full_paths.append(full_path)

How to change persistence property of cq:inplaceEditing

I wish to use cq:inplaceEditing to modify a property on my JCR whenever it is used by the AEM authors. Unfortunately, I do not know how to modify the name of the property that it actually modifies in the JCR. It appears that it only modifies the value of the property "text" by default.
For my purposes, I want to use its rich-text-editing for properties that have names I define, not just the default name "text."
The image at this link shows the tree which contains the cq:inplaceEditing (courtesy of CRXDE):
These are the attributes of cq:editConfig:
These are the attributes of cq:inplaceEditing:
...and this is what a content node of my JCR looks like when I use the inplaceEditor. I've blotted out the names of some properties for potential security reasons. Note that the "text" property below was changed when I used the inplaceEditor. Also note that I want to be able to define the property name that the inplaceEditor changes, rather than just the "text" property:
Is there a way to use a different property name instead of "text"?
-----------EDIT----------
After changing the property "textPropertyName" to the property that I am searching for, it still doesn't appear to actually modify the behavior of the inplaceEditor. It still only modifies the "text" property of my JCR nodes instead of the one that I put in the "textPropertyName" attribute.
This picture contains the attributes of my cq:InplaceEditingConfig:
The picture below contains the attributes of the JCR node at the path specified in the "configPath" variable in the picture above. Note that I set the textPropertyName attribute in this node and the text component still modifies the default attribute "text" instead of the one specified:
Finally, the picture below shows the contents of my JCR tree inside of the text component.
-----------ANOTHER EDIT----------
I discovered that the inline text editor was persisting the correct property after I had switched to the classic UI. For some reason, it doesn't work correctly with the touch UI.
How to find it
The inplace editing capability is defined by subclasses of CQ.ipe.InplaceEditing function. You can find it easily by just searching for editorType through the CRXDE tool.
Searching for the CQ.ipe.InplaceEditing returns multiple results such as CQ.ipe.TextEditor that at the very end of the script registers desired editorType i.e.: CQ.ipe.InplaceEditing.register("text", CQ.ipe.TextEditor);
The answer
Reading through the editor code you can find the first configurable property called textPropertyName which according to it's documentation is just what you are looking for. Combining it with the inplace configuration node (see Adobe's documentation) it is the solution for your case.
An example
You can try it by yourself on an instance of Geometrixx component.
First go to CRXDE and find Geometrixx Text component: /apps/geometrixx-gov/components/text.
Notice /apps/geometrixx-gov/components/text/cq:editConfig/cq:inplaceEditing#configPath property value.
Find /apps/geometrixx-gov/components/text/dialog/items/tab1/items/text resource and add new property: textPropertyName=myPropertyName.
Then just open the Geometrixx Gov page add Geometrixx Text component, edit it inplace and look into the Network console. You'll notice POST request with the altered parameter name
edit after TouchUI clarification
TouchUI case
If you want to achieve the same for TouchUI interface it doesn't go so easy, unfortunately. The text inplace editor for TouchUI is defined by /libs/cq/gui/components/authoring/clientlibs/editor/js/editors/InlineTextEditor.js.
Searching for "text" gives you an overview how hardcoded is this property. For AEM 6.1 (on which I'm testing it) you can find it's occurence in the ns.persistence.readParagraphContent function where the initialContent is extracted from the resource JSON map. Another occurence can be found in finishInlineEdit and addHistoryStep methods. Changing all three occurences of "text" to your value brings expected outcome.
This is obviously non-acceptable - it's a platform-wide change and will affect other (incl. ootb) components where it might no be expected. The simplest would be to just copy-paste whole editor into your clientlib and register the editor into a new name - see last couple of lines: ns.editor.register. If you feel comfortable in JS, it might be worth to extend this editor and alter just three methods that are affected.
As of AEM 6.3, the textPropertyName works correctly with the out-of-the-box PlainTextEditor.js
The property needs to be set on a config node under the cq:InplaceEditingConfig
Note – the source of the editor can now be found at:
/libs/cq/gui/components/authoring/editors/clientlibs/core/inlineediting/js/PlainTextEditor.js

Resources