mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit 930164070d24f682486d5a4377f7a57648f1ae13
parent 66183887f8b1749075e8ac9d4218ae564cb7003f
Author: markseu <mark2011@mayberg.se>
Date:   Mon, 15 Sep 2025 14:25:40 +0200

Updated Markdown formatting with CSS

Diffstat:
MTASKLIST.md | 11+++++------
Msystem/extensions/update-available.ini | 88++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msystem/extensions/update-installed.ini | 12++++++------
Msystem/themes/stockholm.css | 31++++++++++---------------------
Msystem/workers/edit.css | 3---
Msystem/workers/edit.js | 82+++++++++++++++++++++++++++++++++----------------------------------------------
Msystem/workers/edit.php | 2+-
Msystem/workers/install-language.bin | 0
Msystem/workers/markdown.php | 27++++++++++-----------------
Msystem/workers/stockholm.php | 2+-
10 files changed, 111 insertions(+), 147 deletions(-)

diff --git a/TASKLIST.md b/TASKLIST.md @@ -1,6 +1,6 @@ # Product tasklist -You can help us with the following tasks for Datenstrom Yellow: +You can help us with open tasks for Datenstrom Yellow: - [ ] Added support for installing extensions in web browser. Users want to install extensions in browser. - [ ] Added support for light and dark mode to all themes. Light and dark mode is expected on mobile devices. @@ -9,11 +9,10 @@ You can help us with the following tasks for Datenstrom Yellow: - [ ] Added support for dynamic loading of JS/CSS files in bundler. Better page loading time. - [ ] Added support for web forms in Markdown. Users can create email contact forms or a feedback/survey forms. - [ ] Added support for Wysiwyg editor for Markdown. Users can edit websites without much knowledge. -- [ ] Announced transliterate extension, convert UTF8 characters to ASCII. Users don't like special characters. -- [ ] Updated help, what's new page with release notes and latest changes. Better documentation. -- [ ] Updated help, Swedish translation for missing pages. Better documentation. +- [ ] Updated help, release notes and latest changes in one place. Users want to know what's new. +- [ ] Updated help, Swedish translation for missing pages. Better multi language documentation. - [ ] Updated API, YellowPageCollection no longer derives from ArrayObject. ArrayObject interface is strange. -- [ ] Updated API, renamed parser type "notice" to "general". Make it more intuitive. +- [x] Updated API, renamed parser type "notice" to "general". Make it more intuitive. - [ ] Updated contact extension, message delivery with brute force protection. Spammers gonna spam. - [ ] Updated edit extension, autocomplete for links and tags. Users do less, software does more. - [ ] Updated edit extension, settings dialog with dropdown menus. Users want important system settings in browser. @@ -24,7 +23,7 @@ You can help us with the following tasks for Datenstrom Yellow: - [ ] Updated icon extension, SVG stack instead of WOFF font. Developers want consistent files formats. - [ ] Updated image extension, different media files for light and dark mode. Give users more control. - [ ] Updated mailer extension, make standalone SMTP extension. Websites may not have a working mail system. -- [ ] Updated markdown extension, general block element for formatting with CSS. Make it more intuitive. +- [x] Updated markdown extension, general block element for formatting with CSS. Make it more intuitive. - [ ] Updated feed extension, short URL for the feed.xml. Users don't like the long URL, it's ugly. - [ ] Updated sitemap extension, short URL for the sitemap.xml. Users don't like the long URL, it's ugly. - [x] Removed googlecalendar, googlemap and youtube extension. General dislike for invasive services. diff --git a/system/extensions/update-available.ini b/system/extensions/update-available.ini @@ -87,13 +87,13 @@ Status: available system/workers/bundle.php: bundle.php, create, update Extension: Catalan -Version: 0.9.2 +Version: 0.9.3 Description: Catalan language. Translator: Andreu Ferrer Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/catalan.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/catalan -Published: 2025-03-02 10:40:30 +Published: 2025-09-15 14:09:53 Status: available system/workers/catalan.php: catalan.php, create, update @@ -110,13 +110,13 @@ Status: available system/workers/check.php: check.php, create, update Extension: Chinese -Version: 0.9.2 +Version: 0.9.3 Description: Chinese language. Translator: Hyson Lee Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/chinese.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/chinese -Published: 2025-03-02 10:41:28 +Published: 2025-09-15 14:10:55 Status: available system/workers/chinese.php: chinese.php, create, update @@ -168,24 +168,24 @@ system/layouts/navigation.html: navigation.html, create, update, careful system/layouts/pagination.html: pagination.html, create, update, careful Extension: Czech -Version: 0.9.2 +Version: 0.9.3 Description: Czech language. Translator: Ufo Vyhuleny Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/czech.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/czech -Published: 2025-03-02 10:41:28 +Published: 2025-09-15 14:10:55 Status: available system/workers/czech.php: czech.php, create, update Extension: Danish -Version: 0.9.2 +Version: 0.9.3 Description: Danish language. Translator: David Garcia Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/danish.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/danish -Published: 2025-03-02 10:41:28 +Published: 2025-09-15 14:10:55 Status: available system/workers/danish.php: danish.php, create, update @@ -202,25 +202,25 @@ Status: available system/workers/draft.php: draft.php, create, update Extension: Dutch -Version: 0.9.2 +Version: 0.9.3 Description: Dutch language. Translator: Robin Vannieuwenhuijse Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/dutch.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/dutch -Published: 2025-03-02 10:41:28 +Published: 2025-09-15 14:10:55 Status: available system/workers/dutch.php: dutch.php, create, update Extension: Edit -Version: 0.9.11 +Version: 0.9.12 Description: Edit your website in a web browser. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-edit DocumentationLanguage: en, de, sv -Published: 2025-08-11 17:12:59 +Published: 2025-09-15 13:48:39 Status: available system/workers/edit.php: edit.php, create, update system/workers/edit.css: edit.css, create, update @@ -251,13 +251,13 @@ system/workers/emoji-extra7-stack.svg: emoji-extra7-stack.svg, create, update system/workers/emoji-flags-stack.svg: emoji-flags-stack.svg, create, update Extension: English -Version: 0.9.2 +Version: 0.9.3 Description: English language. Translator: Mark Seuffert Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/english.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/english -Published: 2025-03-02 10:19:01 +Published: 2025-09-15 13:56:35 Status: available system/workers/english.php: english.php, create, update @@ -276,13 +276,13 @@ system/layouts/feed.html: feed.html, create, update, careful content/feed/page.md: page.md, create, optional Extension: French -Version: 0.9.2 +Version: 0.9.3 Description: French language. Translator: Juh Nibreh Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/french.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/french -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/french.php: french.php, create, update @@ -317,13 +317,13 @@ Status: available system/workers/generate.php: generate.php, create, update Extension: German -Version: 0.9.2 +Version: 0.9.3 Description: German language. Translator: David Fehrmann Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/german.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/german -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/german.php: german.php, create, update @@ -381,13 +381,13 @@ system/workers/highlight-xml.json: highlight-xml.json, create, update system/workers/highlight-yaml.json: highlight-yaml.json, create, update Extension: Hungarian -Version: 0.9.2 +Version: 0.9.3 Description: Hungarian language. Translator: Ádám Tuba Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/hungarian.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/hungarian -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/hungarian.php: hungarian.php, create, update @@ -432,24 +432,24 @@ system/workers/instagram.php: instagram.php, create, update system/workers/instagram.js: instagram.js, create, update Extension: Italian -Version: 0.9.2 +Version: 0.9.3 Description: Italian language. Translator: Giovanni Salmeri Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/italian.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/italian -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/italian.php: italian.php, create, update Extension: Japanese -Version: 0.9.2 +Version: 0.9.3 Description: Japanese language. Translator: Yuhko Senuma, Tomonori Ikeda Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/japanese.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/japanese -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/japanese.php: japanese.php, create, update @@ -477,14 +477,14 @@ system/themes/karlskrona.css: karlskrona.css, create, update, careful system/themes/karlskrona.png: karlskrona.png, create Extension: Markdown -Version: 0.9.3 +Version: 0.9.4 Description: Text formatting for humans. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-markdown/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-markdown DocumentationLanguage: en, de, sv -Published: 2024-12-11 10:55:02 +Published: 2025-09-15 13:51:46 Status: available system/workers/markdown.php: markdown.php, create, update @@ -501,13 +501,13 @@ Status: available system/workers/meta.php: meta.php, create, update Extension: Norwegian -Version: 0.9.2 +Version: 0.9.3 Description: Norwegian language. Translator: Per Arne Solvik Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/norwegian.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/norwegian -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/norwegian.php: norwegian.php, create, update @@ -532,24 +532,24 @@ system/themes/paris-opensans-light.woff: paris-opensans-light.woff, create, upda system/themes/paris-opensans-regular.woff: paris-opensans-regular.woff, create, update, careful Extension: Polish -Version: 0.9.2 +Version: 0.9.3 Description: Polish language. Translator: Paweł Klockiewicz, Kanbeq Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/polish.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/polish -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/polish.php: polish.php, create, update Extension: Portuguese -Version: 0.9.2 +Version: 0.9.3 Description: Portuguese language. Translator: Al Garcia Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/portuguese.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/portuguese -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/portuguese.php: portuguese.php, create, update @@ -602,13 +602,13 @@ Status: available system/workers/readingtime.php: readingtime.php, create, update Extension: Russian -Version: 0.9.2 +Version: 0.9.3 Description: Russian language. Translator: Сергей Ворон Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/russian.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/russian -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/russian.php: russian.php, create, update @@ -668,36 +668,36 @@ system/workers/slider.css: slider.css, create, update system/workers/slider-splide.min.js: slider-splide.min.js, create, update Extension: Slovak -Version: 0.9.2 +Version: 0.9.3 Description: Slovak language. Translator: Ádám Tuba Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/slovak.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/slovak -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/slovak.php: slovak.php, create, update Extension: Spanish -Version: 0.9.2 +Version: 0.9.3 Description: Spanish language. Translator: Al Garcia, David Garcia Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/spanish.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/spanish -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/spanish.php: spanish.php, create, update Extension: Stockholm -Version: 0.9.2 +Version: 0.9.3 Description: Stockholm is a clean theme. Designer: Anna Svensson Tag: default, theme DownloadUrl: https://github.com/annaesvensson/yellow-stockholm/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-stockholm DocumentationLanguage: en, de, sv -Published: 2024-04-27 10:50:42 +Published: 2025-09-14 22:19:53 Status: available system/workers/stockholm.php: stockholm.php, create, update system/themes/stockholm.css: stockholm.css, create, update, careful @@ -707,13 +707,13 @@ system/themes/stockholm-opensans-light.woff: stockholm-opensans-light.woff, crea system/themes/stockholm-opensans-regular.woff: stockholm-opensans-regular.woff, create, update, careful Extension: Swedish -Version: 0.9.2 +Version: 0.9.3 Description: Swedish language. Translator: Anna Svensson Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/swedish.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/swedish -Published: 2025-03-02 10:41:27 +Published: 2025-09-15 14:10:55 Status: available system/workers/swedish.php: swedish.php, create, update @@ -742,13 +742,13 @@ Status: available system/workers/traffic.php: traffic.php, create, update Extension: Turkish -Version: 0.9.2 +Version: 0.9.3 Description: Turkish language. Translator: Osman Kars Tag: language DownloadUrl: https://github.com/annaesvensson/yellow-language/raw/main/downloads/turkish.zip DocumentationUrl: https://github.com/annaesvensson/yellow-language/tree/main/translations/turkish -Published: 2025-03-02 10:41:26 +Published: 2025-09-15 14:10:50 Status: available system/workers/turkish.php: turkish.php, create, update diff --git a/system/extensions/update-installed.ini b/system/extensions/update-installed.ini @@ -20,14 +20,14 @@ system/layouts/navigation.html: navigation.html, create, update, careful system/layouts/pagination.html: pagination.html, create, update, careful Extension: Edit -Version: 0.9.11 +Version: 0.9.12 Description: Edit your website in a web browser. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-edit DocumentationLanguage: en, de, sv -Published: 2025-08-11 17:12:59 +Published: 2025-09-15 13:48:39 Status: available system/workers/edit.php: edit.php, create, update system/workers/edit.css: edit.css, create, update @@ -87,14 +87,14 @@ media/downloads/yellow-svenska.pdf: yellow-svenska.pdf, create ./robots.txt: robots.txt, create Extension: Markdown -Version: 0.9.3 +Version: 0.9.4 Description: Text formatting for humans. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-markdown/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-markdown DocumentationLanguage: en, de, sv -Published: 2024-12-11 10:55:02 +Published: 2025-09-15 13:51:46 Status: available system/workers/markdown.php: markdown.php, create, update @@ -111,14 +111,14 @@ Status: available system/workers/serve.php: serve.php, create, update Extension: Stockholm -Version: 0.9.2 +Version: 0.9.3 Description: Stockholm is a clean theme. Designer: Anna Svensson Tag: default, theme DownloadUrl: https://github.com/annaesvensson/yellow-stockholm/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-stockholm DocumentationLanguage: en, de, sv -Published: 2024-04-27 10:50:42 +Published: 2025-09-14 22:19:53 Status: available system/workers/stockholm.php: stockholm.php, create, update system/themes/stockholm.css: stockholm.css, create, update, careful diff --git a/system/themes/stockholm.css b/system/themes/stockholm.css @@ -5,18 +5,16 @@ :root { --bg: #fff; --code-bg: #f7f7f7; - --notice1-bg: #fffbf0; - --notice2-bg: #fdf0f0; - --notice3-bg: #f0f8fe; + --important-bg: #f0f8fe; + --note-bg: #fffbf0; --heading: #111; --text: #666; --code: #666; --link: #07d; --link-active: #29f; --blockquote-accent: #29f; - --notice1-accent: #fb0; - --notice2-accent: #d00; - --notice3-accent: #08e; + --important-accent: #08e; + --note-accent: #fb0; --separator: #ddd; --border: #bbb; --font: "Open Sans", Helvetica, sans-serif; @@ -160,26 +158,17 @@ a:hover { font-weight: bold; border-left: 3px solid var(--blockquote-accent); } -.content .notice1 { +.content .important { margin: 1em 0; padding: 10px 1em; - background-color: var(--notice1-bg); - border-left: 10px solid var(--notice1-accent); + background-color: var(--important-bg); + border-left: 10px solid var(--important-accent); } -.content .notice2 { +.content .note { margin: 1em 0; padding: 10px 1em; - background-color: var(--notice2-bg); - border-left: 10px solid var(--notice2-accent); -} -.content .notice3, -.content .notice4, -.content .notice5, -.content .notice6 { - margin: 1em 0; - padding: 10px 1em; - background-color: var(--notice3-bg); - border-left: 10px solid var(--notice3-accent); + background-color: var(--note-bg); + border-left: 10px solid var(--note-accent); } .content .flexible { position: relative; diff --git a/system/workers/edit.css b/system/workers/edit.css @@ -412,9 +412,6 @@ font-size: 1.3em; font-weight: bold; } -#yellow-popup-format #yellow-popup-format-notice { - font-weight: bold; -} #yellow-popup-format #yellow-popup-format-quote { font-style: italic; } diff --git a/system/workers/edit.js b/system/workers/edit.js @@ -594,22 +594,22 @@ yellow.edit = { var elementPreview = document.getElementById(this.paneId+"-preview"); if (!yellow.toolbox.isVisible(elementPreview) && !elementText.readOnly) { switch (status) { - case "h1": yellow.editor.setMarkdown(elementText, "# ", "insert-multiline-block", true); break; - case "h2": yellow.editor.setMarkdown(elementText, "## ", "insert-multiline-block", true); break; - case "h3": yellow.editor.setMarkdown(elementText, "### ", "insert-multiline-block", true); break; + case "h1": yellow.editor.setMarkdown(elementText, "# ", "insert-multiline-block", "", true); break; + case "h2": yellow.editor.setMarkdown(elementText, "## ", "insert-multiline-block", "", true); break; + case "h3": yellow.editor.setMarkdown(elementText, "### ", "insert-multiline-block", "", true); break; case "paragraph": yellow.editor.setMarkdown(elementText, "", "remove-multiline-block"); yellow.editor.setMarkdown(elementText, "", "remove-fenced-block"); break; - case "notice": yellow.editor.setMarkdown(elementText, "! ", "insert-multiline-block", true); break; - case "quote": yellow.editor.setMarkdown(elementText, "> ", "insert-multiline-block", true); break; - case "pre": yellow.editor.setMarkdown(elementText, "```\n", "insert-fenced-block", true); break; - case "bold": yellow.editor.setMarkdown(elementText, "**", "insert-inline", true); break; - case "italic": yellow.editor.setMarkdown(elementText, "*", "insert-inline", true); break; - case "strikethrough": yellow.editor.setMarkdown(elementText, "~~", "insert-inline", true); break; - case "code": yellow.editor.setMarkdown(elementText, "`", "insert-autodetect", true); break; - case "ul": yellow.editor.setMarkdown(elementText, "* ", "insert-multiline-block", true); break; - case "ol": yellow.editor.setMarkdown(elementText, "1. ", "insert-multiline-block", true); break; - case "tl": yellow.editor.setMarkdown(elementText, "- [ ] ", "insert-multiline-block", true); break; - case "link": yellow.editor.setMarkdown(elementText, "[link](url)", "insert", false, yellow.editor.getMarkdownLink); break; + case "important": yellow.editor.setMarkdown(elementText, "! ", "insert-multiline-block", "important", true); break; + case "quote": yellow.editor.setMarkdown(elementText, "> ", "insert-multiline-block", "", true); break; + case "pre": yellow.editor.setMarkdown(elementText, "```\n", "insert-fenced-block", "", true); break; + case "bold": yellow.editor.setMarkdown(elementText, "**", "insert-inline", "", true); break; + case "italic": yellow.editor.setMarkdown(elementText, "*", "insert-inline", "", true); break; + case "strikethrough": yellow.editor.setMarkdown(elementText, "~~", "insert-inline", "", true); break; + case "code": yellow.editor.setMarkdown(elementText, "`", "insert-autodetect", "", true); break; + case "ul": yellow.editor.setMarkdown(elementText, "* ", "insert-multiline-block", "", true); break; + case "ol": yellow.editor.setMarkdown(elementText, "1. ", "insert-multiline-block", "", true); break; + case "tl": yellow.editor.setMarkdown(elementText, "- [ ] ", "insert-multiline-block", "", true); break; + case "link": yellow.editor.setMarkdown(elementText, "[link](url)", "insert", "", false, yellow.editor.getMarkdownLink); break; case "text": yellow.editor.setMarkdown(elementText, arguments, "insert"); break; case "status": yellow.editor.setMetaData(elementText, "status", true); break; case "file": this.showFileDialog(); break; @@ -721,8 +721,8 @@ yellow.edit = { "<li><a href=\"#\" id=\"yellow-popup-format-h2\" data-action=\"toolbar\" data-status=\"h2\">"+this.getText("ToolbarH2")+"</a></li>"+ "<li><a href=\"#\" id=\"yellow-popup-format-h3\" data-action=\"toolbar\" data-status=\"h3\">"+this.getText("ToolbarH3")+"</a></li>"+ "<li><a href=\"#\" id=\"yellow-popup-format-paragraph\" data-action=\"toolbar\" data-status=\"paragraph\">"+this.getText("ToolbarParagraph")+"</a></li>"+ + "<li><a href=\"#\" id=\"yellow-popup-format-important\" data-action=\"toolbar\" data-status=\"important\">"+this.getText("ToolbarImportant")+"</a></li>"+ "<li><a href=\"#\" id=\"yellow-popup-format-pre\" data-action=\"toolbar\" data-status=\"pre\">"+this.getText("ToolbarPre")+"</a></li>"+ - "<li><a href=\"#\" id=\"yellow-popup-format-notice\" data-action=\"toolbar\" data-status=\"notice\">"+this.getText("ToolbarNotice")+"</a></li>"+ "<li><a href=\"#\" id=\"yellow-popup-format-quote\" data-action=\"toolbar\" data-status=\"quote\">"+this.getText("ToolbarQuote")+"</a></li>"+ "</ul>"; break; @@ -1041,8 +1041,8 @@ yellow.edit = { yellow.editor = { // Set Markdown formatting - setMarkdown: function(element, prefix, type, toggle, callback) { - var information = this.getMarkdownInformation(element, prefix, type); + setMarkdown: function(element, prefix, type, name, toggle, callback) { + var information = this.getMarkdownInformation(element, prefix, type, name); var selectionStart = (information.type.indexOf("block")!=-1) ? information.top : information.start; var selectionEnd = (information.type.indexOf("block")!=-1) ? information.bottom : information.end; if (information.found && toggle) information.type = information.type.replace("insert", "remove"); @@ -1056,28 +1056,20 @@ yellow.editor = { var textSelectionNew, selectionStartNew, selectionEndNew; switch (information.type) { case "insert-multiline-block": - textSelectionNew = this.getMarkdownMultilineBlock(textSelection, information); - selectionStartNew = information.start + this.getMarkdownDifference(textSelection, textSelectionNew, true); - selectionEndNew = information.end + this.getMarkdownDifference(textSelection, textSelectionNew); - if (information.start==information.top && information.start!=information.end) selectionStartNew = information.top; - if (information.end==information.top && information.start!=information.end) selectionEndNew = information.top; - break; case "remove-multiline-block": textSelectionNew = this.getMarkdownMultilineBlock(textSelection, information); - selectionStartNew = information.start + this.getMarkdownDifference(textSelection, textSelectionNew, true); - selectionEndNew = information.end + this.getMarkdownDifference(textSelection, textSelectionNew); - if (selectionStartNew<=information.top) selectionStartNew = information.top; - if (selectionEndNew<=information.top) selectionEndNew = information.top; + selectionStartNew = information.top; + selectionEndNew = information.bottom + this.getMarkdownDifference(textSelection, textSelectionNew); break; case "insert-fenced-block": textSelectionNew = this.getMarkdownFencedBlock(textSelection, information); - selectionStartNew = information.start + information.prefix.length; - selectionEndNew = information.end + this.getMarkdownDifference(textSelection, textSelectionNew) - information.prefix.length; + selectionStartNew = information.top + information.prefix.length; + selectionEndNew = information.bottom + this.getMarkdownDifference(textSelection, textSelectionNew) - information.prefix.length; break; case "remove-fenced-block": textSelectionNew = this.getMarkdownFencedBlock(textSelection, information); - selectionStartNew = information.start - information.prefix.length; - selectionEndNew = information.end + this.getMarkdownDifference(textSelection, textSelectionNew) + information.prefix.length; + selectionStartNew = information.top - information.prefix.length; + selectionEndNew = information.bottom + this.getMarkdownDifference(textSelection, textSelectionNew) + information.prefix.length; break; case "insert-inline": textSelectionNew = information.prefix + textSelection + information.prefix; @@ -1105,7 +1097,7 @@ yellow.editor = { }, // Return Markdown formatting information - getMarkdownInformation: function(element, prefix, type) { + getMarkdownInformation: function(element, prefix, type, name) { var text = element.value; var start = element.selectionStart; var end = element.selectionEnd; @@ -1120,6 +1112,7 @@ yellow.editor = { type = "insert-inline"; prefix = "`"; } } + var attributes = name ? prefix+" {."+name+"}\n" : ""; var found = false; if (type.indexOf("multiline-block")!=-1) { if (text.substring(top, top+prefix.length)==prefix) found = true; @@ -1139,23 +1132,15 @@ yellow.editor = { } } } - return { "text":text, "prefix":prefix, "type":type, "start":start, "end":end, "top":top, "bottom":bottom, "found":found }; + return { "text":text, "prefix":prefix, "type":type, "attributes":attributes, "start":start, "end":end, "top":top, "bottom":bottom, "found":found }; }, // Return Markdown length difference - getMarkdownDifference: function(textSelection, textSelectionNew, firstTextLine) { - var textSelectionLength, textSelectionLengthNew; - if (firstTextLine) { - var position = textSelection.indexOf("\n"); - var positionNew = textSelectionNew.indexOf("\n"); - textSelectionLength = position!=-1 ? position+1 : textSelection.length+1; - textSelectionLengthNew = positionNew!=-1 ? positionNew+1 : textSelectionNew.length+1; - } else { - var position = textSelection.indexOf("\n"); - var positionNew = textSelectionNew.indexOf("\n"); - textSelectionLength = position!=-1 ? textSelection.length : textSelection.length+1; - textSelectionLengthNew = positionNew!=-1 ? textSelectionNew.length : textSelectionNew.length+1; - } + getMarkdownDifference: function(textSelection, textSelectionNew) { + var position = textSelection.indexOf("\n"); + var positionNew = textSelectionNew.indexOf("\n"); + var textSelectionLength = position!=-1 ? textSelection.length : textSelection.length+1; + var textSelectionLengthNew = positionNew!=-1 ? textSelectionNew.length : textSelectionNew.length+1; return textSelectionLengthNew - textSelectionLength; }, @@ -1166,14 +1151,15 @@ yellow.editor = { for (var i=0; i<lines.length; i++) { var matches = lines[i].match(/^(\s*[\#\*\-\!\>\s]+)?(\s+\[.\]|\s*\d+\.)?[ \t]+/); if (matches) { - textSelectionNew += lines[i].substring(matches[0].length); + var attributesOnly = lines[i].match(/^\s*!\s*\{\./); + if (!attributesOnly) textSelectionNew += lines[i].substring(matches[0].length); } else { textSelectionNew += lines[i]; } } textSelection = textSelectionNew; if (information.type.indexOf("remove")==-1) { - textSelectionNew = ""; + textSelectionNew = information.attributes; var linePrefix = information.prefix; lines = yellow.toolbox.getTextLines(textSelection.length!=0 ? textSelection : "\n"); for (var i=0; i<lines.length; i++) { diff --git a/system/workers/edit.php b/system/workers/edit.php @@ -2,7 +2,7 @@ // Edit extension, https://github.com/annaesvensson/yellow-edit class YellowEdit { - const VERSION = "0.9.11"; + const VERSION = "0.9.12"; public $yellow; // access to API public $response; // web response public $merge; // text merge diff --git a/system/workers/install-language.bin b/system/workers/install-language.bin Binary files differ. diff --git a/system/workers/markdown.php b/system/workers/markdown.php @@ -2,7 +2,7 @@ // Markdown extension, https://github.com/annaesvensson/yellow-markdown class YellowMarkdown { - const VERSION = "0.9.3"; + const VERSION = "0.9.4"; public $yellow; // access to API // Handle initialisation @@ -3836,18 +3836,16 @@ class YellowMarkdownParser extends MarkdownExtraParser { public $yellow; // access to API public $page; // access to page public $idAttributes; // id attributes - public $noticeLevel; // recursive level public function __construct($yellow, $page) { $this->yellow = $yellow; $this->page = $page; $this->idAttributes = array(); - $this->noticeLevel = 0; $this->url_filter_func = function($url) use ($yellow, $page) { return $yellow->lookup->normaliseLocation($url, $page->getPage("main")->location); }; $this->span_gamut += array("doStrikethrough" => 55); - $this->block_gamut += array("doNoticeBlocks" => 65); + $this->block_gamut += array("doGeneralBlocks" => 65); $this->document_gamut += array("doFootnotesLinks" => 55); $this->escape_chars .= "~"; parent::__construct(); @@ -4001,13 +3999,13 @@ class YellowMarkdownParser extends MarkdownExtraParser { return preg_replace_callback("/((?>^[ ]*>[ ]?.+\n(.+\n)*)+)/m", array($this, "_doBlockQuotes_callback"), $text); } - // Handle notice blocks - public function doNoticeBlocks($text) { - return preg_replace_callback("/((?>^[ ]*!(?!\[)[ ]?.+\n(.+\n)*)+)/m", array($this, "_doNoticeBlocks_callback"), $text); + // Handle general block elements + public function doGeneralBlocks($text) { + return preg_replace_callback("/((?>^[ ]*!(?!\[)[ ]?.+\n(.+\n)*)+)/m", array($this, "_doGeneralBlocks_callback"), $text); } - // Handle notice blocks over multiple lines - public function _doNoticeBlocks_callback($matches) { + // Handle general block elements over multiple lines + public function _doGeneralBlocks_callback($matches) { $name = $attributes = $attr = ""; $text = preg_replace("/^[ ]*![ ]?/m", "", $matches[1]); if (preg_match("/^[ ]*".$this->id_class_attr_catch_re."[ ]*\n([\S\s]*)$/m", $text, $parts)) { @@ -4015,19 +4013,14 @@ class YellowMarkdownParser extends MarkdownExtraParser { $text = $parts[2]; $attributes = $parts[1]; $attr = $this->doExtraAttributes("div", $parts[1]); - } elseif ($this->noticeLevel==0) { - $level = strspn(str_replace(array("![", " "), "", $matches[1]), "!"); - $attr = " class=\"notice$level\""; } if (!is_string_empty($text)) { - ++$this->noticeLevel; - $output = $this->page->parseContentElement($name, "[--notice--]", $attributes, "notice"); - if (!is_null($output) && preg_match("/^(.+)(\[--notice--\])(.+)$/s", $output, $parts)) { + $output = $this->page->parseContentElement($name, "[--general--]", $attributes, "general"); + if (!is_null($output) && preg_match("/^(.+)(\[--general--\])(.+)$/s", $output, $parts)) { $output = $parts[1].$this->runBlockGamut($text).$parts[3]; } else { $output = "<div$attr>\n".$this->runBlockGamut($text)."\n</div>"; } - --$this->noticeLevel; } else { $output = "<div$attr></div>"; } @@ -4053,7 +4046,7 @@ class YellowMarkdownParser extends MarkdownExtraParser { return $text; } - // Return suitable name for code block or notice block + // Return suitable name for code block or general block element public function getBlockName($language, $attributes) { if (!is_string_empty($language)) { $name = ltrim($language, "."); diff --git a/system/workers/stockholm.php b/system/workers/stockholm.php @@ -2,7 +2,7 @@ // Stockholm extension, https://github.com/annaesvensson/yellow-stockholm class YellowStockholm { - const VERSION = "0.9.2"; + const VERSION = "0.9.3"; public $yellow; // access to API // Handle initialisation