SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
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
???

Weitere ähnliche Inhalte

Ähnlich wie 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
旻琦 潘
 

Ähnlich wie 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
 

Kürzlich hochgeladen

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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
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...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

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. ???