Git Product home page Git Product logo

atom-lorem's Introduction

Lorem package

A simple and powerful lorem ipsum generator for Atom editor. Fully configurable from the package settings.

Ported with love from the Lorem Ipsum brackets plugin by lkcampbell

Lorem Overview


How to Use

Important: For basic lorem ipsum text using the default settings just use the keybind alt+l.

Important: This README states that you need to use _ to separate the arguments however you can use any characters you want by adding them to the config on the package settings page.

You can also add options to the lorem command with an underscore character followed by the option name. For example: lorem_wrap40. Multiple options can also be chained together. For example, typing lorem_html_wrap40 and then pressing the alt+l will give you html formatted Lorem Ipsum text and a word wrap width of 40 characters. Using an unrecognized option will insert an error message into the document. Using more than one underscore character in a row (e.g. lorem__html___p3) will insert an error message into the document.

Note: Options to the far right of the chain always have the highest priority. If two options in the chain conflict with each other, the option on the right will have precedence. For example, the command lorem_nowrap_wrap40 will insert Lorem Ipsum text with a word wrap width of 40 characters and the command lorem_wrap40_nowrap will insert Lorem Ipsum text with no word wrapping.


List of Current Options

alt+l: Simply using the keybind alt+l will insert lorem ipsum text based on your personal configuration. The configuration can be changed in the package settings from the package menu.

Basic Example

_p[count]: Inserts a certain number of random Lorem Ipsum paragraphs into the current document. The count option indicates how many paragraphs to insert. For example, lorem_p3 will insert three paragraphs into the document. If the count option is not provided, the default number of paragraphs will be inserted. If the type of Lorem Ipsum text is not specified, the extension will generate paragraphs by default.

Paragraph Example

_s[count]: Inserts a certain number of random Lorem Ipsum sentences into the current document. The count option indicates how many sentences to insert. For example, lorem_s3 will insert three sentences into the document. If the count option is not provided, the default number of sentences will be inserted.

Sentence Example

_w[count]: Inserts a certain number of random Lorem Ipsum words into the current document. The count option indicates how many words to insert. For example, lorem_w40 will insert 40 random words into the document. If the count option is not provided, the default number of words will be inserted.

Word Example

_short: Makes all sentences or paragraphs short length.

_medium: Makes all sentences or paragraphs medium length. If no size options are provided, the extension will use _medium as the default option.

_long: Makes all sentences or paragraphs long length.

_vlong: Makes all sentences or paragraphs very long length.

Sizes Example

_nowrap: Inserts Lorem Ipsum text without any word wrapping.

_wrap[width]: Word wraps Lorem Ipsum text using the specified width. For example, lorem_wrap40 will wrap the text at 40 characters. If a word wrap option is not provided, the extension will use _wrap80 as the default option. If you want to turn word wrap off, use the _nowrap option. This option has no effect on the _link, _ol, or _ul options.

Wrapping Example

_link[count]: Inserts a certain number of random Lorem Ipsum HTML links into the current document. The HTML link will always point to https://atom.io/. The count option indicates how many links to insert. For example, lorem_link3 will insert three links, separated by page breaks, into the document. If the count option is not provided, the default number of links will be inserted. To avoid badly formatted HTML, the _link option ignores any _wrap options and is always set to _nowrap.

Links Example

_ol[count], _ul[count]: Inserts a random Lorem Ipsum HTML list into the current document. Use _ol for an ordered list and _ul for an unordered list. The count option indicates how many list items to insert. For example, lorem_ol3 will insert an ordered list with three list items into the document. If the count option is not provided, a list with the default number of items will be inserted. To avoid badly formatted HTML, both of these options ignore any _wrap options and are always set to _nowrap.

Lists Example

_html: Wraps Lorem Ipsum text in <p></p> tags so it displays correctly in HTML. For options _p and _s each individual paragraph or sentence is wrapped. For options _w and _link, the entire collection of words or links is wrapped. This option is not available for lists since lists are not inline elements.

HTML Example

_?, _help: Displays help for the Lorem Ipsum extension. If this option is used, all other options will be ignored and no Lorem Ipsum text will be generated.

Note: Any option that has a number associated with it (e.g. _p3, _wrap40) can also be entered with the number portion in front of the option (i.e. _3p, _40wrap) and it will work the same way.


Other Features

Comment Support: The package allows for text to be inserted as a comment. Just use the keybind or type your command as a comment and it will add commented lorem text. Note: Block comments are not supported.

Comment Example

Multi Cursor Support: Support for multiple cursors has been added. If the cursors are next to valid commands then it will parse all of your lorem text. Woo many lorems.

Multi Cursor Example


Contributing

This is my first atom package and I welcome all the help/support/feedback I can get so if you have any or would like to make a pull-request please feel free. If you do want to contribute I am using prettier to format the code. Many thanks.


License

MIT License: See LICENSE for more details.

atom-lorem's People

Contributors

patthrasher avatar shillingp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

atom-lorem's Issues

Not working at all

Not sure if I am just missing something on how to use the package but I have tried issuing lorem commands such as lorem_s5 (press enter or tab) or lorem_p3 (enter or tab) and even just tried alt+1 and I get nothing at all.

Atom version 1.25.1 X64
MSI laptop
Windows 8.1 64Bit
12 Gigs Ram

Commands and alt+l not working

When I type "lorem" then hit tab, the expected default paragraph is inserted. When I type any other command, such as "lorem_w10" (for 10 words) and hit tab I just tab over. No text is inserted. Also, when I use alt+l it opens my web browser to the atom-lorem readme on Github.

I am on Windows 10, Atom 1.31.1 x64. I have not changed the package settings from the default.

Fix indentation issues on insert

The text is inserted then indented meaning that undo has 2 actions instead of 1.

The approaches to test to try and fix this are

  1. Insert and select the text then indent it.
  2. Insert a range then indent each row in the range
  3. Prepend indentation onto the inserted string

Uncaught TypeError: Cannot read property 'addMarkerLayer' of undefined

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.15.0 x64
Electron: 1.3.13
OS: Mac OS X 10.12.3
Thrown From: lorem package 1.1.1

Stack Trace

Uncaught TypeError: Cannot read property 'addMarkerLayer' of undefined

At /Users/Javi/.atom/packages/lorem/lib/lorem.js:141

TypeError: Cannot read property 'addMarkerLayer' of undefined
    at Object.createCursorLayer (/packages/lorem/lib/lorem.js:141:25)
    at Object.handleLorem (/packages/lorem/lib/lorem.js:156:24)
    at /packages/lorem/lib/lorem.js:101:43)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:259:29)
    at /app.asar/src/command-registry.js:3:59
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:599:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:390:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/app.asar/src/window-event-handler.js:106:36)
    at /app.asar/src/window-event-handler.js:3:59)

Commands

  7x -7:55.9.0 core:move-right (input.hidden-input)
     -7:54 intentions:highlight (input.hidden-input)
     -7:53.5.0 lorem:catch-command (input.hidden-input)
     -7:46.1.0 intentions:highlight (input.hidden-input)
     -7:45 lorem:catch-command (input.hidden-input)
     -7:39.8.0 intentions:highlight (input.hidden-input)
     -7:39.5.0 lorem:catch-command (input.hidden-input)
     -7:06.6.0 settings-view:open (input.hidden-input)
     -6:02.5.0 intentions:highlight (input.hidden-input)
     -5:53.4.0 core:confirm (input.hidden-input)
     -5:44.5.0 intentions:highlight (input.hidden-input)
 37x -4:01.4.0 core:backspace (input.hidden-input)
     -3:50.1.0 editor:delete-to-beginning-of-word (input.hidden-input)
  2x -2:02.7.0 settings-view:open (input.hidden-input)
  7x -0:41.5.0 core:backspace (input.hidden-input)
     -0:30.4.0 lorem:catch-command (input.hidden-input)

Non-Core Packages

atom-beautify 0.29.17 
busy-signal 1.3.0 
emmet 2.4.3 
file-icons 2.0.17 
git-plus 7.3.3 
intentions 1.1.2 
javascript-snippets 1.2.1 
keybinding-cheatsheet 0.1.1 
linter 2.1.0 
linter-bootlint 1.0.4 
linter-csslint 1.3.4 
linter-javac 1.9.4 
linter-jshint 3.0.3 
linter-jsonlint 1.3.0 
linter-liferay 2.4.0 
linter-stylelint 3.9.0 
linter-ui-default 1.2.1 
lorem 1.1.1 
markdown-preview-plus 2.4.9 
minimap-highlight-selected 4.5.0 
script 3.14.1 

Uncaught ReferenceError: _is not defined

Hi, I'm getting this error anytime I try to define number of words, length of words, etc - anywhere the _ is being used.
the entry i made to get this error was lorem_w4

Hide Stack Trace
ReferenceError: _ is not defined
at LoremIpsum.parseCommand (lorem-ipsum.js:244:10)
at lorem.js:181:34
at Array.forEach ()
at lorem.js:178:15
at TextBuffer.transact (C:\Users\hilbe\AppData\Local\Programs\Pulsar\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1320:16)
at TextEditor.transact (C:\Users\hilbe\AppData\Local\Programs\Pulsar\resources\app.asar\src\text-editor.js:2455:24)
at Object.handleLorem (lorem.js:177:12)
at HTMLElement.lorem:catch-command (lorem.js:115:43)
at CommandRegistry.handleCommandEvent (C:\Users\hilbe\AppData\Local\Programs\Pulsar\resources\app.asar\src\command-registry.js:405:43)
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\hilbe\AppData\Local\Programs\Pulsar\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:617:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\hilbe\AppData\Local\Programs\Pulsar\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:408:22)
at WindowEventHandler.handleDocumentKeyEvent (C:\Users\hilbe\AppData\Local\Programs\Pulsar\resources\app.asar\src\window-event-handler.js:153:34)

Single line

When pasting into JSON it doesn't work unless everything is a single line. It would be great if you could add a feature to make everything appear on a single line. Currently I have to use this tool https://wordhtml.com/

Unsafe use of timeout to get config settings

Currently in words.js the functionupdateConfig is delayed so that it can get the config otherwise it does not seem to have set the config yet. Perhaps it should only be instantiated when the parseCommand function is run.

Use functional style for `hasCommand`

// Use
atom.commands
  .findCommands({target: element})
  .some(cmd => cmd.name === name)
// Instead of
!!atom.commands
  .findCommands({target: element})
  .filter(cmd => cmd.name === name)[0]

Capitalization

How in the world have I lived this long without this package?? SO GREAT!

Would like to add an option to capitalize the first character of the inserted text either via appending _C(_c?) and/or via a fixed config setting ["Always capitalize the first word"]. I don't have much (ok, any...) experience hacking atom packages so when looking through the code I'm not sure where to begin.

Can you point me in a direction? Happy to issue a PR if I manage to make anything useful.

Uncaught TypeError: editor.languageMode.toggleLineCommentForBufferRow is not a function

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.23.3 x64
Electron: 1.6.15
OS: Mac OS X 10.13.3
Thrown From: lorem package 1.3.0

Stack Trace

Uncaught TypeError: editor.languageMode.toggleLineCommentForBufferRow is not a function

At /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:948

TypeError: editor.languageMode.toggleLineCommentForBufferRow is not a function
    at /packages/lorem/lib/lorem.js:181:31
    at Array.forEach (native)
    at /packages/lorem/lib/lorem.js:167:15
    at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:941:24)
    at TextEditor.transact (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1811:30)
    at Object.handleLorem (/packages/lorem/lib/lorem.js:166:12)
    at HTMLElement.loremCatchCommand (/packages/lorem/lib/lorem.js:103:43)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:388:36)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:108:40)

Commands

     -2:28.3.0 editor:newline (input.hidden-input)
     -2:27.2.0 core:paste (input.hidden-input)
     -2:20.8.0 editor:move-to-end-of-screen-line (input.hidden-input)
     -1:28 editor:select-to-first-character-of-line (input.hidden-input)
  2x -1:27.1.0 core:backspace (input.hidden-input)
     -1:23.9.0 editor:select-to-first-character-of-line (input.hidden-input)
  2x -1:22.1.0 core:backspace (input.hidden-input)
     -1:08.3.0 editor:select-to-first-character-of-line (input.hidden-input)
  2x -1:07.7.0 core:backspace (input.hidden-input)
     -1:06.9.0 editor:newline (input.hidden-input)
     -1:05.9.0 core:paste (input.hidden-input)
     -0:37.3.0 editor:select-to-end-of-line (input.hidden-input)
     -0:36.4.0 core:backspace (input.hidden-input)
     -0:26.5.0 lorem:catch-command (input.hidden-input)
  2x -0:21.6.0 core:backspace (input.hidden-input)
     -0:16.3.0 lorem:catch-command (input.hidden-input)

Non-Core Packages

atom-autocomplete-php 0.25.6 
autocomplete-emojis 2.5.0 
block-comment 0.4.3 
comment-headers 2.15.0 
emoji-syntax 1.7.2 
file-header 1.13.8 
file-icons 2.1.16 
lorem 1.3.0 
minimap 4.29.7 
multi-cursor 2.1.5 
php-getters-setters 0.5.5 
pigments 0.40.2 
react 0.17.0 
react-snippets 1.0.1 
sublime-block-comment 0.5.1 
wordpress-autocomplete 1.2.0 

Needs support for multi-cursors

Should implement support for multiple cursors in lorem.js. Should also look to use Markers instead of Points to maintain text position.

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.