diff --git a/index.html b/index.html index 9dfeb2b..8d1e8f1 100644 --- a/index.html +++ b/index.html @@ -335,8 +335,6 @@ { kind: 'block', type: 'wc' }, { kind: 'block', type: 'sort' }, { kind: 'block', type: 'uniq' }, - { kind: 'block', type: 'findDuplicates' }, - { kind: 'block', type: 'showUniqs' }, { kind: 'block', type: 'cut' }, { kind: 'block', type: 'sed' } ] diff --git a/public/blocks/findDuplicatesBlock.js b/public/blocks/findDuplicatesBlock.js deleted file mode 100644 index 371d038..0000000 --- a/public/blocks/findDuplicatesBlock.js +++ /dev/null @@ -1,18 +0,0 @@ -var findDuplicatesBlock = { - type: 'findDuplicates', - message0: '%{BKY_FIND_DUPLICATES}', - category: 'Text Processing', - unix_description: [ - { - duplicates: '-d' // uniq -d - } - ], - - style: 'Text Processing', - previousStatement: 'Action', - nextStatement: 'Action', - tooltip: '%{BKY_FIND_DUPLICATES_TOOLTIP}', - helpUrl: '' // URL to further information or documentation. -}; - -Blockly.defineBlocksWithJsonArray([findDuplicatesBlock]); diff --git a/public/blocks/showUniqsBlock.js b/public/blocks/showUniqsBlock.js deleted file mode 100644 index 538c209..0000000 --- a/public/blocks/showUniqsBlock.js +++ /dev/null @@ -1,18 +0,0 @@ -var showUniqsBlock = { - type: 'showUniqs', - message0: '%{BKY_SHOWUNIQS}', - category: 'Text Processing', - unix_description: [ - { - uniq: '-u' // uniq -u - } - ], - - style: 'Text Processing', - previousStatement: 'Action', - nextStatement: 'Action', - tooltip: '%{BKY_SHOWUNIQS_TOOLTIP}', - helpUrl: '%{BKY_SHOWUNIQS_HELPURL}' // URL to further information or documentation. -}; - -Blockly.defineBlocksWithJsonArray([showUniqsBlock]); diff --git a/public/blocks/sortBlock.js b/public/blocks/sortBlock.js index 2ddffeb..5612a45 100644 --- a/public/blocks/sortBlock.js +++ b/public/blocks/sortBlock.js @@ -7,7 +7,7 @@ var sortBlock = { desc: '-r', numeric_sorting: '-n', sort_delimiter: "-t'str'", - sort_column: '-k', + sort_column: '-k ', uniq_elements: '-u', ignore_nonPrintable: '-i', ignore_leading_blanks: '-b' diff --git a/public/blocks/uniqBlock.js b/public/blocks/uniqBlock.js index 8abc0af..b696971 100644 --- a/public/blocks/uniqBlock.js +++ b/public/blocks/uniqBlock.js @@ -6,7 +6,10 @@ var uniqBlock = { { none: '', occurencies: '-c', - caseInsensitive: '-i' + caseInsensitive: '-i', + outputNonRepeatedLines: '-u', + outputSingleCopyOfRepeatedLines: '-d', + skipChars: '-s str' } ], @@ -26,7 +29,30 @@ var uniqBlock = { checked: false // by default it's disabled } ], - + message3: '%{BKY_UNIQ_OUTPUT_NON_REPEATED_LINES}', + args3: [ + { + type: 'field_checkbox', + name: 'outputNonRepeatedLines', + checked: false // by default it's disabled + } + ], + message4: '%{BKY_UNIQ_OUTPUT_SINGLE_COPY_OF_REPEATED_LINES}', + args4: [ + { + type: 'field_checkbox', + name: 'outputSingleCopyOfRepeatedLines', + checked: false // by default it's disabled + } + ], + message5: '%{BKY_UNIQ_SKIP_CHARS}', + args5: [ + { + type: 'field_input', + name: 'skipChars', + text: '' + } + ], style: 'Text Processing', previousStatement: 'Action', nextStatement: 'Action', diff --git a/public/img/blockly_photo.png b/public/img/blockly_photo.png index ff2618c..e8c216c 100644 Binary files a/public/img/blockly_photo.png and b/public/img/blockly_photo.png differ diff --git a/public/img/combine_files.png b/public/img/combine_files.png index 4b06dee..8bf47b1 100644 Binary files a/public/img/combine_files.png and b/public/img/combine_files.png differ diff --git a/public/img/convert_domains.png b/public/img/convert_domains.png index 1594e5f..4c013d7 100644 Binary files a/public/img/convert_domains.png and b/public/img/convert_domains.png differ diff --git a/public/img/extract_columns.png b/public/img/extract_columns.png index d42f549..4f11600 100644 Binary files a/public/img/extract_columns.png and b/public/img/extract_columns.png differ diff --git a/public/img/filter_rows_and_count_lines.png b/public/img/filter_rows_and_count_lines.png index 887f0e3..d3da367 100644 Binary files a/public/img/filter_rows_and_count_lines.png and b/public/img/filter_rows_and_count_lines.png differ diff --git a/public/img/remove_duplicate_lines_and_sort.png b/public/img/remove_duplicate_lines_and_sort.png index 0b00ff1..41f7fa4 100644 Binary files a/public/img/remove_duplicate_lines_and_sort.png and b/public/img/remove_duplicate_lines_and_sort.png differ diff --git a/public/js/el.js b/public/js/el.js index e718596..ed04433 100644 --- a/public/js/el.js +++ b/public/js/el.js @@ -49,8 +49,8 @@ Blockly.Msg['CONDITION_OUTPUT_HELPURL'] = 'https://www.google.com/'; Blockly.Msg['CUT'] = 'Αποκοπή σε αρχείο ή συμβολοσειρά'; Blockly.Msg['CUT_DELIMITER'] = 'Διαχωριστικό'; Blockly.Msg['CUT_DEFINE_COLUMNS'] = 'Ορισμός στηλών'; -Blockly.Msg['CUT_START'] = 'Έναρξη υποσυμβολοσειράς'; -Blockly.Msg['CUT_END'] = 'Τέλος'; +Blockly.Msg['CUT_START'] = 'Έναρξη υποσυμβολοσειράς : '; +Blockly.Msg['CUT_END'] = 'Τέλος : '; Blockly.Msg['CUT_TOOLTIP'] = 'Αποκοπή σε ένα αρχείο ή μια συμβολοσειρά.\nΓια συνεχόμενες αποκοπές χρησιμοποιήστε κόμμα(,) , για αποκοπές εύρους χρησιμοποιήστε παύλα (-)'; Blockly.Msg['CUT_HELPURL'] = 'https://www.google.com/'; @@ -127,7 +127,7 @@ Blockly.Msg['LS_MESSAGE'] = 'Λίστα αρχείων & καταλόγων'; Blockly.Msg['LS_SHOW_DETAILS'] = 'Εμφάνιση λεπτομερειών %1'; Blockly.Msg['LS_SUBDIRECTORIES'] = 'Αναζήτηση σε όλους τους υποκαταλόγους %1'; Blockly.Msg['LS_HIDDEN'] = 'Εμφάνιση κρυφών αρχείων %1'; -Blockly.Msg['LS_REVERSE_ORDER'] = '%1 Εμφάνιση σε αντίστροφη σειρά'; +Blockly.Msg['LS_REVERSE_ORDER'] = 'Εμφάνιση σε αντίστροφη σειρά %1'; Blockly.Msg['LS_TOOLTIP'] = 'Λίστα περιεχομένων καταλόγου'; Blockly.Msg['LS_HELPURL'] = 'https://www.google.com/'; Blockly.Msg['LN_MESSAGE'] = 'Σύνδεση αρχείων'; @@ -921,6 +921,12 @@ Blockly.Msg['UNIQ'] = 'Αφαίρεση διπλότυπων γραμμών στ Blockly.Msg['UNIQ_COUNT'] = 'Μέτρηση των εμφανίσεων των \n γραμμών που αφαιρέθηκαν %1'; Blockly.Msg['UNIQ_CASE'] = ' Χωρίς διάκριση πεζών-κεφαλαίων %1'; +Blockly.Msg['UNIQ_OUTPUT_NON_REPEATED_LINES'] = + 'Εμφάνιση μόνο μη επαναλαμβανόμενων γραμμών %1'; +Blockly.Msg['UNIQ_OUTPUT_SINGLE_COPY_OF_REPEATED_LINES'] = + 'Εμφάνιση μόνο ενός αντίγραφου των επαναλαμβανόμενων γραμμών %1'; +Blockly.Msg['UNIQ_SKIP_CHARS'] = + 'Παράλειψη των πρώτων %1 χαρακτήρων κάθε γραμμής'; Blockly.Msg['UNIQ_TOOLTIP'] = 'Αναφορά ή φιλτράρισμα επαναλαμβανόμενων γραμμών σε ένα αρχείο'; Blockly.Msg['UNIQ_HELPURL'] = 'https://www.google.com/'; diff --git a/public/js/en.js b/public/js/en.js index 2b4656c..5a07c9a 100644 --- a/public/js/en.js +++ b/public/js/en.js @@ -20,7 +20,7 @@ Blockly.Msg['AWK_VARIABLE_INPUT'] = 'Variable input'; Blockly.Msg['AWK_BEGIN'] = 'Execute once before data is processed'; Blockly.Msg['AWK_ACTION'] = 'Action'; Blockly.Msg['AWK_END'] = 'Execute once after data is processed'; -Blockly.Msg['AWK_PRINT'] = 'columns to print'; +Blockly.Msg['AWK_PRINT'] = 'Columns to print'; Blockly.Msg['AWK_TOOLTIP'] = 'pattern-directed scanning and processing language'; Blockly.Msg['AWK_HELPURL'] = 'https://www.google.com/'; @@ -48,8 +48,8 @@ Blockly.Msg['CONDITION_OUTPUT_HELPURL'] = 'https://www.google.com/'; Blockly.Msg['CUT'] = 'Cut out in file or string'; Blockly.Msg['CUT_DELIMITER'] = 'Delimiter'; Blockly.Msg['CUT_DEFINE_COLUMNS'] = 'Define columns'; -Blockly.Msg['CUT_START'] = 'substring start'; -Blockly.Msg['CUT_END'] = 'end'; +Blockly.Msg['CUT_START'] = 'Substring start : '; +Blockly.Msg['CUT_END'] = 'End : '; Blockly.Msg['CUT_TOOLTIP'] = 'Cut out in a file or a string.\nFor consecutive cuts use comma(,) , for range cuts use hyphen (-)'; Blockly.Msg['CUT_HELPURL'] = 'https://www.google.com/'; @@ -124,7 +124,7 @@ Blockly.Msg['LS_MESSAGE'] = 'List files & directories'; Blockly.Msg['LS_SHOW_DETAILS'] = 'Show details %1'; Blockly.Msg['LS_SUBDIRECTORIES'] = 'Search in all subdirectories %1'; Blockly.Msg['LS_HIDDEN'] = 'Show hidden files %1'; -Blockly.Msg['LS_REVERSE_ORDER'] = '%1 Show in reverse order'; +Blockly.Msg['LS_REVERSE_ORDER'] = 'Show in reverse order %1'; Blockly.Msg['LS_TOOLTIP'] = 'List directory contents'; Blockly.Msg['LS_HELPURL'] = 'https://www.google.com/'; Blockly.Msg['LN_MESSAGE'] = 'Link files'; @@ -892,6 +892,11 @@ Blockly.Msg['UNIQ'] = 'Remove duplicate lines in file\n'; Blockly.Msg['UNIQ_COUNT'] = 'Count the occurencies of \n duplicates lines removed %1'; Blockly.Msg['UNIQ_CASE'] = 'Case sensitive %1'; +Blockly.Msg['UNIQ_OUTPUT_NON_REPEATED_LINES'] = + 'Output only non-repeated lines %1'; +Blockly.Msg['UNIQ_OUTPUT_SINGLE_COPY_OF_REPEATED_LINES'] = + 'Output only one copy of repeated lines %1'; +Blockly.Msg['UNIQ_SKIP_CHARS'] = 'Skip first %1 characters of each line'; Blockly.Msg['UNIQ_TOOLTIP'] = 'Report or filter out repeated lines in a file'; Blockly.Msg['UNIQ_HELPURL'] = 'https://www.google.com/'; diff --git a/public/main.js b/public/main.js index 11adb03..132b731 100644 --- a/public/main.js +++ b/public/main.js @@ -565,7 +565,11 @@ document generatedCommand = replaceKeywords(generatedCommand); // Combine the constructed UNIX command and filename - document.getElementById('resultsText').innerText = generatedCommand; + if (generatedCommand.length > 0) { + document.getElementById('resultsText').innerText = generatedCommand; + } else { + document.getElementById('resultsText').innerText = '\n'; // Insert a newline character if the command is empty so that the results area does not shrink + } console.log('Generated command:', generatedCommand); if (blockCount > 0) { diff --git a/views/register.ejs b/views/register.ejs index 7dc7183..00622ac 100644 --- a/views/register.ejs +++ b/views/register.ejs @@ -98,11 +98,6 @@ - -
- - -
diff --git a/views/tutorials.ejs b/views/tutorials.ejs index b4a9364..006932d 100644 --- a/views/tutorials.ejs +++ b/views/tutorials.ejs @@ -105,7 +105,7 @@ Blockly Unix

- The corresponding Unix command for this task is: awk -F';' ' $3 == "empt" ' test.txt | sort -r -k2 | uniq -c | head -n 50 > newFile.txt + The corresponding Unix command for this task is: awk -F';' ' $3 == "empt" ' test.txt | sort -r -k 2 | uniq -c | head -n 50 > newFile.txt