Hi, Utkarsh
This feature will require some work - not just from pretty-printing.
Consider an html file:
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8" />
<title>hello</title>
<link href="global.css" type="text/css" rel="stylesheet"/>
<style>
h1 {
text-align:center;
}
</style>
<script src="jquery.js" type="text/javascript"></script>
</head>
<body>
<h1>My title</h1>
<script>
console.log($('h1').text())
</script>
</body>
When this file is extracted. The css panel should show the
<style></style> content. The html panel should show the
<script></script> content. However,
the 'run' should display the html using the included global.css and
jquery.js files.
This is a feature beyond what seems to be provided by the online
jsfiddle. There the assumption is that the user is trying out a code
fragment to see what it does not working with a full web page.
There are a couple of other quirks we need to try.
In the case of javascript or html, the user may want to copy and paste
the text to the fiddler. Since the user is learning to create web pages
with javascript, this is a reasonable use case. This text should be
saved as a full html page.
The model I am using is a learner who uses a text editor (nano or gedit)
to prepare and edit html files and then wants to open it in Browse and
test with the fiddler. After making some corrections, the user wants to
save the file and perhaps resume editing with a local editor. The user
also may want to display the web page by url
(file:///home/olpc/Documents/myfile.html). This will require the user to
copy the file from the Journal to the Documents folder.
One problem last year is that there was not enough time for us to really
check out these capabilities so I will not be surprised if some of these
cases need more programming work in the web-console code.
Note:
On 05/17/2016 07:50 AM, Sebastian Silva wrote:
My concern is that these features are rather simple to implement, but
hard to decide on. A medium-experienced python programmer might do each
in a couple of days. Utkarsh is a fine programmer so we should have him
do something significant with real impact, and avoid design deadlocks.
Sebastian's compliment is well-deserved. However, my experience is that
even the simplest feature proves to have hidden and frustrating
complexity. I think this BeautifulSoup case is a perfect example. In
principle it should require an import and one line of code to save the
file in a more readable form. Then you got caught up in the conversion
of quotes to '&' format. Further, the text produced apparently violates
some assumptions Richa made about parsing the file.
It is clear that design deadlocks are to be avoided. My approach is to
build the capability and then let the users decide rather than wait for
approval in advance. Like any experiment, if the result is not
successful - something is learned.
Some may judge that Sugar is a failed effort and should be abandoned in
favor of something significant with real impact.
I believe the effort to provide computing capability to learners who do
not have ready access to computers and to provide these computers with
the maximum educational opportunity is a worthwhile venture and could
have important and significant impact. So I continue to work to that end.
Tony
On 05/17/2016 07:49 AM, Ütkarsh Tiwari wrote:
Checkout the web-console.py file for the relevant extraction code.
https://github.com/richaseh/browse-activity/tree/add_image
Thanks,
Utkarsh
On May 17, 2016 11:13 AM, "Yash Agarwal" <agrwal.ys...@gmail.com
<mailto:agrwal.ys...@gmail.com>> wrote:
oh, then I'll need to see Richa's code for this. can you send a
link or just paste the relevant code snippet here
On Tue, May 17, 2016 at 11:07 AM Ütkarsh Tiwari
<iamutkarshtiw...@gmail.com <mailto:iamutkarshtiw...@gmail.com>>
wrote:
Hi Yash,
The exactly situation here is that the
prettified html code inside the .html file generated(after
save) can't be properly parsed by the methods(responsible for
extracting js/html/css code from .html file) written by Mr.
Richa Sehgal because the prittfied code contains the escaped
characters which result in unexpected behaviour.
Thanks,
Utkarsh
On May 17, 2016 10:59 AM, "Yash Agarwal"
<agrwal.ys...@gmail.com <mailto:agrwal.ys...@gmail.com>> wrote:
Hi,
It would helpful if you could clarify a little,
Beautifulsoup is full featured HTML parser and prettifying
the .html file is just one of the features. If I
understand correctly you want to prettify the code the
user writes in your editor-- this can be done in
real-time(little difficult) or when the user clicks a
button <prettify my code>(quite simple to implement). If
you want to store the prettified file it shouldn't have a
problem-- could clarify what the exact issue is here.
Cheers,
Yash
On Tue, May 17, 2016 at 7:31 AM Dave Crossland
<d...@lab6.com <mailto:d...@lab6.com>> wrote:
Hi
Kindly, I'm confused about this js fiddler activity;
why are you putting effort into writing a fiddle
program, instead of merely packaging an existing libre
fiddle program for Sugar?
Cheers
Dave
_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
<mailto:Sugar-devel@lists.sugarlabs.org>
http://lists.sugarlabs.org/listinfo/sugar-devel
_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel