From f501c26b033708b093a30221e1859001322b8504 Mon Sep 17 00:00:00 2001 From: Jordane Jouffroy Date: Thu, 17 Mar 2016 23:49:15 +0100 Subject: [PATCH] first commit --- Context.sublime-menu | 13 ++ Default (Linux).sublime-keymap | 8 ++ Default (OSX).sublime-keymap | 8 ++ Default (Windows).sublime-keymap | 8 ++ Main.sublime-menu | 25 ++++ Malou.sublime-commands | 32 +++++ MalouCommand.py | 66 +++++++++++ dictionary.json | 196 +++++++++++++++++++++++++++++++ readme.md | 31 +++++ 9 files changed, 387 insertions(+) create mode 100755 Context.sublime-menu create mode 100755 Default (Linux).sublime-keymap create mode 100755 Default (OSX).sublime-keymap create mode 100755 Default (Windows).sublime-keymap create mode 100755 Main.sublime-menu create mode 100755 Malou.sublime-commands create mode 100755 MalouCommand.py create mode 100644 dictionary.json create mode 100644 readme.md diff --git a/Context.sublime-menu b/Context.sublime-menu new file mode 100755 index 0000000..bed5c8c --- /dev/null +++ b/Context.sublime-menu @@ -0,0 +1,13 @@ +[ + { + "caption":"EddyMalou LoremIpsum", + "children": + [ + {"command": "malou", "caption": "default size", "args":{"nb":1}}, + {"command": "malou-xs", "caption": "xs size", "args":{"nb":1}}, + {"command": "malou-sm", "caption": "sm size", "args":{"nb":2}}, + {"command": "malou-md", "caption": "md size", "args":{"nb":3}}, + {"command": "malou-lg", "caption": "lg size", "args":{"nb":4}} + ] + } +] diff --git a/Default (Linux).sublime-keymap b/Default (Linux).sublime-keymap new file mode 100755 index 0000000..fd925f8 --- /dev/null +++ b/Default (Linux).sublime-keymap @@ -0,0 +1,8 @@ +[ + { "keys": ["alt+shift+m"], "command": "malou" }, + { "keys": ["tab"], "command": "malou", "context": + [ + { "key": "preceding_text", "operator": "regex_contains", "operand": ".*\\b(malou|malou-xs|malou-sm|malou-md|malou-lg)$", "match_all": true } + ] + } +] \ No newline at end of file diff --git a/Default (OSX).sublime-keymap b/Default (OSX).sublime-keymap new file mode 100755 index 0000000..fd925f8 --- /dev/null +++ b/Default (OSX).sublime-keymap @@ -0,0 +1,8 @@ +[ + { "keys": ["alt+shift+m"], "command": "malou" }, + { "keys": ["tab"], "command": "malou", "context": + [ + { "key": "preceding_text", "operator": "regex_contains", "operand": ".*\\b(malou|malou-xs|malou-sm|malou-md|malou-lg)$", "match_all": true } + ] + } +] \ No newline at end of file diff --git a/Default (Windows).sublime-keymap b/Default (Windows).sublime-keymap new file mode 100755 index 0000000..fd925f8 --- /dev/null +++ b/Default (Windows).sublime-keymap @@ -0,0 +1,8 @@ +[ + { "keys": ["alt+shift+m"], "command": "malou" }, + { "keys": ["tab"], "command": "malou", "context": + [ + { "key": "preceding_text", "operator": "regex_contains", "operand": ".*\\b(malou|malou-xs|malou-sm|malou-md|malou-lg)$", "match_all": true } + ] + } +] \ No newline at end of file diff --git a/Main.sublime-menu b/Main.sublime-menu new file mode 100755 index 0000000..b051015 --- /dev/null +++ b/Main.sublime-menu @@ -0,0 +1,25 @@ +[ + { + "id":"edit", + "children": + [ + { + "id":"text", + "children": + [ + { + "caption":"EddyMalou LoremIpsum", + "children": + [ + {"command": "malou", "caption": "Default size", "args":{"nb":1}}, + {"command": "malou", "caption": "XS size", "args":{"nb":1}}, + {"command": "malou", "caption": "SM size", "args":{"nb":2}}, + {"command": "malou", "caption": "MD size", "args":{"nb":3}}, + {"command": "malou", "caption": "LG size", "args":{"nb":4}} + ] + } + ] + } + ] + } +] diff --git a/Malou.sublime-commands b/Malou.sublime-commands new file mode 100755 index 0000000..5836590 --- /dev/null +++ b/Malou.sublime-commands @@ -0,0 +1,32 @@ +[ + + { + "caption": "EddyMalou: default size", + "command": "malou", + "args": {"nb": 1 } + }, + + { + "caption": "EddyMalou: XS size", + "command": "malou-xs", + "args": {"nb": 1 } + }, + + { + "caption": "EddyMalou: SM size", + "command": "malou-sm", + "args": {"nb": 2 } + }, + + { + "caption": "EddyMalou: MD size", + "command": "malou-md", + "args": {"nb": 3 } + }, + + { + "caption": "EddyMalou: LG size", + "command": "malou-lg", + "args": {"nb": 4 } + } +] \ No newline at end of file diff --git a/MalouCommand.py b/MalouCommand.py new file mode 100755 index 0000000..9b5ec40 --- /dev/null +++ b/MalouCommand.py @@ -0,0 +1,66 @@ +import sublime +import sublime_plugin +import random +import json +from os.path import dirname, realpath + +class MalouCommand(sublime_plugin.TextCommand): + + dictionary = [] + sizes_json = { + "malou-xs": 1, + "malou-sm": 2, + "malou-md": 3, + "malou-lg": 4, + } + sizes_list = ["malou-xs", "malou-sm", "malou-md", "malou-lg"] + + def makeParagraph(self, size): + + number = self.sizes_json[size] + + paragraph = "" + + for i in range(number): + paragraph += random.choice (self.dictionary['sentences_1']) + " " + paragraph += random.choice (self.dictionary['sentences_2']) + " " + paragraph += random.choice (self.dictionary['sentences_3']) + " " + paragraph += random.choice (self.dictionary['sentences_4']) + " " + paragraph += random.choice (self.dictionary['sentences_5']) + " " + paragraph += random.choice (self.dictionary['sentences_6']) + " " + paragraph += random.choice (self.dictionary['sentences_7']) + paragraph += random.choice (self.dictionary['sentences_8']) + ". " + return paragraph[:-1] + + def run(self, edit, nb=1): + + nb=nb-1 + + package_path = dirname(realpath(__file__)) + file = package_path + "/dictionary.json" + with open(file, 'r', encoding='utf8') as data_file: + self.dictionary = json.load(data_file) + + selects = self.view.sel() + for select in selects: + + sizes = ['malou-xs', 'malou-sm', 'malou-md', 'malou-lg'] + + default = sublime.Region(select.begin() - 5, select.begin()) + size = sublime.Region(select.begin() - 8, select.begin()) + + current_text = self.view.substr(size).lower() + + if current_text == 'malou': + txt = str(self.makeParagraph('malou-xs')) + self.view.erase(edit, default) + select = sublime.Region(default.begin()) + elif current_text in sizes: + txt = str(self.makeParagraph(current_text)) + self.view.erase(edit, size) + select = sublime.Region(size.begin()) + else: + txt = str(self.makeParagraph(self.sizes_list[nb])) + self.view.erase(edit, select) + + self.view.insert(edit, select.begin(), txt) diff --git a/dictionary.json b/dictionary.json new file mode 100644 index 0000000..edb08b5 --- /dev/null +++ b/dictionary.json @@ -0,0 +1,196 @@ +{ + "sentences_1":[ + "Chapitre abstrait 3 du conpendium :", + "C’est à dire ici, c’est le contraire, au lieu de panacée,", + "Au nom de toute la communauté des savants,", + "Lorsqu’on parle de tous ces points de vues,", + "C’est à dire quand on parle de ces rollers,", + "Quand on parle de relaxation,", + "Nous n’allons pas seulement danser ou jouer au football,", + "D'une manière ou d'une autre,", + "Quand on prend les triangles rectangles,", + "Se consolidant dans le système de insiding et outsiding,", + "Lorsque l'on parle des végétaliens, du végétalisme,", + "Contre la morosité du peuple,", + "Tandis que la politique est encadrée par des scientifiques issus de Sciences Po et Administratives,", + "On ne peut pas parler de politique administrative scientifique,", + "Pour emphysiquer l'animalculisme,", + "Comme la coumbacérie ou le script de Aze,", + "Vous avez le système de check-up vers les anti-valeurs, vous avez le curuna, or", + "La convergence n’est pas la divergence,", + "L’émergence ici c’est l’émulsion, c’est pas l’immersion donc", + "Imbiber, porter", + "Une semaine passée sans parler du peuple c’est errer sans abri, autrement dit", + "Actuellement,", + "Parallèlement,", + "Mesdames et messieurs fidèles," + ], + + "sentences_2":[ + "la cosmogonisation", + "l'activisme", + "le système", + "le rédynamisme", + "l'ensemble des 5 sens", + "la société civile", + "la politique", + "la compétence", + "le colloque", + "la contextualisation", + "la congolexicomatisation", + "la congolexicomatisation", + "la congolexicomatisation", + "la congolexicomatisation", + "la prédestination", + "la force", + "la systématique", + "l'ittérativisme", + "le savoir", + "l'imbroglio", + "la concertation politique", + "la délégation", + "la pédagogie", + "la réflexologie" + ], + + "sentences_3":[ + "vers la compromettance pour des saint-bioules", + "vers ce qu’on appelle la dynamique des sports", + "de la technicité informatisée", + "de la Théorie Générale des Organisations", + "autour de la Géo Physique Spatiale", + "purement technique", + "des lois du marché", + "de l'orthodoxisation", + "inter-continentaliste", + "à l'égard de la complexité", + "éventualiste sous cet angle là", + "de toute la République Démocratique du Congo", + "à l'incognito", + "autour de l'ergonométrie", + "indispensable(s) en science et culture", + "autour de phylogomènes généralisés", + "à forciori,", + "par rapport aux diplomaties" + ], + + "sentences_4":[ + "tend à", + "nous pousse à", + "fait allusion à", + "va", + "doit", + "consiste à", + "nous incite à", + "vise à", + "semble", + "est censé(e)", + "paraît", + "peut", + "s'applique à", + "consent à", + "continue à", + "invite à", + "oblige à", + "parvient à", + "pousse à", + "se résume à", + "suffit à", + "se résoud à", + "sert à", + "tarde à" + ], + + "sentences_5":[ + "incristaliser", + "imposer", + "intentionner", + "mettre un accent sur", + "tourner", + "informatiser", + "aider", + "défendre", + "gérer", + "prévaloir", + "vanter", + "rabibocher", + "booster", + "porter d'avis sur ce qu'on appelle", + "cadrer", + "se baser sur", + "effaceter", + "réglementer", + "régler", + "faceter", + "partager", + "uniformiser", + "défendre", + "soutenir", + "propulser", + "catapulter", + "établir" + ], + + "sentences_6":[ + "les interchanges", + "mes frères propres", + "les revenus", + "cette climatologie", + "une discipline", + "la nucléarité", + "l'upensmie", + "les sens dynamitiels", + "la renaissance africaine", + "l'estime du savoir", + "une kermesse", + "une certaine compétitivité", + "cet environnement de 2 345 410 km²", + "le kilométrage", + "le conpemdium", + "la quatripartie", + "les encadrés", + "le point adjacent", + "la bijectivité", + "le panafricanisme", + "ce système phénoménal", + "le système de Guipoti : 1/B+1/B’=1/D", + "une position axisienne", + "les grabuses lastiques", + "le chicouangue", + "le trabajo, le travail, la machinale, la robotisation", + "les quatre carrés fous du fromage" + ], + + "sentences_7":[ + "autour des dialogues intercommunautaires", + "provenant d'une dynamique syncronique", + "vers le monde entier", + "propre(s) aux congolais", + "vers Lovanium", + "vers l'humanisme", + "comparé(e)(s) la rénaque", + "autour des gens qui connaissent beaucoup de choses", + "possédant la francophonie", + "dans ces prestances", + "off-shore", + "dans Kinshasa", + "dans la sous-régionalité", + "dans le prémice", + "belvédère", + "avec la formule 1+(2x5)", + "axé(e)(s) sur la réalité du terrain", + "dans les camps militaires non-voyants", + "avéré(e)(s)", + "comme pour le lancement de Troposphère V" + ], + + "sentences_8":[ + ", tu sais ça", + ", c’est clair", + ", je vous en prie", + ", merci", + ", mais oui", + ", Bonne Année", + ", bonnes fêtes" + ] +} \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..f6c5fc6 --- /dev/null +++ b/readme.md @@ -0,0 +1,31 @@ +# EddyMalou Lorem Ipsum for [Sublime Text](http://www.sublimetext.com) + +You are bored to use the traditional "Lorem Ipsum" for your dummy texts ? Okey, EddyMalou Lorem Ipsum is there for help you. + +It's an extension for Sublime Text 3, It allow us to use some dummy text (like Lorem Ipsum) but with the Eddy Malou syntax. +This idea come from the [Eddy Malou generator](http://eddy-malou.com/) webite : http://eddy-malou.com. Thanks to the creators ! + +gif + + +## You have 3 ways to use this plugin : + +1. Auto-completion : type `malou` or `malou-xs` or `malou-sm` or `malou-md` or `malou-lg` then press the `TAB` key. +2. Just press the shorcut `Alt+Shift+M` and it's work +3. Or finally, you can use the menu : `Edit->Text->EddyMalou LoremIpsum` + + +## Install + +### Manually + +git clone this repository to your package folder. + +### Package Control + +Coming soon ! + + +### Credit + +Thanks to the [Eddy Malou generator](http://eddy-malou.com) owners for the idea ! \ No newline at end of file