Is something like p.a.theming diazo.debug possible with diazo standalone? - plone

With p.a.theming it is possible to use diazo.debug to get an overlay containing your annotated rules. See https://pypi.python.org/pypi/plone.app.theming#theme-debugging
The overlay shows what rules are matched when performing a transform of a specific page of your content - see the image above.
Is something similar possible when running diazo standalone with paster?
That is, is it possible to show info about matched rules when doing a transform?
The diazo command line tools (diazocompiler, diazopreprocessor, diazorun) only show info about compiling your rules to xslt as far as I know - or is more possible?

If you pip install diazo (I'd use a virtualenv), you'll get three command-line scripts:
diazocompiler
diazopreprocessor
diazorun
that will allow you to run all the diazo operations from the command line. You''ll be most interested in diazorun with the runtrace command-line option which will allow you to annotate a rules file with the results of a transformation. It will tell you all you want to know -- and more.

Related

Jupyter link to section

I tried to create an internal link to a heading in a jupyter notebook, using the following. The various answers on SO, such as here don't seem to be working as expected in my notebook. The code below creates a link, but nothing happens when trying to access the link.
[Link to section](#section)
... Some text ...
## Section
An alternative method suggested here does work as expected.
<a href='#section'>Link to section</a>
... Some Text ....
<a id='section'></a>
## Section
Is there a mistake in the first section of code?
Update
After researching the suggestions by Waylan, I came across this example for ipython. Just adding dashes, without using lowercase seems to work.
[Link to section](#section)
becomes
[Link to section](#Section)
There are a couple different factors which could be at play here.
Non-Standard Markdown
The Markdown rules do not specify that the outplay should include an id attribute. However, many implementations create one for you. Some do so out-of-the-box and others only if a specific extension is enabled. You will need to check the documentation for the implementation you are using to see if such a feature is supported and what you need to do to enable it. If such a feature is not available, then the only option is to manually define the ids using raw HTML.
Slug creation method
As there is no standard rule, each implementation which adds the feature does so using their own non-standard method for creating the slug (value of the id attribute). For example, some handle capitalization and/or whitespace differently. You will need to check the documentation for the implementation you are using to find the method used. Alternatively, you could run a draft of the document through the Markdown parser and check for an id attribute and simply use the value. This ensures it will match without needing to know the method used. You may need to use your browser's "view source" feature to determine what id, if any, was assigned to the header.

Unix app to write custom syntax to can check it

well the question is, exist some app or language/etc to write a custom syntax to can check files?
You know, when we works in different places, ppl and projects every one have differents rules to how write, code style and all that things, the idea its can check all this things because at least to me normally i forgot something.
Ideally some app without a heavy GUI, thinking maybe a terminal app, or editors like gedit, avoid plis apps like Eclipse and similars.
For now i need only check simple parts, if you can recommend both a simple/limited app and a complex/full app would be great.
Obvs, if exist a simple/full app, will be better.
Thx.
If what you're looking for is a program that rewrites a source code given a specific coding style, I advise you to take a look at GNU Indent.
If you want to do more complex operations like build an AST and work on it to add things, edit, check for existing dependencies or whatever, you'll want to use a tool like Flex/Bison, Clang, Pyrser, etc.

Passing istanbul flags to grunt-jasmine-node-coverage

I am working on a project that is using the multiline node package. This allows us to create multi-line strings inside of multi-line comment tags.
The problem I am encountering is related to the grunt-jasmine-node-coverage node package.
Normally running istanbul, you can pass in the flag --preserve-comments and it won't strip out comments while processing the coverage information, otherwise it will default to false.
So far I have not been able to find a workaround for passing in this flag in the grunt-jasmine-node-coverage configuration. Is what I am trying to accomplish currently possible?

How can I remove all color information from Grunt output?

I'm a little new to Grunt and am using it in our automated build system (on Windows). When running Grunt manually in the console, the coloring is extremely helpful. However, when running it in an automated setup, it results in color information in the build log, like this:
[4mRunning "sass:all" (sass) task [24m
The extra characters decrease the readability of the build log and I'd like to get rid of them.
I'm aware of the grunt.log.uncolor method for individual strings, but I'm wondering if there's a way to configure Grunt to output all logs without color information or if there's an existing plugin to do this. If not, I'll likely write my own plugin.
I feel like this would be a common occurrence — using Grunt in an automated system where you'd want to read the build log as plain text — so maybe I'm just missing something.
Of course, I finally find the answer right after asking the question...
Use the simple command-line option --no-color.
I was scouring the API but somehow missed the "Using the CLI" section of the documentation.

HTML filtering settings in Plone 4?

Is there a way to configure the HTML filtering settings in Plone 4 through GenericSetup?
Otherwise is there some example code for modifying the HTML filtering settings through Python?
http://collective-docs.plone.org/misc/portal_transforms.html
The portal_transforms example you found is certainly the correct way to make changes to settings that can't be done directly through GenericSetup, but if you want to find out if there's a an xml configuration that will do the job, it's often convenient to use the ZMI to dump all the GS settings. Go to your site's /portal_setup/manage_exportSteps, select Export all steps and then examine the resulting xml files in the download, to find one that contains the settings you're looking for. Not pretty, but surprisingly functional!

Resources