" MiniDocs is a project that includes several minimalistic documentation tools used by the [Grafoscopio](https://mutabit.com/grafoscopio/en.html) community, starting with [Markdeep](https://casual-effects.com/markdeep/) and its integrations with [Lepiter](https://lepiter.io/feenk/introducing-lepiter--knowledge-management--e2p6apqsz5npq7m4xte0kkywn/) . " Class { #name : #MiniDocs, #superclass : #Object, #category : #MiniDocs } { #category : #accessing } MiniDocs class >> altKeys [ ^ BlAlternativeCombination new with: (BlSingleKeyCombination key:BlKeyboardKey altLeft); with: (BlSingleKeyCombination key:BlKeyboardKey altRight); yourself. ] { #category : #accessing } MiniDocs class >> altShiftLeftCombo [ ^ BlCompulsoryCombination new with: self altKeys; with: self shiftKeys; with: (BlSingleKeyCombination key: BlKeyboardKey arrowLeft); yourself ] { #category : #accessing } MiniDocs class >> altShiftRightCombo [ ^ BlCompulsoryCombination new with: self altKeys; with: self shiftKeys; with: (BlSingleKeyCombination key: BlKeyboardKey arrowRight); yourself ] { #category : #accessing } MiniDocs class >> appFolder [ | tempFolder userDataFolder | userDataFolder := Smalltalk os isWindows ifTrue: [ FileLocator home / 'AppData' / 'Local' ] ifFalse: [ FileLocator userData ]. tempFolder := userDataFolder / 'Mutabit' / 'MiniDocs'. tempFolder exists ifFalse: [ tempFolder ensureCreateDirectory ]. ^ tempFolder ] { #category : #accessing } MiniDocs class >> importGrafoscopioFile: aFileReference [ ^ (STON fromString: aFileReference) first parent ] { #category : #accessing } MiniDocs class >> initialize [ self keyboardShortcutsRemapping ] { #category : #accessing } MiniDocs class >> installYamlToJson [ "For the moment, only Gnu/Linux and Mac are supported. IMPORTANT: Nimble, Nim's package manager should be installed, as this process doesn't verify its proper installation." self yamlToJsonBinary exists ifTrue: [ ^ MiniDocs appFolder ]. Nimble install: 'yaml'; install: 'json'; install: 'commandeer'. OSSUnixSubprocess new command: 'nim'; arguments: {'c'. self yamlToJsonSourceCode fullName}; runAndWaitOnExitDo: [ :process :outString | (self yamlToJsonSourceCode parent / self yamlToJsonSourceCode basenameWithoutExtension) moveToPageTitled: MiniDocs appFolder asFileReference. ^ MiniDocs appFolder ] ] { #category : #accessing } MiniDocs class >> keyboardShortcutsRemapping [ | primaryNewLine secondaryNewLine | primaryNewLine := LeSnippetElement keyboardShortcuts at: #NewLine. secondaryNewLine := LeSnippetElement keyboardShortcuts at: #SecondaryNewLine. ^ LeSnippetElement keyboardShortcuts at: #NewLine put: secondaryNewLine; at: #SecondaryNewLine put: primaryNewLine; at: #IndentSnippet put: self altShiftRightCombo; at: #UnindentSnippet put: self altShiftLeftCombo; yourself ] { #category : #accessing } MiniDocs class >> shiftKeys [ ^ BlAlternativeCombination new with: (BlSingleKeyCombination key:BlKeyboardKey shiftLeft); with: (BlSingleKeyCombination key:BlKeyboardKey shiftRight); yourself. ] { #category : #accessing } MiniDocs class >> yamlToJson: yamlString [ "This method uses a external binary written in Nim, as the native Pharo parser for YAML, written in PetitParser, was less robust and unable to parse correctly the same strings as the external one." self yamlToJsonBinary exists ifFalse: [ self installYamlToJson ]. OSSUnixSubprocess new command: self yamlToJsonBinary fullName; arguments: {yamlString}; redirectStdout; runAndWaitOnExitDo: [ :process :outString | ^ (STONJSON fromString: outString allButFirst) first ] ] { #category : #accessing } MiniDocs class >> yamlToJsonBinary [ ^ self appFolder / 'yamlToJson' ] { #category : #accessing } MiniDocs class >> yamlToJsonSourceCode [ ^ FileLocator image parent / 'pharo-local/iceberg/Offray/MiniDocs/src/yamlToJson.nim' ] { #category : #accessing } MiniDocs >> installNimFileExporter [ | folder | folder := (MiniDocs appFolder / 'scripts') ensureCreateDirectory. ZnClient new url: 'https://mutabit.com/repos.fossil/mutabit/uv/wiki/scripts/stringAsFileInto'; downloadTo: folder / 'stringAsFileInto'. ZnClient new url: 'https://mutabit.com/repos.fossil/mutabit/doc/trunk/wiki/scripts/stringAsFileInto.nim'; downloadTo: folder / 'stringAsFileInto.nim'. OSSUnixSubprocess new command: 'chmod'; arguments: { '+x' . (folder / 'stringAsFileInto') fullName }; workingDirectory: folder fullName; redirectStdout; redirectStderr; runAndWaitOnExitDo: [ :process :outString | ^ outString ] ]