Auto-indent Between Tags in Brackets - adobe-brackets

Typing <html> automatically creates </html> after your cursor in Brackets:
But when you press enter it just puts the closing tag on the next line:
To begin adding code I need to press (enter * 2), up arrow, tab (too many steps).
How can I do this automatically so that pressing enter results in:
Couldn't find an extension that does this.
This works natively in CSS, why not in HTML?

UPDATE: arsakasra's comment works really well!
Press enter followed by (CMD on Mac or CTRL on PC) + shift + enter
I've been playing around with the preferences and added the following to my brackets.json file (access in Menu Bar: Debug: "Open Preferences File").
"closeTags": {
"dontCloseTags": ["br", "hr", "img", "input", "link", "meta", "area", "base", "col", "command", "embed", "keygen", "param", "source", "track", "wbr"],
"indentTags": ["ul", "ol", "div", "section", "table", "tr"],
}
dontCloseTags are tags such as <br> which shouldn't be closed.
indentTags are tags that you want to automatically create a new
indented line - add more as needed!
(any tags that aren't in above arrays will self-close on the
same line)

https://github.com/shumpei/brackets-autoindent-extension
Here is a link for an extension on the Brackets that add the Auto-Indent feature.

Related

How to Preserve White Space and line breaks in Django?

I am making a project where I want to display a user's code. I am using Django's forms. But when I post that form, the form doesn't preserve the white space and the line breaks.
Can you please help me?
# this is my form
class VigenereCipherDiscussForm(forms.ModelForm):
class Meta:
model = VigenereCipherDiscuss
fields = ['text', 'share']
widgets = {
"text": forms.Textarea(attrs={"class":"form-control", "rows":4}),
"share": forms.Textarea(attrs={"class":"form-control", "rows":5, "placeholder": "Put in your cipher text or code in here to share with others"})
}
# (stackoverflow preserves the line breaks, the "class Meta" is indented nicely)
If i have this code:
x = 2
if x == 2:
return "2"
else:
return None
# I want this code to be outputted in the form the way it is right now!
But django gives me
x=2 if x==2: return "2" else return None
Use linebreak
change your code to:
x=2\nif x==2:\nreturn "2"\nelse:\nreturn None
and in template:
{{ value|linebreaks }}
you can use tinymce to create a user's code.it will save it in html.
and in your .html add this:{{ value|linebreaks|safe }}
the tinymce Like this:

How to prevent awesome from changing focus when a mouse click occurs?

I'm using AwesomeWM 4.2 under Xfce4.
I'm using xfpanel. In rc.lua, I have done the following to prevent the xfpanel getting focus:
-- from https://github.com/zhangkun83/awesome-config/blob/d947e70041fad3e5f34bb832162cacaac62736b1/rc.lua#L492)
{ rule = { type = "dock" },
properties = {
border_width = 0,
titlebars_enabled = false,
focusable = false
}},
This works insofar as now, I cannot put the focus on the xfpanel client using keyboard conrtrols.
However, when I click somewhere on the xfpanel (e.g., open the whisker menu, or click on the NetworkManager applet, ...), Awesome makes xfpanel the focused client.
I don't like this behavior because it means I have to explicitly shift focus back to where I was working before.
Is there a way to prevent awesome from changing focus when a mouse click
occurs?
If you don't want the default settings for docks, make that rule ignore "dock" clients. With this I mean: Find the awful.rules-rule with rule = {}, and change this into rule = {}, except = { type = "dock" },.
Since this default rule sets up button bindings (buttons = clientbuttons), this means that dock-clients will no longer get these button bindings.

AmCharts Serial: How to break lines by long labels?

I have a horizontal SerialChart with AmCharts:
When displayed at a desktop browser, everything looks fine:
But when i'm resizing, the bars are getting smaller, but the text
stays the same:
Is there a way of resizing the categoryAxis as well so i see the bars
in a mobile screen? Or move the Labels on top of the bars when i'm
viewing them on mobile?
Try this, it will help to you.
"categoryAxis": {
"ignoreAxisWidth": true,
"autoWrap": true
}
If you look at this example I have just done, http://jsfiddle.net/17xraeue/, you will see that I have added a line break in standard HTML tags, BR, into the name.
"dataProvider": [
{
"country": "All Other<br>Countries",
"visits": 441,
"color": "#CD0D74"
}
]
To make this work dymanically without having to add line breaks in yourself you could also use a scripting langauge such as PHP to add them for you.
<?
//See http://php.net/manual/en/function.wordwrap.php for more details
//wordwrap([text string], [number of characters before line break], [HTML to use for line break]);
echo wordwrap("this is my text string", 20, "<br />");
?>

a href and html.actionlink size not same

If i use below , button display bigger.
<i class="icon-plus"></i>Add
If i use below , button display smaller than above code.
#Html.ActionLink("Add", "xx", "Law", new { _lawfileid = -1, baseappid = ((ObjectModelLibrary.Law)ViewData["currentLaw"]).LawID }, new { #class = "btn btn-primary icon-plus" })
How can i change Html.Actionlink like a href i ?
What is difference between actionlink and href or how can i set same size for both ?
The reason for your issue is that in the first line of code you have an element inside another element. Whereas in the second line of code you have a single element with extra class.
Similar question is already answered on stackoverflow. Please find the link below
Create an ActionLink with HTML elements in the link text
Since you need to build an element inside an element use #Url.Action as mentioned in the above link.

Change the font and its size in a Tcltk GUI

How can I change the default font and its size from a menu in a GUI I'm creating using Tcltk? The example below has only one menu called 'File', but in my GUI, It will have more than that. So all of them have to be re-sized. Is there any way to do that for my entire GUI?
Thank you in advance!
require(tcltk)
readCsv <- function(){
myval <- tkgetOpenFile()
mydata <- read.csv(paste(as.character(myval), collapse = " "))
assign("myData", mydata, envir = .GlobalEnv)
}
tt <- tktoplevel()
topMenu <- tkmenu(tt)
tkconfigure(tt, menu = topMenu)
fileMenu <- tkmenu(topMenu, tearoff = FALSE)
tkadd(fileMenu, "command", label = "Quit", command = function() tkdestroy(tt))
tkadd(fileMenu, "command", label = "Load", command = function() readCsv())
tkadd(topMenu, "cascade", label = "File", menu = fileMenu)
tkfocus(tt)
The default font for menus is a named font; TkMenuFont on most platforms (and menu on OSX, where you really shouldn't change it). This is usually mapped to the correct system default font for menus. However, if you do want to change it, you're still recommended to use a named font (which is what is used in a font object in R TclTk) following the pattern on this page except that you're applying the font to a menu widget instead of a label.
# Example to show how to do it
fontMenu <- tkfont.create(family="times",size=24,weight="bold",slant="italic")
fileMenu <- tkmenu(topMenu, tearoff = FALSE, font = fontMenu)
The only platform where you shouldn't do this at all is OSX, where menus work rather differently (except at the script level; there's a lot of differences being hidden under the covers!)
Yes, using the option database.
See this question for an example showing the option database for use with a button, but works the same for menus:
https://stackoverflow.com/questions/20960107/is-there-a-way-to-have-a-global-style-for-button-in-tcl

Resources