Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:geany_and_django [2012/08/29 19:37] – add Django tags styling information enricohowtos:geany_and_django [2014/02/02 10:49] (current) – Add an example for fne tuned styling enrico
Line 21: Line 21:
 http://www.drhevans.com/blog/posts/261-enabling-django-template-syntax-highlighting-in-geany/)) http://www.drhevans.com/blog/posts/261-enabling-django-template-syntax-highlighting-in-geany/))
  
-<code ini>+<file ini ~/.config/geany/filedefs/filetypes.html>
 [lexer_properties] [lexer_properties]
 lexer.html.django=1 lexer.html.django=1
-</code>+</file>
  
 More information about this file, its format and the path, e.g. on Windows, More information about this file, its format and the path, e.g. on Windows,
Line 46: Line 46:
 will be styled with //python_identifier// and the spaces between with will be styled with //python_identifier// and the spaces between with
 //python_default//. //python_default//.
 +
 +Example:
 +
 +<file ini ~/.config/geany/filedefs/filetypes.html>
 +[styling]
 +# foreground;background;bold;italic or named_style,bold,italic
 +html_asp=#ff0000
 +python_identifier=keyword_1,italic
 +python_default=default
 +</file>
 +
 +The example above makes ''{%'' and ''%}'' styled in red (#ff0000) and the words in between will be styled with the named-style //keyword_1// (which is by default dark blue) and renders it in italic.
 +
  
 For more information about configuring styles, please check the manual [[http://www.geany.org/manual/current/index.html#filetype-configuration|Geany manual, section Filetype configuration]]. For more information about configuring styles, please check the manual [[http://www.geany.org/manual/current/index.html#filetype-configuration|Geany manual, section Filetype configuration]].
Line 100: Line 113:
 Tags for django (version 1.4.1) can be found [[http://wiki.geany.org/_media/tags/django1.4.1.py.tags|here]]. For information on using tag files, see the [[http://www.geany.org/manual/current/index.html#tags|Tags section]] of the [[http://www.geany.org/manual/current/index.html|Geany User Manual]]. Tags for django (version 1.4.1) can be found [[http://wiki.geany.org/_media/tags/django1.4.1.py.tags|here]]. For information on using tag files, see the [[http://www.geany.org/manual/current/index.html#tags|Tags section]] of the [[http://www.geany.org/manual/current/index.html|Geany User Manual]].
  
-{{tag>howto python django snippets}}+===== Live Preview in Geany ===== 
 + 
 +Using the great //Web helper// plugin (from the [[http://plugins.geany.org|Geany-Plugins]] package) 
 +you can view and test your site directly in Geany without switching to an external browser. 
 + 
 +Simply enable the //Web helper// plugin in Geany's plugin manager dialog, open it preferences dialog 
 +and enable the option "Browser auto reload" (to automatically reload the page when you save a file in Geany). 
 + 
 +Then you will get a new tab "Web preview" in the left message window (or whereever you configured the plugin 
 +to show up) and you can enter any weg page address, e.g. those of your currently edited Django project. 
 +Below is a screenshot demonstrating the plugin: the opened web page on the left, the template code on the right 
 +and in the terminal window at the bottom, Django's runserver command is running: 
 + 
 +{{ :howtos:geany_webhelper_django.png?550 |}} 
 + 
 +This way you can edit your Django and template code in Geany as usual and have it automatically shown 
 +as web page in the //Web helper// plugin without the need of switching to an external browser, and 
 +the Django debug server can also be ran in Geany, using the embedded terminal. 
 + 
 + 
 +===== Twig/Symfony2 Support ===== 
 + 
 +If you want to add detection/highlighting of [[http://en.wikipedia.org/wiki/Twig_%28template_engine%29|Twig/Symfony2]] files (based on Django's templates) when opening in Geany, add ''*.html.twig'' to the ''HTML'' key in the ''filetype_extensions.conf'' file. For more information on ''filetype_extensions.conf'', see the [[http://www.geany.org/manual/dev/index.html#filetype-extensions|Filetype extensions section]] of the [[http://www.geany.org/manual/current/index.html|Geany User Manual]]. 
 + 
 +{{tag>howto python django twig symfony2 snippets}}
Print/export