Why doesn't asterisk work in Xcode Quick Help markup? - xcode

As Markup Formatting Reference states, you can use *,+ or - characters as prefixes for markup keywords. For example, take a look at Parameter:
Now, when I try to use *, markup doesn't work:
/**
* Parameter piece: A piece to validate.
* Parameter matchBlock: Called only if necessary.
*/
init(piece: MSPiece?, matchBlock: MatchBlock) { ... }
The above code results in:
But if we put + or - instead of *,
/**
+ Parameter piece: A piece to validate.
- Parameter matchBlock: Called only if necessary.
*/
init(piece: MSPiece?, matchBlock: MatchBlock) { ... }
The documentation will be correct:
Why doesn't * work? It would be actually cool to use an asterisk because /** */ comment stats and ends with asterisk and it would be really neat.

It was a bug and it's fixed in Xcode 10.0.

Related

Multi-bullet Doxygen #note?

In non-Doxygen comments, I often have:
/* Lorem ipsum etc.
*
* Notes:
* - A first note.
* - Some other note note.
*/
But with Doxygen, I have #note (or \note), not #notes). So, should I use multiple #notes, or do I put all notes under the same #note?
The #note command results in a paragraph which format can be customized in the CSS file or in the style file when using Latex. So you can just use the markups like in a "normal" text:
/**
* Bla bla...
*
* #note Even in a note you can use markups:
* - Your first note
* - Youre second note
*
* The note section ends with an empty line or the end of the comment.
*/
You can do it either way; it's really a question of style/preference.
As you pointed out, Doxygen has the #note command, but not #notes. You can create your own command for #notes by editing the Doxyfile, and modifying the ALIASES = tag to read
ALIASES = "notes=#par Notes:\n"
With this, you can put the command #notes in the documentation, which will result in a user-defined paragraph with the heading
Notes:
As pointed out in the Doxygen documentation for the ALIAS tag, you can put \n's in the value part of an alias to insert newlines.

Add a custom block quote for sublime3 for phpdoc

I tried to write like this
{ "keys": ["ctrl+shift+;"], "command": { "characters": "/**#var*/", "block": true} }
But seem it totally not achieving what the simplest thing I try to do.
What I want the shortcut to do is that once triggered, I wish to enter text formatted like this
/**
*#var
*/
Does anyone know how to define such custom shortcut?
Thank you very much!
There are two ways to do this, depending on what functionality you want. If all you want is to print exactly what you indicated, then create the following snippet:
<snippet>
<content><![CDATA[
/**
* #var $0
*/
]]></content>
<tabTrigger>vardoc</tabTrigger>
</snippet>
To do so, create a new file with XML syntax, paste the above exactly as shown, then save the file as Packages/User/vardoc.sublime-snippet where Packages is the directory opened when you select Preferences -> Browse Packages. To trigger the snippet, type vardoc and hit Tab. Your cursor will be positioned where the $0 is in the snippet.
This should work fine, except you'll have to type * if you need a new line, and there's nothing intelligent about it. Instead, what I'd recommend is DocBlockr, a Sublime Text plugin that auto-generates documentation for several languages, including PHP. Typing /** and hitting Tab or Enter will give you
/**
* |
*/
Where | is your cursor position (this is also a built-in Sublime feature, I believe). It can also auto-document functions. If you have
function foo(MyClass $cls,
Array $arr,
$num=42,
$val=false,
$str="sweet function, dude!") {
return $something;
}
and you place your cursor on the line above the function definition and type /** and hit Tab, you'll get
/**
* [foo description]
* #param MyClass $cls
* #param Array $arr
* #param integer $num
* #param boolean $val
* #param string $str
* #return [type]
*/
with [foo description] highlighted so you can enter your own description. Hitting Tab again will subsequently highlight MyClass, Array, etc. so you can alter them if you wish.
More to your question, you can declare a variable
var $foobar = "I love unicorns";
Placing your cursor above that declaration and entering /** Tab will give you
/**
* [$foobar description]
* #var string
*/
There are other features of DocBlockr as well, check out the link above for more details.
I hope this helps!

How to prevent CKEditor replacing spaces with ?

I'm facing an issue with CKEditor 4, I need to have an output without any html entity so I added config.entities = false; in my config, but some appear when
an inline tag is inserted: the space before is replaced with
text is pasted: every space is replaced with even with config.forcePasteAsPlainText = true;
You can check that on any demo by typing
test test
eg.
Do you know how I can prevent this behaviour?
Thanks!
Based on Reinmars accepted answer and the Entities plugin I created a small plugin with an HTML filter which removes redundant entities. The regular expression could be improved to suit other situations, so please edit this answer.
/*
* Remove entities which were inserted ie. when removing a space and
* immediately inputting a space.
*
* NB: We could also set config.basicEntities to false, but this is stongly
* adviced against since this also does not turn ie. < into <.
* #link http://stackoverflow.com/a/16468264/328272
*
* Based on StackOverflow answer.
* #link http://stackoverflow.com/a/14549010/328272
*/
CKEDITOR.plugins.add('removeRedundantNBSP', {
afterInit: function(editor) {
var config = editor.config,
dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
if (htmlFilter) {
htmlFilter.addRules({
text: function(text) {
return text.replace(/(\w) /g, '$1 ');
}
}, {
applyToAll: true,
excludeNestedEditable: true
});
}
}
});
These entities:
// Base HTML entities.
var htmlbase = 'nbsp,gt,lt,amp';
Are an exception. To get rid of them you can set basicEntities: false. But as docs mention this is an insecure setting. So if you only want to remove , then I should just use regexp on output data (e.g. by adding listener for #getData) or, if you want to be more precise, add your own rule to htmlFilter just like entities plugin does here.
Remove all but not <tag> </tag> with Javascript Regexp
This is especially helpful with CKEditor as it creates lines like <p> </p>, which you might want to keep.
Background: I first tried to make a one-liner Javascript using lookaround assertions. It seems you can't chain them, at least not yet. My first approach was unsuccesful:
return text.replace(/(?<!\>) (?!<\/)/gi, " ")
// Removes but not <p> </p>
// It works, but does not remove `<p> blah </p>`.
Here is my updated working one-liner code:
return text.replace(/(?<!\>\s.)( (?!<\/)|(?<!\>) <\/p>)/gi, " ")
This works as intended. You can test it here.
However, this is a shady practise as lookarounds are not fully supported by some browsers.
Read more about Assertions.
What I ended up using in my production code:
I ended up doing a bit hacky approach with multiple replace(). This should work on all browsers.
.trim() // Remove whitespaces
.replace(/\u00a0/g, " ") // Remove unicode non-breaking space
.replace(/((<\w+>)\s*( )\s*(<\/\w+>))/gi, "$2<!--BOOM-->$4") // Replace empty nbsp tags with BOOM
.replace(/ /gi, " ") // remove all
.replace(/((<\w+>)\s*(<!--BOOM-->)\s*(<\/\w+>))/gi, "$2 $4") // Replace BOOM back to empty tags
If you have a better suggestion, I would be happy to hear 😊.
I needed to change the regular expression Imeus sent, in my case, I use TYPO3 and needed to edit the backend editor. This one didn't work. Maybe it can help another one that has the same problem :)
return text.replace(/ /g, ' ');

Doxygen #file removes other command formatting except #brief

if I have a c header file with a doxygen comment:
/*!
* #file MyHeaderFile.h
* #brief Brief header file description
* #author Me Myself
* #date 2012.4.16
*/
This results in html like this:
This same syntax works fine in function comments:
Am I doing something wrong or is this all that is supported?
EDIT: normal function comment:
/*!
* #brief This function does things
*
* #author Me Myself
* #date 2012.4.16
*
* #returns void
*/
void MyFunctionThing(void)
{
}
Although I could not really reproduce the problem given your example, this is most likely the result of Markdown support (introduced in version 1.8.0), in particular the code blocks feature.
Options you can try to avoid/workaround this:
Set MARKDOWN_SUPPORT to NO in the config file
Indent the text in you comment block with less than 4 spaces (after the *).

Magento - how to hide the time in the transctional Emails

I'm searching how to hide the time and show only the date in the "new order" email:
I have seen that it's generated with this code :
({{var order.getCreatedAtFormated(''long'')}})
but I don't find a solution how to show only the date.
Thanks for help.
Supported formatting types are: long, medium , full, short
thanks for the comment:
HOW SHOULD I HELP MYSELF FINDING THIS OUT
first thing if you don't know how to interact wit method search for it in codebase as this reveals in what file the method is defined and you can see what parameters it takes in and how it processes the parameters
grep ' getCreatedAtFormated' app/code/ -rsn
app/code/core/Mage/Sales/Model/Order.php:1988: public function getCreatedAtFormated($format)
ok, now we found that file , open up and see the line 1988 has the method
/**
* Get formated order created date in store timezone
*
* #param string $format date format type (short|medium|long|full)
* #return string
*/
public function getCreatedAtFormated($format)
{
return Mage::helper('core')->formatDate($this->getCreatedAtStoreDate(), $format, true);
}
cool now you see it is actually using core helper's formatDate method. Go ahead open up that file
app/code/core/Mage/Core/Helper/Data.php:135: public function formatDate($date=null, $format='short', $showTime=false)
you can see from grep that it takes in third parameter that you can't pass to that method as it wraps this with forced in value.
So your solution is to use the helper and get the variable order.getCreatedAtStoreDate() and pass it to helpers formatting method

Resources