Skip to content

Commit

Permalink
v0.7.16
Browse files Browse the repository at this point in the history
  • Loading branch information
scripting committed Nov 21, 2021
1 parent 438f4de commit 2f012e5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 22 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ I wrote a <a href="http://scripting.com/2019/06/02/150411.html">blog post</a> on

### Updates

#### v0.7.16 --11/21/21 by DW

Fixed a bug where we would generate an HTML &lt;p> for a singular post that had type markdown. This would cause the purple pound sign to appear below the headline, instead of to the right of the headline, in the rendering.

For titled posts of type markdown, enclose the generated markdown text in a div not a span, because that's what it is. The type is divMarkdownText.

#### v0.7.14 --11/19/21 by DW

When proccessing titled posts with type markdown, only emit one newline per headline. We were emitting two.
Expand Down
22 changes: 16 additions & 6 deletions oldschool.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var myVersion = "0.7.15", myProductName = "oldSchool";
var myVersion = "0.7.16", myProductName = "oldSchool";

exports.init = init;
exports.publishBlog = publishBlog;
Expand Down Expand Up @@ -132,11 +132,20 @@ function emojiProcess (s) {
}
return (emoji.emojify (s, undefined, addSpan));
}
function markdownProcess (s) {
function markdownProcess (s, flGenerateHtmlParagraphs=false) {
var renderer = new marked.Renderer ();
var options = {
renderer: renderer
};
return (marked (s, options));
if (flGenerateHtmlParagraphs) {
return (marked (s, options));
}
else {
renderer.paragraph = function (s) {
return (s);
};
return (marked (s, options));
}
}
function debugMarkdownText (theText) { //for debugging -- 10/30/21 by DW
theText = utils.replaceAll (theText, "\n", "\\n");
Expand Down Expand Up @@ -685,7 +694,6 @@ function publishBlog (jstruct, options, callback) {
var videotext = "<iframe width=\"560\" height=\"315\" src=\"" + url + "\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>";
return ("<center>" + videotext + "</center>" + s);
}

function getRenderedText (item, flTextIsTitle, urlStoryPage) {
var s = processText (item.text), flInlineImage = false;
if (item.inlineImage !== undefined) { //1/2/20 by DW
Expand Down Expand Up @@ -757,6 +765,7 @@ function publishBlog (jstruct, options, callback) {
}
return (atts);
}

function subsToMarkdown (parent) { //10/30/21 by DW
let markdowntext = "", indentlevel = 0;
function add (s) {
Expand All @@ -773,11 +782,12 @@ function publishBlog (jstruct, options, callback) {
}
}
addlevel (parent);
var processedtext = markdownProcess (markdowntext);
var processedtext = markdownProcess (markdowntext, true);
console.log ("getItemSubs: markdowntext == " + debugMarkdownText (markdowntext));
console.log ("getItemSubs: processedtext == " + debugMarkdownText (processedtext));
return ("<span class=\"spMarkdownText\">" + processedtext + "</span>");
return ("<div class=\"divMarkdownText\">" + processedtext + "</div>");
}

function getItemSubs (parent, ulLevel, urlStoryPage) {
if (getNodeType (parent) == "markdown") {
return (subsToMarkdown (parent));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oldschoolblog",
"description": "Blogging in the ways of ye old school.",
"version": "0.7.15",
"version": "0.7.16",
"author": "Dave Winer <dave@scripting.com>",
"license": "MIT",
"repository": {
Expand Down
48 changes: 33 additions & 15 deletions source.opml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- OPML generated by OPML Editor v10.1b19 on Fri, 19 Nov 2021 21:34:16 GMT -->
<!-- OPML generated by OPML Editor v10.1b19 on Sun, 21 Nov 2021 15:35:27 GMT -->
<opml version="2.0">
<head>
<title>nodeEditor: oldSchoolBlog</title>
<dateCreated>Sat, 06 May 2017 23:45:58 GMT</dateCreated>
<dateModified>Fri, 19 Nov 2021 21:34:16 GMT</dateModified>
<dateModified>Sun, 21 Nov 2021 15:35:27 GMT</dateModified>
<ownerName>Dave Winer</ownerName>
<ownerId>http://davewiner.com/</ownerId>
<expansionState>1, 2, 3, 14, 68, 69, 70, 73, 76, 94, 137, 177, 180, 181, 184, 187, 205, 206, 209, 210, 212, 214, 216, 225</expansionState>
<expansionState>1, 4, 7, 8, 30, 31, 34, 35, 37, 39, 41, 50</expansionState>
<vertScrollState>1</vertScrollState>
<windowTop>83</windowTop>
<windowLeft>637</windowLeft>
Expand All @@ -20,7 +20,7 @@
<outline text="{">
<outline text="&quot;name&quot;: &quot;oldschoolblog&quot;, "/>
<outline text="&quot;description&quot;: &quot;Blogging in the ways of ye old school.&quot;,"/>
<outline text="&quot;version&quot;: &quot;0.7.15&quot;,"/>
<outline text="&quot;version&quot;: &quot;0.7.16&quot;,"/>
<outline text="&quot;author&quot;: &quot;Dave Winer &lt;dave@scripting.com&gt;&quot;,"/>
<outline text="&quot;license&quot;: &quot;MIT&quot;,"/>
<outline text="&quot;repository&quot;: {">
Expand Down Expand Up @@ -52,7 +52,7 @@
</outline>
</outline>
<outline text="oldschool.js">
<outline text="var myVersion = &quot;0.7.15&quot;, myProductName = &quot;oldSchool&quot;; " created="Mon, 03 Feb 2014 03:21:03 GMT" pgfnum="36831"/>
<outline text="var myVersion = &quot;0.7.16&quot;, myProductName = &quot;oldSchool&quot;; " created="Mon, 03 Feb 2014 03:21:03 GMT" pgfnum="36831"/>
<outline text=""/>
<outline text="exports.init = init;"/>
<outline text="exports.publishBlog = publishBlog;"/>
Expand Down Expand Up @@ -303,22 +303,32 @@
<outline text="return (emoji.emojify (s, undefined, addSpan));"/>
<outline text="}"/>
</outline>
<outline text="function markdownProcess (s) {">
<outline text="function markdownProcess (s, flGenerateHtmlParagraphs=false) {">
<outline text="Changes" isComment="true" created="Fri, 19 Nov 2021 21:33:11 GMT">
<outline text="11/21/21; 9:55:49 AM by DW" created="Sun, 21 Nov 2021 14:55:49 GMT">
<outline text="New optional param, flGenerateHtmlParagraphs. " created="Sun, 21 Nov 2021 14:55:50 GMT"/>
</outline>
<outline text="11/19/21; 4:33:14 PM by DW" created="Fri, 19 Nov 2021 21:33:13 GMT">
<outline text="Commented out the renderer that neutered paragraphs. I don't know why it was doing this, but it made no sense. And it explained why we were screwing up paragraphs. " created="Fri, 19 Nov 2021 21:33:14 GMT"/>
</outline>
</outline>
<outline text="var renderer = new marked.Renderer ();"/>
<outline text="renderer.paragraph = function (s) {" isComment="true">
<outline text="return (s);"/>
<outline text="};"/>
</outline>
<outline text="var options = {">
<outline text="renderer: renderer" isComment="true"/>
<outline text="renderer: renderer"/>
<outline text="};"/>
</outline>
<outline text="return (marked (s, options));"/>
<outline text="if (flGenerateHtmlParagraphs) {" created="Sun, 21 Nov 2021 14:57:36 GMT">
<outline text="return (marked (s, options));"/>
<outline text="}" created="Sun, 21 Nov 2021 14:57:44 GMT"/>
</outline>
<outline text="else {" created="Sun, 21 Nov 2021 14:57:45 GMT">
<outline text="renderer.paragraph = function (s) {">
<outline text="return (s);"/>
<outline text="};"/>
</outline>
<outline text="return (marked (s, options));"/>
<outline text="}" created="Sun, 21 Nov 2021 14:57:48 GMT"/>
</outline>
<outline text="}"/>
</outline>
<outline text="function debugMarkdownText (theText) { //for debugging -- 10/30/21 by DW" created="Sat, 30 Oct 2021 16:54:39 GMT">
Expand Down Expand Up @@ -1239,7 +1249,6 @@
<outline text="return (&quot;&lt;center&gt;&quot; + videotext + &quot;&lt;/center&gt;&quot; + s);"/>
<outline text="}"/>
</outline>
<outline text="" created="Fri, 12 Nov 2021 20:01:07 GMT"/>
<outline text="function getRenderedText (item, flTextIsTitle, urlStoryPage) {">
<outline text="Changes" isComment="true">
<outline text="11/10/20; 12:18:00 PM by DW">
Expand Down Expand Up @@ -1366,8 +1375,12 @@
<outline text="return (atts);"/>
<outline text="}"/>
</outline>
<outline text="" created="Sun, 21 Nov 2021 14:33:19 GMT"/>
<outline text="function subsToMarkdown (parent) { //10/30/21 by DW" created="Sat, 30 Oct 2021 17:09:14 GMT">
<outline text="Changes" isComment="true" created="Sat, 30 Oct 2021 17:18:38 GMT">
<outline text="11/21/21; 9:35:21 AM by DW" created="Sun, 21 Nov 2021 14:35:21 GMT">
<outline text="Enclose in divMarkdownText, because it's a div not a span." created="Sun, 21 Nov 2021 14:35:21 GMT"/>
</outline>
<outline text="11/19/21; 2:07:52 PM by DW" created="Fri, 19 Nov 2021 19:07:52 GMT">
<outline text="No more indentation, and only output one newline per headline." created="Fri, 19 Nov 2021 19:07:52 GMT"/>
</outline>
Expand Down Expand Up @@ -1396,12 +1409,13 @@
<outline text="}" created="Fri, 29 Oct 2021 15:26:29 GMT"/>
</outline>
<outline text="addlevel (parent);" created="Fri, 29 Oct 2021 15:26:30 GMT"/>
<outline text="var processedtext = markdownProcess (markdowntext);" created="Sat, 30 Oct 2021 17:14:34 GMT"/>
<outline text="var processedtext = markdownProcess (markdowntext, true); " created="Sat, 30 Oct 2021 17:14:34 GMT"/>
<outline text="console.log (&quot;getItemSubs: markdowntext == &quot; + debugMarkdownText (markdowntext));" created="Sat, 30 Oct 2021 17:07:24 GMT"/>
<outline text="console.log (&quot;getItemSubs: processedtext == &quot; + debugMarkdownText (processedtext));" created="Sat, 30 Oct 2021 17:07:24 GMT"/>
<outline text="return (&quot;&lt;span class=\&quot;spMarkdownText\&quot;&gt;&quot; + processedtext + &quot;&lt;/span&gt;&quot;);"/>
<outline text="return (&quot;&lt;div class=\&quot;divMarkdownText\&quot;&gt;&quot; + processedtext + &quot;&lt;/div&gt;&quot;);"/>
<outline text="}" created="Sat, 30 Oct 2021 17:09:27 GMT"/>
</outline>
<outline text="" created="Sun, 21 Nov 2021 14:33:20 GMT"/>
<outline text="function getItemSubs (parent, ulLevel, urlStoryPage) {">
<outline text="Changes" isComment="true">
<outline text="10/29/21; 11:32:54 AM by DW" created="Fri, 29 Oct 2021 15:32:53 GMT">
Expand Down Expand Up @@ -3344,6 +3358,10 @@
<outline text="I wrote a &lt;a href=&quot;http://scripting.com/2019/06/02/150411.html&quot;&gt;blog post&lt;/a&gt; on June 2, 2019 about Old School. "/>
</outline>
<outline text="### Updates" created="Sun, 22 Aug 2021 16:12:36 GMT">
<outline text="#### v0.7.16 --11/21/21 by DW" created="Fri, 19 Nov 2021 19:09:19 GMT">
<outline text="Fixed a bug where we would generate an HTML &amp;lt;p&gt; for a singular post that had type markdown. This would cause the purple pound sign to appear below the headline, instead of to the right of the headline, in the rendering." created="Sun, 21 Nov 2021 15:33:20 GMT"/>
<outline text="For titled posts of type markdown, enclose the generated markdown text in a div not a span, because that's what it is. The type is divMarkdownText." created="Sun, 21 Nov 2021 15:34:46 GMT"/>
</outline>
<outline text="#### v0.7.14 --11/19/21 by DW" created="Fri, 19 Nov 2021 19:09:19 GMT">
<outline text="When proccessing titled posts with type markdown, only emit one newline per headline. We were emitting two. " created="Fri, 19 Nov 2021 19:09:21 GMT"/>
<outline text="This &lt;a href=&quot;https://github.com/scripting/drummerRFC/issues/14#issuecomment-974157255&quot;&gt;seems&lt;/a&gt; more compatible with the Markdown philosophy. " created="Fri, 19 Nov 2021 19:09:51 GMT"/>
Expand Down

0 comments on commit 2f012e5

Please sign in to comment.