Coder Social home page Coder Social logo

ascii-decorator's Introduction

ASCII Decorator

Features  |  Installation  |  Usage  |  Configuration  |  Credits

 

ASCII Decorator is a simple plugin implementation of pyfiglet for Sublime Text 3pyfiglet is a full port of FIGlet into pure python.  FIGlet is a program that generates text banners, in a variety of typefaces, composed of letters made up of conglomerations of smaller ASCII characters.

Or simply:

    __________________     __         __                   __  __    _
   / ____/  _/ ____/ /__  / /_   ____/ /___  ___  _____   / /_/ /_  (_)____
  / /_   / // / __/ / _ \/ __/  / __  / __ \/ _ \/ ___/  / __/ __ \/ / ___/
 / __/ _/ // /_/ / /  __/ /_   / /_/ / /_/ /  __(__  )  / /_/ / / / (__  ) _ _
/_/   /___/\____/_/\___/\__/   \__,_/\____/\___/____/   \__/_/ /_/_/____(_|_|_)

Features

Font Selector & Font Favorites

See a live preview of the first selected region and convert all selected regions to the chosen font upon execution.
Font Selector shows all fonts by name, while Font Favorites shows your customized list of frequently used fonts.

By default, Font Favorites comes with a list of searchable header styles that can be used in the following ways:

─── By Size ───

FontFavorites_BySize

─── By Style ───

FontFavorites_ByStyle

Generate Font Test

Creates a new document which shows your selected text ( or "Lorem Ipsum" ) in all available fonts, so you can choose the one you like best!

GenerateFontTest_SelectedText

Installation

Install via Package Control for Sublime Text 3 (Preferred)

  • Bring up the command palette:
  • Cmd + Shift + P (OSX & Linux)
  • Ctrl + Shift + P (Windows)
  • Select option: Package Control: Install Package
  • Select ASCII Decorator from the list

Install via git

  • In a shell: navigate to the Sublime Text Packages directory
  • Type: git clone https://github.com/viisual/ASCII-Decorator.git

Usage

Command Palette

Bring up the command palette:

  • Cmd + Shift + P (OSX & Linux)
  • Ctrl + Shift + P (Windows)

Type:

  • ASCII Decorator: Default Font
  • ASCII Decorator: Font Selector
  • ASCII Decorator: Font Favorites
  • ASCII Decorator: Generate Font Test (Selected Text)
  • ASCII Decorator: Generate Font Test (Lorem Ipsum)

Context Menu

Right-click on your document to access the context menu.

The ASCII Decorator sub-menu contains:

  • Default Font
  • Font Selector
  • Font Favorites
  • Generate Font Test (Selected Text)

Key Bindings

One key binding is included for Default Font:

  • Super + Shift + K (OSX & Linux)
  • Alt + Shift + K (Windows)

See sublime-commands for a list of additional commands that can be mapped to key bindings.

Selections

Each command will convert all selected regions to ASCII text.

Regions are handled in the following ways:

  • Caret with no selection:
  • the entire line's text will be converted
  • Selection on a single line:
  • only selected text will be converted.
  • Selection that spans multiple lines:
  • each line that contains text will be converted

Configuration

You can define your sublime-settings preferences @:
Menu > Preferences > Package Settings > ASCII Decorator > Settings - User

Custom key bindings can be set @:
Menu > Preferences > Package Settings > ASCII Decorator > Key Bindings - User

Credits

Primary development & documentation by: Christopher Jones

Packaging of pyfiglet by: Peter Waller
Various enhancements by: Stefano Rivera & Enteleform
Ported to Sublime Text 3 by: Sascha Wolf

                        _|_|  _|            _|              _|
_|_|_|    _|    _|    _|            _|_|_|  _|    _|_|    _|_|_|_|
_|    _|  _|    _|  _|_|_|_|  _|  _|    _|  _|  _|_|_|_|    _|
_|    _|  _|    _|    _|      _|  _|    _|  _|  _|          _|
_|_|_|      _|_|_|    _|      _|    _|_|_|  _|    _|_|_|      _|_|
_|              _|                      _|
_|          _|_|                    _|_|

ascii-decorator's People

Contributors

alexocode avatar ccll avatar enteleform avatar ericaro avatar facelessuser avatar jimmytinsley avatar joelpt avatar portablesheep avatar viisual avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ascii-decorator's Issues

Sublime 3 Support

Doesn't seem to work in Sublime Text 3. The menu option is grayed out and the keyboard shortcut seems unavailable.

Not working on ST2 - UnicodeDecodeError

When running the command in ST2 on OSX 10.9 I get:

Traceback (most recent call last):
  File "./sublime_plugin.py", line 337, in run_
  File "./ASCII-Decorator.py", line 44, in run
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb4 in position 5: ordinal not in range(128)

This seems due to a ST internal bug. I've tried a solution similar to this by modifying /Packages/Default/exec.py

    for k, v in proc_env.iteritems():
            path_vars = os.path.expandvars(v.decode(sys.getfilesystemencoding()))
            if isinstance(path_vars, unicode):
                path_vars = path_vars.encode(sys.getfilesystemencoding())
            proc_env[k] = path_vars

but doesn't work.

I'm wondering why this is happening only with this packages and if someone has found a solution or a workaround.

Thanks

First line does not align.

Select an A, press win-shift-k, this is the result:

    ___ 
       /   |
      / /| |
     / ___ |
    /_/  |_|

(Windows XP, Sublime Text 2: 2181)

Add font

Hi, could you add following font ?

It's based on ANSI Shadow font, but without shadows and only 5 rows by character

ANSI.flf :

flf2a$ 5 5 13 -1 7 0 0 0
Font Author: ?

More Info:

https://web.archive.org/web/20120819044459/http://www.roysac.com/thedrawfonts-tdf.asp

FIGFont created with: http://patorjk.com/figfont-editor
$  $@
$  $@
$  $@
$  $@
$  $@@
██ @
██ @
██ @
   @
██ @@
██ ██   @
██ ██   @
        @
        @
        @@
 ██  ██  @
████████ @
 ██  ██  @
████████ @
 ██  ██  @@
▄▄███▄▄  @
██ █     @
███████  @
   █ ██  @
▀▀▀█▀▀▀  @@
██  ██ @
   ██  @
  ██   @
 ██    @
██  ██ @@
  ███      @
 █   █     @
  ███      @
██  ██▀    @
 ████ ▀▄   @@
 █@
█ @
  @
  @
  @@
 ██ @
██  @
██  @
██  @
 ██ @@
██  @
 ██ @
 ██ @
 ██ @
██  @@
      @
▄ ██ ▄@
 ████ @
▀ ██ ▀@
      @@
      @
  ██  @
██████@
  ██  @
      @@
   @
   @
   @
   @
▄█ @@
      @
      @
█████ @
      @
      @@
   @
   @
   @
   @
██ @@
    ██ @
   ██  @
  ██   @
 ██    @
██     @@
 ██████  @
██  ████ @
██ ██ ██ @
████  ██ @
 ██████  @@
 ██ @
███ @
 ██ @
 ██ @
 ██ @@
██████  @
     ██ @
 █████  @
██      @
███████ @@
██████  @
     ██ @
 █████  @
     ██ @
██████  @@
██   ██ @
██   ██ @
███████ @
     ██ @
     ██ @@
███████ @
██      @
███████ @
     ██ @
███████ @@
 ██████  @
██       @
███████  @
██    ██ @
 ██████  @@
███████ @
     ██ @
    ██  @
   ██   @
   ██   @@
 █████  @
██   ██ @
 █████  @
██   ██ @
 █████  @@
 █████  @
██   ██ @
 ██████ @
     ██ @
 █████  @@
   @
██ @
   @
██ @
   @@
   @
██ @
   @
▄█ @
▀  @@
    ██ @
  ██   @
██     @
  ██   @
    ██ @@
        @
        @
████████@
        @
████████@@
██     @
  ██   @
    ██ @
  ██   @
██     @@
██████  @
     ██ @
  ▄███  @
  ▀▀    @
  ██    @@
 ██████  @
██    ██ @
██ ██ ██ @
██ ██ ██ @
 █ ████  @@
 █████  @
██   ██ @
███████ @
██   ██ @
██   ██ @@
██████  @
██   ██ @
██████  @
██   ██ @
██████  @@
 ██████ @
██      @
██      @
██      @
 ██████ @@
██████  @
██   ██ @
██   ██ @
██   ██ @
██████  @@
███████ @
██      @
█████   @
██      @
███████ @@
███████ @
██      @
█████   @
██      @
██      @@
 ██████  @
██       @
██   ███ @
██    ██ @
 ██████  @@
██   ██ @
██   ██ @
███████ @
██   ██ @
██   ██ @@
██ @
██ @
██ @
██ @
██ @@
     ██ @
     ██ @
     ██ @
██   ██ @
 █████  @@
██   ██ @
██  ██  @
█████   @
██  ██  @
██   ██ @@
██      @
██      @
██      @
██      @
███████ @@
███    ███ @
████  ████ @
██ ████ ██ @
██  ██  ██ @
██      ██ @@
███    ██ @
████   ██ @
██ ██  ██ @
██  ██ ██ @
██   ████ @@
 ██████  @
██    ██ @
██    ██ @
██    ██ @
 ██████  @@
██████  @
██   ██ @
██████  @
██      @
██      @@
 ██████  @
██    ██ @
██    ██ @
██ ▄▄ ██ @
 ██████  @@
██████  @
██   ██ @
██████  @
██   ██ @
██   ██ @@
███████ @
██      @
███████ @
     ██ @
███████ @@
████████ @
   ██    @
   ██    @
   ██    @
   ██    @@
██    ██ @
██    ██ @
██    ██ @
██    ██ @
 ██████  @@
██    ██ @
██    ██ @
██    ██ @
 ██  ██  @
  ████   @@
██     ██ @
██     ██ @
██  █  ██ @
██ ███ ██ @
 ███ ███  @@
██   ██ @
 ██ ██  @
  ███   @
 ██ ██  @
██   ██ @@
██    ██ @
 ██  ██  @
  ████   @
   ██    @
   ██    @@
███████ @
   ███  @
  ███   @
 ███    @
███████ @@
███ @
██  @
██  @
██  @
███ @@
██    @
 ██   @
  ██  @
   ██ @
    ██@@
███ @
 ██ @
 ██ @
 ██ @
███ @@
 ███  @
██ ██ @
      @
      @
      @@
        @
        @
        @
        @
███████ @@
██ @
 ██@
   @
   @
   @@
 █████  @
██   ██ @
███████ @
██   ██ @
██   ██ @@
██████  @
██   ██ @
██████  @
██   ██ @
██████  @@
 ██████ @
██      @
██      @
██      @
 ██████ @@
██████  @
██   ██ @
██   ██ @
██   ██ @
██████  @@
███████ @
██      @
█████   @
██      @
███████ @@
███████ @
██      @
█████   @
██      @
██      @@
 ██████  @
██       @
██   ███ @
██    ██ @
 ██████  @@
██   ██ @
██   ██ @
███████ @
██   ██ @
██   ██ @@
██ @
██ @
██ @
██ @
██ @@
     ██ @
     ██ @
     ██ @
██   ██ @
 █████  @@
██   ██ @
██  ██  @
█████   @
██  ██  @
██   ██ @@
██      @
██      @
██      @
██      @
███████ @@
███    ███ @
████  ████ @
██ ████ ██ @
██  ██  ██ @
██      ██ @@
███    ██ @
████   ██ @
██ ██  ██ @
██  ██ ██ @
██   ████ @@
 ██████  @
██    ██ @
██    ██ @
██    ██ @
 ██████  @@
██████  @
██   ██ @
██████  @
██      @
██      @@
 ██████  @
██    ██ @
██    ██ @
██ ▄▄ ██ @
 ██████  @@
██████  @
██   ██ @
██████  @
██   ██ @
██   ██ @@
███████ @
██      @
███████ @
     ██ @
███████ @@
████████ @
   ██    @
   ██    @
   ██    @
   ██    @@
██    ██ @
██    ██ @
██    ██ @
██    ██ @
 ██████  @@
██    ██ @
██    ██ @
██    ██ @
 ██  ██  @
  ████   @@
██     ██ @
██     ██ @
██  █  ██ @
██ ███ ██ @
 ███ ███  @@
██   ██ @
 ██ ██  @
  ███   @
 ██ ██  @
██   ██ @@
██    ██ @
 ██  ██  @
  ████   @
   ██    @
   ██    @@
███████ @
   ███  @
  ███   @
 ███    @
███████ @@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@

TypeError: int() argument must be a string or a number, not 'NoneType'

When running "Default font".

Settings set are "indent using spaces" and "Spaces: 4"

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1082, in run_
    return self.run(edit, **args)
  File "/Users/hans/Documents/programming/configs/sublime/Packages/ASCII Decorator/ASCII Decorator.py", line 396, in run
    newSelections.append( self.decorate( self.edit, line_A ) )
  File "/Users/hans/Documents/programming/configs/sublime/Packages/ASCII Decorator/ASCII Decorator.py", line 580, in decorate
    output = self.fix_whitespace( original, output, currentSelection )
  File "/Users/hans/Documents/programming/configs/sublime/Packages/ASCII Decorator/ASCII Decorator.py", line 616, in fix_whitespace
    tab_size = int(settings.get('tab_size', 8))
TypeError: int() argument must be a string or a number, not 'NoneType'

Line selection does not account for indentation on first line

ASCII-Decorator used to disable the command unless text was selected. Recent pulls introduced an idea of when there is no selection, the entire line is selected. The problem with this is it does not take into account the text's on that line's current indentation.

Assuming I have some code and want to turn last line in to ASCII art:

        # Indent the prefixed version to the right level
        settings = self.view.settings()
        use_spaces = settings.get('translate_tabs_to_spaces')
        tab_size = int(settings.get('tab_size', 8))
        test

This is what I get:

        # Indent the prefixed version to the right level
        settings = self.view.settings()
        use_spaces = settings.get('translate_tabs_to_spaces')
        tab_size = int(settings.get('tab_size', 8))
#                                                        /$$                           /$$    
        #                                                       | $$                          | $$    
        #                                                      /$$$$$$    /$$$$$$   /$$$$$$$ /$$$$$$  
        #                                                     |_  $$_/   /$$__  $$ /$$_____/|_  $$_/  
        #                                                       | $$    | $$$$$$$$|  $$$$$$   | $$    
        #                                                       | $$ /$$| $$_____/ \____  $$  | $$ /$$
        #                                                       |  $$$$/|  $$$$$$$ /$$$$$$$/  |  $$$$/
        #                                                        \___/   \_______/|_______/    \___/  
        #                                                                                             
        #                                                                                             
        #                                                                                             

Line selection should account for the indentation and not include that in the figlet conversion.

When I get time, I will probably address this.

Menu issue and path issue

  1. Current plugin as bogus entries for the Menu file. The user settings entries do not point to the user folder. The default settings do not point to the path you have choosen in Package Control.
  2. In order to get the plugin to function I had to modify the init.py file in pyfiglet. This was on Windows.
def setFont(self, **kwargs): 
    self.dir = os.path.join(sublime.packages_path(), 'ASCII-Decorator', 'pyfiglet', 'fonts')
    # if kwargs.has_key('dir'):
    #     self.dir = kwargs['dir']

Delete Trailing White Spaces

Whenever I convert any text to the ASCII some of them have trailing white spaces which is annoying.

Could you make it delete the trailing white spaces.

Thanks.

Couldn't load pkg_resources

This is really not an issue but there is a message in Console:

reloading plugin ASCII Decorator.ASCII Decorator
Couldn't load pkg_resources

Why is that happening?

not founded font files

Then i install this package via PackageControl or via «git clone», installation path is ../ASCII-Decorator, but Sublime searching in this path ../ASCII Decorator (with space). If i rename package folder as an «ASCII Decorator» — thats all right

A way to set space between characters

There is any already defined way to set the space between chars?
Some of my team uses Atom and others uses Sublime.
Atom render Colossal font with a space between chars, but this plugin does not, this generates a hard to read text.
I can implement that and send a PR if not already available.

Not working

I, and a coworker, have installed both ways and have been unable to get it to function. After install the menu item shows up but is grayed out and the hot key does not work either. Using sublime text 2 and 3 on mac.

broken but valid path on file system???

Hello

The plugin complains about a file that is on the correct path??
Here is the file requested:
"...\AppData\Roaming\Sublime Text 3\Packages\ASCII Decorator\pyfiglet\fonts\block.flf doesn't exist"

any ideas?

Menus and settings broken on ST2

Menus are broken on ST2 due to trailing commas in JSON. Trailing commas are illegal in the JSON spec. ST3 is more forgiving of these, but ST2 fails on these.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.