Project

dxsectionx

0.0
No commit activity in last 3 years
No release in over 3 years
Transforms entries containing Markdown within a Dynarex document into HTML using the Martile gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.8, >= 1.8.24
~> 1.4, >= 1.4.2
 Project Readme

Introducing the Dynarex SectionX (dxsectionx) gem

The following example demonstrates how text with very little modification can transformed into HTML separated by section tags.

require 'dxsectionx'

dxsx = DxSectionX.new '/home/james/media/dynarex/d250915T1907.txt'
puts dxsx.to_doc.xml pretty: true

file: d250915T1907.txt

<?dynarex schema="sections[title, original_article]/section(x)" format_mask="[!x]"?>
title: Lessons from Ralph Waldo Emerson
original_article: http://attitudes4innovation.com/7-important-lessons-from-ralph-waldo-emerson/
--#

# Lesson 1: Thoughts Rule the World

    “Great men are they who see that spiritual is stronger than any material force – that thoughts rule the world.�

If what I preach is truth, if we’re truly “in charge� of our destiny, if we’re really the captain of our souls, it is for the singular cause that we are in charge of our thoughts. The power of our kingdom resides exclusively in our thoughts. If you are ever to succeed and master your world, the first step, is to master your thoughts. Have you mastered your thoughts yet? Do you control your thoughts, or do your thoughts control you?

Thoughts rule the world! Your thoughts rule your world, they are king.

# Lesson 2: You Need To Be Rich

    “Every man is a consumer, and ought to be a producer. He is by constitution expensive, and needs to be rich.�

You should be a producer, a creator, and your creations should make you rich. What are you producing? Who are you producing it for? What are they giving you in exchange for your production? Is it making you rich? …Why isn’t it making your rich?

Ponder these questions, they hold the key to your wealth.

# Lesson 3: Be Thankful for Your Faults

    “Every man in his lifetime needs to thank his faults.�

I’ve fallen down on my knees and given thanks for my faults. My faults have brought me to where I am today. My faults have taught me, they’ve trained me, they’ve prepared me; they’ve made me a better me. I am more relevant to today because of my faults. I am grateful for the faults that I’ve made; they’ve strategically positioned me for success.

Output

<?xml version='1.0' encoding='UTF-8'?>
<sections>
  <summary>
    <title>7 Lessons from Ralph Waldo Emerson</title>
    <original_article>http://attitudes4innovation.com/7-important-lessons-from-ralph-waldo-emerson/</original_article>
    <recordx_type>dynarex</recordx_type>
    <format_mask>[!x]</format_mask>
    <schema>sections[title, original_article]/section(x)</schema>
    <default_key>x</default_key>
    <rawdoc_type>sectionx</rawdoc_type>
  </summary>
  <records>
    <section id='1' created='2015-09-25 21:10:18 +0100' last_modified=''>
      <details open='open'>
        <summary>
          <h1>Lesson 1: Thoughts Rule the World</h1>
        </summary>
        <pre>
          <code>“Great men are they who see that spiritual is stronger than any material force – that thoughts rule the world.�
</code>
        </pre>
        <p>If what I preach is truth, if we’re truly “in charge� of our destiny, if we’re really the captain of our souls, it is for the singular cause that we are in charge of our thoughts. The power of our kingdom resides exclusively in our thoughts. If you are ever to succeed and master your world, the first step, is to master your thoughts. Have you mastered your thoughts yet? Do you control your thoughts, or do your thoughts control you?</p>
        <p>Thoughts rule the world! Your thoughts rule your world, they are king.</p>
      </details>
    </section>
    <section id='2' created='2015-09-25 21:10:18 +0100' last_modified=''>
      <details open='open'>
        <summary>
          <h1>Lesson 2: You Need To Be Rich</h1>
        </summary>
        <pre>
          <code>“Every man is a consumer, and ought to be a producer. He is by constitution expensive, and needs to be rich.�
</code>
        </pre>
        <p>You should be a producer, a creator, and your creations should make you rich. What are you producing? Who are you producing it for? What are they giving you in exchange for your production? Is it making you rich? …Why isn’t it making your rich?</p>
        <p>Ponder these questions, they hold the key to your wealth.</p>
      </details>
    </section>
    <section id='3' created='2015-09-25 21:10:18 +0100' last_modified=''>
      <details open='open'>
        <summary>
          <h1>Lesson 3: Be Thankful for Your Faults</h1>
        </summary>
        <pre>
          <code>“Every man in his lifetime needs to thank his faults.�
</code>
        </pre>
        <p>I’ve fallen down on my knees and given thanks for my faults. My faults have brought me to where I am today. My faults have taught me, they’ve trained me, they’ve prepared me; they’ve made me a better me. I am more relevant to today because of my faults. I am grateful for the faults that I’ve made; they’ve strategically positioned me for success.</p>
      </details>
    </section>
  </records>
</sections>

Notes:

  • The quotes are rendered as code blocks because the text was indented 4 spaces. This could be changed to a blockquote by removing the indent and prepending the text with a greater than symbol (>). This feature works in the Markdown gem, yet isn't a feature of the Martile gem at present.
  • The code used in the dxsectionx gem originated from the LiveBlog gem.

Resources

dxsectionx