Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1 ... 4 5 6 
Send Topic Print
Making an HTML outline (expandable/contractible) (Read 84859 times)
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Making an HTML outline (expandable/contractible)
Reply #75 - Jan 5th, 2010, 3:07pm
 
Quote:
'Prototypes OnAdd should be: $IsPrototype=true; $HTMLDontExport=true;

Done!

Quote:
'*entry' OnAdd should be: $Prototype="*entry";

Done!

Quote:
'*entry' Rule should be: $webName=$HTMLExportFileName+$HTMLExportExtension;$HTMLDontExport=false;

Done!

Quote:
Incidentally, good TB form is CamelCase for attributes, so $WebName would be better than $webName. As the two attribute names are different attributes, if you do correct this one, make the new attroibute, use an agent (all notes with $webName not empty) to copy $webName to $WebName, then you can delete $webName. update all code referring to the attribute, key attribute lists etc - this is why doing the naming right pays off, it's a pain to fix later; that said the existing name works - to me it looks like a typo when I see it in actions, etc.

Agreed and done!

Quote:
'Right Frame' Agent.  No action needed - the agent only finds things descended from -'outliner' and that seeds the correct prototype which in turn sets a rule for the notes/aliases.  We don't have to do all that work again.

No, the agent does two things: it seeds the correct prototype AND, most importantly, it corrects the $HTMLExportFileName according to its sibling position ($HTMLExportFileName=^get(SiblingOrder)). I did this to ensure names are always synchronized and in order. I also use the agent to assign the template (although another method could be used, it doesn't matter). So let's leave those.

Quote:
'outliner'. OnAdd: $Prototype="*entry";

Done!

Quote:
'outliner & '*entry'. $Color: bright blue warmer. Basic 'bright blue' is way too harsh to look at for any length of time in this set-up.
Set outline MapBackgroundColor to '#292929'.
Repair defined colour 'dark warm gray' back to '#554a40'.
Open any Info view, Appearance group, select Color in the left column, then edit button at bottom. In the edit dialog change the default to 'light warm gray dark'. The grey notes will now look OK on the #292929 background.

Done, done, done!

Quote:
I'd have stuck with my way for making the image folder; but I'll agree to differ!  When images return, I doubt we'll be using the placeholder trick - not least as TB-exported images are JPEGs - your script will then fail as it expects a PNG file.  The way to get the images into this folder is to make a TB Wizard (instructions in aTbRef) when done.

Actually, in Document Preferences, we can (could) choose to export images as either jpg or png. In TB 4.7.1, I simply chose png and the two images were exported correctly, without any wizard. Maybe you forgot about that option. All I know is that it worked, while TB was handling images.

Quote:
'styles' CSS & frames css - insert a blank line line before a:visited. This is for code tidiness - no actual change.

Done!

Quote:
Links in content notes - all missing!

Not here... the last two links in note "1" are fine.

Quote:
Template 'sitemap-titles' - to get syntax to current style change entries of ^get(webName)^ to ^value($webName)^ (or to ^value($WebName)^ <g>).

Ok, done (I wonder why ^get was working).


OK. All things considered, behold:
http://dl.dropbox.com/u/76377/TinderboxForum/Outliner%26TextFrame_v5.2_MM.zip

And here, the export result:
http://dl.dropbox.com/u/76377/TinderboxForum/Export/index.html
Back to top
 
« Last Edit: Jan 05th, 2010, 3:21pm by Marcelo Mirage »  
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Making an HTML outline (expandable/contractible)
Reply #76 - Jan 5th, 2010, 4:15pm
 
JPG vs. PNG export - you're right. I was writing in a hurry and overlooked that.

Code in the agent. Make that: $HTMLExportTemplate="/Templates/page"; $HTMLExportFileName=$SiblingOrder

The ^codes are supported in action code - but for legacy reasons.  However, as this will be shared with other users, we might as well use current code. Plus it reduces the likelihood of having update the code at a later time.

The only thing that's missing is the links.  Note 1 has the 2 'wrong' links in place but not the 2 correct ones and note '2.1'. Aha! I suspect when the TBX moves to a new location, the agent is initially empty and thus the links - to its aliases - are lost before the agent re-populates. Hmm. That might be a valid reason to re-architect this bit. I wonder what Mark B thinks (he's probably in a snow-bound airport right now) - at least all(?) the other glitches in the TBX are - I think now ironed out.

Anyhow, just about done!
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Making an HTML outline (expandable/contractible)
Reply #77 - Jan 5th, 2010, 5:06pm
 
Quote:
The only thing that's missing is the links.  Note 1 has the 2 'wrong' links in place but not the 2 correct ones and note '2.1'. Aha! I suspect when the TBX moves to a new location, the agent is initially empty and thus the links - to its aliases - are lost before the agent re-populates. Hmm. That might be a valid reason to re-architect this bit


Hmm... it's worth verifying that with Mark B.. But I think you're right: the links to aliases disappear because so do aliases themselves (they're dynamically renewed). Makes sense.

Tell you the truth, I'm not satisfied with that method anyhow. It's just a temporary solution. Ideally, text links should be bound to the original notes. But that's not possible with the current system.

At least, if the user cares enough about linkage, he CAN do it (it only takes time to reassign all the links again).
Back to top
 
 
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Making an HTML outline (expandable/contractible)
Reply #78 - Jan 5th, 2010, 5:19pm
 
I'm thinking... Would an agent be able to identify all the links (text>original) and 'transpose' them automatically to the corresponding alias (text>alias)? Frankly, I don't see that happening.

But there might be a solution out there...
Back to top
 
 
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Making an HTML outline (expandable/contractible)
Reply #79 - Jan 5th, 2010, 5:36pm
 
Not time to try this here, but - if you let Outliner export all its children (which won't affect the left pane function) the links will all persist. In template 'outline-titles' change this part of the code:
<a href="right-frame/^value($WebName)^" target="view_frame">
to:
<a href="^url(this)^" target="view_frame">

The 'target' attribute loads the page in the right frame of the frameset.

If that works, you don't need 'Right Frame' at all, nor $WebName (nor the prototype code to set it).

Give it a try (in a copy of the TBX!). I'm doing this all in my head, but I think it should work.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Making an HTML outline (expandable/contractible)
Reply #80 - Jan 5th, 2010, 7:34pm
 
The $WebName attribute was created, Mark, in order to avoid unexpected HTML name conversion. It's much safer to deal with 1.html, 2.html, ... than their real names (some titles might be really big, or might contain foreign characters).

If we dispense with agent "Right Frame", we cannot assign the names by SiblingOrder, since nested notes are not siblings (I needed a place where all the notes are siblings). OutlineOrder wouldn't work either, since their numbering wouldn't begin with '1.html', and I'd like that for clarity and for keeping control (count) of all the notes exported.


But your strategy might work, the originals are exported and /Right Frame is simply in charge of converting the names... the only problem is that folders would be created with each nest. Not a problem per se, but, I find much cleaner if all the notes are placed within a single folder.

Another problem: wouldn't the notes then REALLY be exported twice? Didn't you say that wouldn't work? I run a test and find out. Stay tuned.

+++++=

YES!!!! It works!

Behold, v5.3, now with working text links:
http://dl.dropbox.com/u/76377/TinderboxForum/Outliner%26TextFrame_v5.3_MM.zip

And here's the export result:
http://dl.dropbox.com/u/76377/TinderboxForum/Export/index.html


++++++++++
(now I'll have to change the name Right Frame to something more meaningful... how about "Renamer")
Back to top
 
« Last Edit: Jan 5th, 2010, 7:48pm by Marcelo Mirage »  
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Making an HTML outline (expandable/contractible)
Reply #81 - Jan 5th, 2010, 8:03pm
 
For those who have been patiently following this thread, good news: version 5.3 is working and better than ever! You can safely download a copy from the link above. I don't think there will be radical structural changes (for now  Wink. Subsequent changes will be mostly style and fine-tuning.

Future modifications would include:

- Keyboard navigation (contrary to Mark A.'s taste, but i'd like to be able to expand/contract notes using keyboard arrow keys instead of clicking each time).
- A simple navigation menu in the right frame.
- And a few other things I have in mind.

(open for suggestions also)

Have fun!
Back to top
 
 
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Making an HTML outline (expandable/contractible)
Reply #82 - Jan 6th, 2010, 5:01am
 
That looks better!  No sign of the double export issue, but then I never did see it here.

The '*entry' prototype Rule can be deleted - it's now running in every inheriting note yet tries to populate an attribute we don't use (and which could also be deleted, by way of clearing up used features). Add this second expression to the 'outliner' and '*entry' notes' OnAdd:
   $HTMLExportTemplate="/Templates/page";
...and delete it from Renamer's AgentAction.

A neat general point to note is that:
   <a href="^url(this)^">^title^</a>
is the same as
   ^linkTo(this)^
So, where - as in your project - you need a linkTo but also want extra <a> tag attributes (target, title, etc.), then the ^url^ appraoch digs you out of the whole.

Keyboard navigation - look at a library like JQuery which might allow you to add in such functionality.  The code I put in the user-scripts will enable you to easily add this unobtrusively.

Right fame navigation.  The aTbRef source TBX's templates have good examples you can use.

With regards to export filenames, I assume you've had problems in the past with accented (Brazilian) Portuguese characters.  The Unicode support changes in v5+ ought to make those go away.

If people want default naming all they have to do is change the 'Renamer' agent (the old Def/Right Frame agent) 'Action' box code to
   $HTMLExportFileName=;
...as the latter code resets the default.  Run the agent once - check the Info view, HTML Group, of a note inside 'outliner' and check HTMLExportFileName is inheriting.  The user can then delete 'Renamer'.

Incidentally another way to give simple unique filenames, and without an agent, is to add a user attribute of date type Number with the 'sequential' option ticked. At the point of creating the attribute, TB gives a sequential number (starting from 1) to every note (probably attributes too?) in the YBX working in currnet oultine order. After that every new item is alloted the next sequence number. Although the numbers won't necessarily be a continuous sequence or matching the visual sequence of notes, the data is unique to each note and 'safe' HTML export filenames.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Making an HTML outline (expandable/contractible)
Reply #83 - Jan 6th, 2010, 11:59am
 
Quote:
The '*entry' prototype Rule can be deleted

If I delete the $WebName=$HTMLExportFileName+$HTMLExportExtension rule in *entry, how will $WebName be assembled? I did what you recommended, deleted the rule, but added the expression in the "Renamer" agent as an action.

but, on second thought:
Quote:
yet tries to populate an attribute we don't use

$WebName is not used? Oh, yeah, you're right... no need for that, since we have  $HTMLExportFileName=$SiblingOrder as a "Renamer" action to set the file name to sequential integers.

However, $WebName is indirectly used in the small outliner view for "Renamer", as a column item. Users can see the whole name of the notes to be exported (I find that reassuring, though not necessary). Of course, I could just open two columns, one for HTMLExportFileName and HTMLExportExtension, but these two attributes are not available in column view. So let's leave that, for reference.


Quote:
Incidentally another way to give simple unique filenames, and without an agent, is to add a user attribute of date type Number with the 'sequential' option ticked. At the point of creating the attribute, TB gives a sequential number (starting from 1) to every note (probably attributes too?) in the YBX working in currnet oultine order. After that every new item is alloted the next sequence number. Although the numbers won't necessarily be a continuous sequence or matching the visual sequence of notes, the data is unique to each note and 'safe' HTML export filenames.


Yes, but a continuous sequence gives us clues about the relative positions of each note that semi-random numbers would lose. It also provides a quick way of knowing the total number of notes exported.

====
Ok, I'll fix these and upload v 5.4.


Back to top
 
 
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Making an HTML outline (expandable/contractible)
Reply #84 - Jan 6th, 2010, 12:07pm
 
Here we go:
http://dl.dropbox.com/u/76377/TinderboxForum/Outliner%26TextFrame_v5.4_MM.zip

Plus, I fixed a minor glitch ("Renamer" query was looking for 'outliner' instead of "Outliner")... oops.
Back to top
 
 
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Making an HTML outline (expandable/contractible)
Reply #85 - Jan 6th, 2010, 12:13pm
 
Inter-note links still missing from note '1' (2 of 4) and note '2.1' (all 3).

Moving the Renamer into the 'control' section is a nice touch.
Back to top
 
« Last Edit: Jan 6th, 2010, 12:14pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Making an HTML outline (expandable/contractible)
Reply #86 - Jan 6th, 2010, 3:25pm
 
Ok. Links fixed.
Back to top
 
 
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Pages: 1 ... 4 5 6 
Send Topic Print