Custom BBCode for ShapeSheet Formulas

Started by Visio Guy, June 23, 2008, 10:35:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visio Guy

Anybody know much about the SMF forum and creating custom BBCode mods?

I'd like to add a custom "shapesheet" bbcode tag, so that we could get automatic, shapesheet-style formatting.

We could parse each line within the shapesheet bbcode bracket, and look for the first instance of an equals sign. Everything to the left would be red, everything else would be blue:

[shapesheet]
cellname = formula
User.foo = SIN(PI()/4)
Prop.Cost = EUR 45.00
[/shapesheet]
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Surrogate

Hi, Chris !

Sorry, for necro-posting ! But today i created own simple ShapeSheet-Style BBCode for our russian-speaking Visio forum...
You can see result there.

BBCode:
[shapesheet][h]{TEXT1}[/h][n]{TEXT2}[/n][v]{TEXT3}[/v][/shapesheet]
Example HTML[/b]:
<div class=shapesheet>
<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 width="100%"
style='width:100.0%;border-collapse:collapse;border:none;mso-border-alt:solid windowtext .5pt;
mso-yfti-tbllook:1184;mso-padding-alt:0cm 6.0pt 0cm 6.0pt'>
<span style="h: {TEXT1}; n: {TEXT2}; v: {TEXT3}"></span>
<tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
  <td width="80%" colspan=2 valign=top style='width:80.0%;border:solid windowtext 1.0pt;
  mso-border-alt:solid windowtext .5pt;background:navy;padding:0cm 6.0pt 0cm 6.0pt'>
  <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
  normal'><b style='mso-bidi-font-weight:normal'><span style='color:white;
  mso-ansi-language:EN'>{TEXT1}<o:p></o:p></span></b></p>
  </td>
</tr>
<tr style='mso-yfti-irow:1;mso-yfti-lastrow:yes'>
<td width="20%" valign=top style='width:20.0%;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  background:#A6A6A6;mso-shading:windowtext;mso-pattern:solid #A6A6A6;
  padding:0cm 6.0pt 0cm 6.0pt'>
  <p class=MsoNormal align=right style='margin-bottom:0cm;margin-bottom:.0001pt;
  text-align:right;line-height:normal'><span style='color:red;mso-ansi-language:
  EN'>{TEXT2}<o:p></o:p></span></p>
  </td>
  <td width="80%" valign=top style='width:80.0%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 6.0pt 0cm 6.0pt'>
  <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
  normal'><span style='color:blue;mso-ansi-language:EN'>{TEXT3}<o:p></o:p></span></p>
  </td>
</tr>
</table>
<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>
</div>

Description Tooltip:
[shapesheet][h]Section header[/h][n]Cell name[/n][v]Cell value[/v][/shapesheet]

Please try this BBCode, may be it works with SMF forum too ?

Visio Guy

Wow, that is really cool and impressive! It looks exactly like a ShapeSheet. I would have been happy with just Red = Blue, hahaha!
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Surrogate

Hi, Chris !

Have you tried to use this BBCode ?

Visio Guy

#4
Revisiting this after it recently came up...

User Surrogate has mentioned this a few times, and offered some tips, so I thought I'd give it a whirl. Unfortunately, it involves modifying several php files to get the syntax-highlighting to work, AND to add a button to the toolbar.

The idea is to create a custom BBCode to format ShapeSheet expressions.

I've got the tag working, just add [ss.] ... [/ss.] (no dots!) around a block of cell = formula pairs. The button is in the toolbar, but it is disabled, and I don't know how to fix it.

For example, let's format this block with the ss tag:


[ss.]
Width= Height *2
User.Bob ="Robert"
User.CustomCell =  Width + Height - Angle/360
Controls.BeamAngle = SETATREF(User.BeamAngle,SETATREFEVAL(2*ATAN2(SETATREFEXPR(Height/2+1 ft 3 in)-Height*0.5,User.HalfBeamLength)),TRUE)+Height*0.5+User.MidBeamY

// Visio supports logic tests:
User.Boolean = (Width = Height)

' VBA-style comment:
User.NotValid equals "This line is not a ShapeSheet expression!"
[/ss.]


The resulting ShapeSheet-esque code is this:

Width = Height *2
User.Bob = "Robert"
User.CustomCell =   Width + Height - Angle/360
Controls.BeamAngle = SETATREF(User.BeamAngle,SETATREFEVAL(2*ATAN2(SETATREFEXPR(Height/2+1 ft 3 in)-Height*0.5,User.HalfBeamLength)),TRUE)+Height*0.5+User.MidBeamY

// Visio supports logic tests:
User.Boolean = (Width = Height)

' VBA-style comment:
User.NotValid equals "This line is not a ShapeSheet expression!"


I think handling multiple lines with indentation and formatting would make this even better. So you could break up long formulas, but still keep the blue coloring.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Surrogate


wapperdude

Visio 2019 Pro

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 315 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1148KB.
Tokens: post-login.
Cache hits: 15: 0.00355s for 26,603 bytes (show)
Cache misses: 5: (show)
Queries used: 16.

[Show Queries]