Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 22 Jul 2019, 22:35
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
mdview, a markdown viewer
Post new topic   Reply to topic View previous topic :: View next topic
Page 4 of 5 [63 Posts]   Goto page: Previous 1, 2, 3, 4, 5 Next
Author Message
L18L

Joined: 19 Jun 2010
Posts: 3449
Location: www.eussenheim.de/

PostPosted: Sat 05 Dec 2015, 07:20    Post subject:  

step wrote:
I tried to make me like this type of convenience several times, but I couldn't convince myself for the following reasons:
1. mdview is not a puppy standard, it's a Fatdog add-on.
You forgot to say: It is new!
[EDIT]And you forgot to say: it is not an Ubuntu standard...[/EDIT]
step wrote:
2. mdview markdown support has some limits
Everything has some limits.
step wrote:
3. What are the advantages of creating HTML documentation and giving that out to translate vs giving the md file out to translate? I still need to figure that out.
Give out is publish?
Both of these are not good in my opinion as translators have to know some rules of html or mdview's markdown.
Translators are used to translate msgid to msgstr.
step wrote:
If the perceived benefits aren't readily apparent, gettexting md files is a hard sell, IMO.
There isn't anything to sell.

It is all free.
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1188

PostPosted: Tue 16 Feb 2016, 13:45    Post subject: bug report  

@jamesbond, I think I found a bug. Attached an md file to reproduce the issue. Essentially, when a line starts with [2] and includes matching brackets the text between [2] and the brackets included disappears. Version 2016.02.04 built on Thu Feb 4 07:09:52 2016.
mdview-bug-report-1.md.fake.gz
Description 
gz

 Download 
Filename  mdview-bug-report-1.md.fake.gz 
Filesize  1.57 KB 
Downloaded  221 Time(s) 

_________________
Fatdog64-802|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1188

PostPosted: Tue 16 Feb 2016, 18:42    Post subject: fenced blocks and gettext  

@jamesbond, there's another issue concerning fenced code blocks and translations. I just realized that mdview --po doesn't output the text inside fenced blocks. On one hand that makes sense - it's source code after all - on the other hand it is a problem, because that text becomes invisible to the translation process, so it's hard to realize that it even exists before deciding if it should be translated or not.

There are valid cases for using fenced blocks for text other than source code, which should therefore be translated. So I'm proposing a work-around which I think doesn't break the fenced block syntax.
Code:

```
this text is pre-formatted and hidden to gettext
```

vs.
Code:

```gettext
this text is pre-formatted and it's also gettexted
```

This should work, since GFM fenced blocks can take an optional language tag to select appropriate syntax highlightling rules. GFM seems to ignore unknown tags, so here 'gettext' is passed as a language tag but mdview interprets it as an operational directive. What do you think?

----
Reproduce issue by
Code:

# cat >> /tmp/zz.md
HAL's typewriter ticked a message:
```
I can't let you do that, David, I can't let you turn me off.
```
David was afraid.

# mdview --po /tmp/zz.md
#: //tmp/zz.md:1
msgid "HAL's typewriter ticked a message:"
msgstr ""

#: /tmp/zz.md:5
msgid "David was afraid. "
msgstr ""

_________________
Fatdog64-802|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1188

PostPosted: Wed 17 Feb 2016, 14:41    Post subject: update on bug reported two posts above  

@jamesbond, here's another test case for the bug reported two posts above
Code:
 * Run mdview[3] to test your translation of markdown files (see below)

This is rendered as "* Run mdview3" and nothing else.

_________________
Fatdog64-802|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1188

PostPosted: Mon 22 Feb 2016, 11:47    Post subject: proposed patch Re: fenced blocks and gettext  

@jamesbond
step wrote:
...I'm proposing a work-around which I think doesn't break the fenced block syntax.
Code:

```gettext
this text is pre-formatted and it's also ouput with mdview --po
```

I'm attaching a patch file, which implements the above work-around, for you and anyone else interested to review. Patch file against fossil 4fb552f2b09ca5ec 2016-02-04 07:11:16.

I still haven't started debugging the other issue I reported.

edit 20160223 I'm attaching a second patch file, which contains the first one. This file adds tests for the proposed patch and turns off translation of GitHub codeblocks unless they are marked "```gettext```". I'm not sure if you left translations enabled for GH codeblocks intentionally, but I think that disabling translations is consistent with all other types of codeblocks. Once again, "```gettext```" has a dual purpose, 1) enable outputting codeblock text with option --po, and 2) translating such text in normal operation.
codeblock-gettext-2.patch.gz
Description  Delete fake .gz extension
gz

 Download 
Filename  codeblock-gettext-2.patch.gz 
Filesize  6.66 KB 
Downloaded  193 Time(s) 
codeblock-gettext.patch.gz
Description  Delete fake .gz extension
gz

 Download 
Filename  codeblock-gettext.patch.gz 
Filesize  4.19 KB 
Downloaded  197 Time(s) 

_________________
Fatdog64-802|+Packages|Kodi|Findnrun|+forum|gtkmenuplus

Last edited by step on Tue 23 Feb 2016, 13:09; edited 1 time in total
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 3449
Location: www.eussenheim.de/

PostPosted: Mon 22 Feb 2016, 15:20    Post subject: Re: bug report  

step wrote:
@jamesbond, I think I found a bug. Attached an md file to reproduce the issue. Essentially, when a line starts with [2] and includes matching brackets the text between [2] and the brackets included disappears. Version 2016.02.04 built on Thu Feb 4 07:09:52 2016.


I don't know any thing about triple backticks
What I do know is: Brackets are used with external links.
[mdview](http://chiselapp.com/user/jamesbond/repository/mdview3/index)

Tried to solve your problem, see screenshot.
use_escape_with_markdown.png
 Description   Note escapes
 Filesize   25.48 KB
 Viewed   355 Time(s)

use_escape_with_markdown.png

Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1188

PostPosted: Mon 22 Feb 2016, 16:56    Post subject: Re: bug report  

Hi L18L, thanks for your help. Your work-around shows that mdview can create correct output when "\[2\]" replaces "[2]" in the example above. This is useful, but backslashes shouldn't be needed in a common markdown implementation, so I think mdview still needs to be fixed about this problem.

As far as I know, in markdown brackets immediately followed by parens (round brackets) introduce a link label and its link target, like so:
[label](target)
where the target can be a local file or a URL.

This bug concerns the case where there is extra text between the closing square bracket and the opening round bracket, like so:
[2] some (text)

It should not produce a link with 2 as the label and "some (text)" as the target. It should produce just the text "[2] some (text)".

wikipedia states that a markdown standard doesn't exist. However, most common markdown implementations render "[2] some (text)" as text and not as a link, unlike mdview.

You can test several markdown engines at once by visiting this link: http://johnmacfarlane.net/babelmark2/?text=%5B2%5D+some+(text)%0A%0A%5B2%5D(target)

(apparently if I wrap the above URL inside url bbcode this post renders as an empty box)

_________________
Fatdog64-802|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 3449
Location: www.eussenheim.de/

PostPosted: Tue 23 Feb 2016, 05:58    Post subject: Re: bug report and "translated pre-formated" text
Subject description: or is it a feture request?
 

step wrote:
wikipedia states that a markdown standard doesn't exist. However, most common markdown implementations render "[2] some (text)" as text and not as a link, unlike mdview.

You can test several markdown engines at once by visiting this link: http://johnmacfarlane.net/babelmark2/?text=%5B2%5D+some+(text)%0A%0A%5B2%5D(target)
Thanks for this interesting link.

However, I am not interested in markdown engines other than mdview.
It is clearly stated to support a subset of markdown.
This subset has been working good enough for Fatdog's Help which does not use reference-style links
... and not need translated pre-formated text.
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1188

PostPosted: Tue 23 Feb 2016, 13:01    Post subject: Re: bug report and "translated pre-formated" text
Subject description: or is it a feture request?
 

L18L wrote:

This subset has been working good enough for Fatdog's Help which does not use reference-style links
... and not need translated pre-formated text.
Findnrun needs the latter. That's why I'm proposing patches. I'm careful not to break existing code, and it's all intentional anyway, since Jamesbond will review my patches and decide whether they can go in or not.
_________________
Fatdog64-802|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1188

PostPosted: Tue 23 Feb 2016, 13:47    Post subject: text links proposed patch  

@jamesbond, for your consideration, here is a proposed patch for the text links issue I reported earlier. It affects function egg_markdown_to_text_line_formatter_links. Note: I didn't patch image links, function egg_markdown_to_text_line_formatter_image, in a similar fashion, because in practical use I don't expect this issue to occur for image links.

The patch file is made against the source code already patched for code blocks. A markdown test file is attached.

I should make clear that this patch doesn't concern so-called reference-style links, which I don't think mdview supports. It's a patch for regular text links.
text-links-patch.md.fake.gz
Description  remove .fake.gz extension
gz

 Download 
Filename  text-links-patch.md.fake.gz 
Filesize  1.77 KB 
Downloaded  195 Time(s) 
text-links.patch.fake.gz
Description  remove .fake.gz extension
gz

 Download 
Filename  text-links.patch.fake.gz 
Filesize  2.36 KB 
Downloaded  211 Time(s) 

_________________
Fatdog64-802|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 3354
Location: The Blue Marble

PostPosted: Tue 26 Apr 2016, 03:03    Post subject:  

step, all patches applied (both codeblock-gettext and text-links patch): https://chiselapp.com/user/jamesbond/repository/mdview3/timeline

Thank you.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread.
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 8694
Location: qld

PostPosted: Fri 17 Jun 2016, 21:15    Post subject:  

In the very latest build (recently pushed to petbuilds) everything seems to be working fine - but I have a feature request.

The files from puppylinux.com (which are in markdown format - converted to html server side) open fine on my local machine - but if there is a wide image it can't be viewed (re the timeline). I wonder if it is feasible to add a horizontal scrollbar? Mind you, this is probably beyond the scope of the project so I understand if you'd rather keep it simple. Smile

_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
jamesbond

Joined: 26 Feb 2007
Posts: 3354
Location: The Blue Marble

PostPosted: Sat 18 Jun 2016, 00:00    Post subject:  

01micko wrote:
I wonder if it is feasible to add a horizontal scrollbar?

Turns out it's a one line change:
Code:
--- help-viewer.c
+++ help-viewer.c
@@ -599,11 +599,11 @@
 #endif   /* GTK_CHECK_VERSION(2,16,0) */
    
     scrolledhelp_viewer = gtk_scrolled_window_new (NULL, NULL);
     gtk_widget_show (scrolledhelp_viewer);
     gtk_box_pack_start (GTK_BOX (vbox), scrolledhelp_viewer, TRUE, TRUE, 0);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledhelp_viewer), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledhelp_viewer), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
     markdown_textview = markdown_textview_new();
     markdown_textview_set_image_directory(MARKDOWN_TEXTVIEW(markdown_textview), help_dir);
     markdown_textview_set_exec(MARKDOWN_TEXTVIEW(markdown_textview),enable_exec);
     markdown_textview_set_use_gettext(MARKDOWN_TEXTVIEW(markdown_textview),use_gettext);

I will update this in fossil too.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread.
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 8694
Location: qld

PostPosted: Sat 18 Jun 2016, 01:20    Post subject:  

jamesbond wrote:
01micko wrote:
I wonder if it is feasible to add a horizontal scrollbar?

Turns out it's a one line change:
Code:
--- help-viewer.c
+++ help-viewer.c
@@ -599,11 +599,11 @@
 #endif   /* GTK_CHECK_VERSION(2,16,0) */
    
     scrolledhelp_viewer = gtk_scrolled_window_new (NULL, NULL);
     gtk_widget_show (scrolledhelp_viewer);
     gtk_box_pack_start (GTK_BOX (vbox), scrolledhelp_viewer, TRUE, TRUE, 0);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledhelp_viewer), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledhelp_viewer), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
     markdown_textview = markdown_textview_new();
     markdown_textview_set_image_directory(MARKDOWN_TEXTVIEW(markdown_textview), help_dir);
     markdown_textview_set_exec(MARKDOWN_TEXTVIEW(markdown_textview),enable_exec);
     markdown_textview_set_use_gettext(MARKDOWN_TEXTVIEW(markdown_textview),use_gettext);

I will update this in fossil too.


mdview.jpg
 Description   
 Filesize   38.35 KB
 Viewed   259 Time(s)

mdview.jpg


_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
Sailor Enceladus

Joined: 22 Feb 2016
Posts: 1560

PostPosted: Sat 18 Jun 2016, 14:00    Post subject:  

For some reason, mdview doesn't seem to show this md file at all. Viewing it in Leafpad or in that link (with Firefox) works ok.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 4 of 5 [63 Posts]   Goto page: Previous 1, 2, 3, 4, 5 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1028s ][ Queries: 12 (0.0332s) ][ GZIP on ]