SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
Literate Maruku
www.rug-b.com/wiki/show/schmidt
           2007-10-04
Literate Programming


Instead of imagining that our main task is to
   instruct a computer what to do, let us
 concentrate rather on explaining to human
  beings what we want a computer to do.

                      --- Donald E. Knuth (1984)
Implemented in

• WEB, CWEB, noweb
  • (Pascal, C, any) Code embedded in LaTeX
• RubyWeb
  • Extended RDoc syntax
• Literate Ruby (Ruby Quiz #102)
but my problem was ...
Primary use case


• Write documentation for a library
• Usage examples
• Tutorials
• How-Tos
Primary use case


• Write documentation for a library
• Usage examples
                                  Be sure that
• Tutorials                       they work !

• How-Tos                         Make them
                                   tests !!!
Some lines in test_helper.rb
  • For more information see
    Executable code in usage examples (rubyurl.com/0fO)

# The String class provides a * method
# which allows easy duplication.

example do
  output_of(quot;blaquot; * 2) == quot;blablaquot;
  output_of(quot;blaquot; * 3) == quot;blablablaquot;
end
Want that on a website?
RDoc ???
RDoc ???
            Annotates
           methods and
             classes,
           not blocks
Literate Maruku
Libraries and Names


• Maruku is as Markdown library for Ruby
• Markdown was originally done for Perl
• BlueCloth is the most popular implementation
• Maruku is better !!!
Markdown
Markdown Heading
================

A paragraph is separated by nn.

* a bullet list

> a quote

    a code block
Maruku brings Meta data

Markdown Heading
================

A paragraph is separated by nn.
{: class=introduction}

This will be replaced with a table
of contents...
{: toc}
Literate Maruku brings fun
### String#*

The String class provides a `*` method
which allows easy duplication.

    example do
      output_of(quot;blaquot; * 2) == quot;blablaquot;
      output_of(quot;blaquot; * 3) == quot;blablablaquot;
    end
{: execute}

                                   string.mkd
Literate Maruku brings fun
    ### String#*
$   literate_maruku string.mkd
    The String class provides a `*` method
#   executes the file
    which allows easy duplication.
#   like “ruby string.rb“ does
      example do
$ literate_maruku --output-dir=. string.mkd
        output_of(quot;blaquot; * 2) == quot;blablaquot;
# executes the file
        output_of(quot;blaquot; * 3) == quot;blablablaquot;
# and end
       generates string.html
  {: execute}

                                       string.mkd
But ...
No stack traces !
Where can I get it?


$ gem install literate_maruku



rug-b.rubyforge.org/literate_maruku
Example usage
 in ContextR
???

Más contenido relacionado

Similar a Literate Maruku

Rubish- A Quixotic Shell
Rubish- A Quixotic ShellRubish- A Quixotic Shell
Rubish- A Quixotic Shell
guest3464d2
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
旻琦 潘
 

Similar a Literate Maruku (20)

RSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversRSpec 3.0: Under the Covers
RSpec 3.0: Under the Covers
 
Os Wilhelm
Os WilhelmOs Wilhelm
Os Wilhelm
 
Disconnecting the Database with ActiveRecord
Disconnecting the Database with ActiveRecordDisconnecting the Database with ActiveRecord
Disconnecting the Database with ActiveRecord
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret Sauce
 
Linux network namespaces
Linux network namespacesLinux network namespaces
Linux network namespaces
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
 
Language-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible researchLanguage-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible research
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
Rubish- A Quixotic Shell
Rubish- A Quixotic ShellRubish- A Quixotic Shell
Rubish- A Quixotic Shell
 
Ruby Isn't Just About Rails
Ruby Isn't Just About RailsRuby Isn't Just About Rails
Ruby Isn't Just About Rails
 
JRuby e DSL
JRuby e DSLJRuby e DSL
JRuby e DSL
 
Playfulness at Work
Playfulness at WorkPlayfulness at Work
Playfulness at Work
 
The Essential Perl Hacker's Toolkit
The Essential Perl Hacker's ToolkitThe Essential Perl Hacker's Toolkit
The Essential Perl Hacker's Toolkit
 
A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpoint
 
Subroutines
SubroutinesSubroutines
Subroutines
 
Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentation
 
Perl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one linersPerl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one liners
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Literate Maruku

  • 2. Literate Programming Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do. --- Donald E. Knuth (1984)
  • 3. Implemented in • WEB, CWEB, noweb • (Pascal, C, any) Code embedded in LaTeX • RubyWeb • Extended RDoc syntax • Literate Ruby (Ruby Quiz #102)
  • 4. but my problem was ...
  • 5. Primary use case • Write documentation for a library • Usage examples • Tutorials • How-Tos
  • 6. Primary use case • Write documentation for a library • Usage examples Be sure that • Tutorials they work ! • How-Tos Make them tests !!!
  • 7. Some lines in test_helper.rb • For more information see Executable code in usage examples (rubyurl.com/0fO) # The String class provides a * method # which allows easy duplication. example do output_of(quot;blaquot; * 2) == quot;blablaquot; output_of(quot;blaquot; * 3) == quot;blablablaquot; end
  • 8. Want that on a website?
  • 10. RDoc ??? Annotates methods and classes, not blocks
  • 12. Libraries and Names • Maruku is as Markdown library for Ruby • Markdown was originally done for Perl • BlueCloth is the most popular implementation • Maruku is better !!!
  • 13. Markdown Markdown Heading ================ A paragraph is separated by nn. * a bullet list > a quote a code block
  • 14. Maruku brings Meta data Markdown Heading ================ A paragraph is separated by nn. {: class=introduction} This will be replaced with a table of contents... {: toc}
  • 15. Literate Maruku brings fun ### String#* The String class provides a `*` method which allows easy duplication. example do output_of(quot;blaquot; * 2) == quot;blablaquot; output_of(quot;blaquot; * 3) == quot;blablablaquot; end {: execute} string.mkd
  • 16. Literate Maruku brings fun ### String#* $ literate_maruku string.mkd The String class provides a `*` method # executes the file which allows easy duplication. # like “ruby string.rb“ does example do $ literate_maruku --output-dir=. string.mkd output_of(quot;blaquot; * 2) == quot;blablaquot; # executes the file output_of(quot;blaquot; * 3) == quot;blablablaquot; # and end generates string.html {: execute} string.mkd
  • 17. But ... No stack traces !
  • 18. Where can I get it? $ gem install literate_maruku rug-b.rubyforge.org/literate_maruku
  • 19. Example usage in ContextR
  • 20. ???