Happy stress free coding

Sep 13, 2008

Test from w2007

I have tried to blog before but man I have a hard time with this crappy editors you are supposed to use. I always want to paste code, xaml, xml and images and stuff and let's face it – it takes some work.

So now I am looking into if I can use word 2007 to reduce my stress…

 

So I wonder if I can post code:

  • public class EcoLocalTimes
  • {
    • public static IList<EcoProject1.Model.EcoLocalTime> GetData(string s)
    • {
      • if (Window1.ecoSpace==null)
        • return null;
      • return Window1.ecoSpace.Ocl.Evaluate(s).GetAsIList<EcoProject1.Model.EcoLocalTime>();
    • }
  • }

And if I can post xml

  • <ObjectDataProvider x:Key="ecolocalTimes" ObjectType="{x:Type src:EcoLocalTimes}" MethodName="GetData">
    • <ObjectDataProvider.MethodParameters>
      • <system:String>EcoLocalTime.allinstances</system:String>
    • </ObjectDataProvider.MethodParameters>
  • </ObjectDataProvider>

Seriously I just want to be able post my stuff without spending time trying to make them look ok.

To get the code and xml to intend correctly I made them as bullet lists; hence all the leading bullets. But that was not enough, I also changed the paragraph format by setting the "Don't add space between paragraphs of the same style" option.

Googling lead me to this page http://www.blooberry.com/indexdot/html/topics/indent.htm with a good compilation of my options. The page explains about the <pre> tag that supposedly should instruct the browsers display the spaces I have instead of collapsing them to one.

Great! Now I need to get the word2007 blog post – poster to use the <pre> tag around my code and xml…

Googling gave me this hit : http://codebetter.com/blogs/peter.van.ooijen/archive/2007/03/02/Formatting-source-code-in-a-blog-post-.aspx Looks like I am not alone in this… Too bad the post did not offer any solution, just sympathy.

Lets try with non breaking spaces ($160, or ctrl-shift-space)

 

        <ObjectDataProvider x:Key="ecolocalTimes" ObjectType="{x:Type src:EcoLocalTimes}" MethodName="GetData">

                <ObjectDataProvider.MethodParameters>

                        <system:String>EcoLocalTime.allinstances</system:String>

                </ObjectDataProvider.MethodParameters>

        </ObjectDataProvider>

Man – crap…Lets follow up with the setting to not add space between paras:

        <ObjectDataProvider x:Key="ecolocalTimes" ObjectType="{x:Type src:EcoLocalTimes}"  MethodName="GetData">

                <ObjectDataProvider.MethodParameters>

                        <system:String>EcoLocalTime.allinstances</system:String>

                </ObjectDataProvider.MethodParameters>

        </ObjectDataProvider>

 

Oh crap this is getting worse…

Testing a new approach; creating a new style

Does it keep rows together?

And to indent I was thinking setting the indention level

Is this working; this line and the line before is 1 in

This is 2 in

CRAP CRAP CRAP. The rows are not held together at all… Is it only lists that will do this for me?

  1. Test level1
    1. Test level2
      1. Test level3

Looks like it. Then I have a plan; write a word plugin to convert marked intended text to list-levels, and remove the silly leading list symbol… I better try to make sure that the chosen list symbol really travels to html…

  1. Test level1
    1. Test level2
      1. Test level3

That didn't go well at all. The numbers are hidden in word, but I see them in html… What about tables? Have not tried that yet:

<ObjectDataProvider x:Key="ecolocalTimes" ObjectType="{x:Type src:EcoLocalTimes}" MethodName="GetData">

 

<ObjectDataProvider.MethodParameters>

  

<system:String>EcoLocalTime.allinstances</system:String>

  

</ObjectDataProvider.MethodParameters>      

</ObjectDataProvider>

         

Incredible – this is amazingly difficult.

What about a combination; non breaking spaces and table -> table to control row height and non breaking spaces to fix indentation.

        <ObjectDataProvider x:Key="ecolocalTimes" ObjectType="{x:Type src:EcoLocalTimes}" MethodName="GetData">

                <ObjectDataProvider.MethodParameters>

                        <system:String>EcoLocalTime.allinstances</system:String>

                </ObjectDataProvider.MethodParameters>

        </ObjectDataProvider>

Of course, we now have the problems of row breaks not getting the indentation. I still think that the tables might be our best bet, but the cell merging did not work out. Let's try tables inside each cell.

Here I tried with tables in tables, but when pressing Publish word crashes.

So trying ever so slowly:

1

2

3

4

 

 

1

2

3

4

2

3

4

 

If I leave out this line word crash on publish

1

2

3

4

1

2

3

4

1

2

3

4

1

2

3

4

 

I must have this dummy to avoid the crash?

 

<ObjectDataProvider x:Key="ecolocalTimes" ObjectType="{x:Type src:EcoLocalTimes}" MethodName="GetData">

 

<ObjectDataProvider.MethodParameters>

 

<system:String>EcoLocalTime.allinstances</system:String>

 

</ObjectDataProvider.MethodParameters>

 

</ObjectDataProvider>

  

Now we are getting somewhere!

 
 

<ObjectDataProvider x:Key="ecolocalTimes" ObjectType="{x:Type src:EcoLocalTimes}" - MethodName="GetData">

 

<ObjectDataProvider.MethodParameters>

 

<system:String>EcoLocalTime.allinstances</system:String>

 

</ObjectDataProvider.MethodParameters>

 

</ObjectDataProvider>

So NOW at least I have a plan. Write a word plugin that takes the selected paragraphs; wrap each row in a table with two columns, where the first has the width of the indentation. Then wrap all those one line tables in a one column table and apply a style to it… Sounds doable…

Next post is about writing that plugin I guess…

 

 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home