mirror of
https://github.com/ToshioCP/Gtk4-tutorial.git
synced 2025-01-12 20:03:28 +01:00
Update Readme_for_developers.
This commit is contained in:
parent
657507c2b3
commit
fe710713f5
4 changed files with 115 additions and 102 deletions
|
@ -112,7 +112,7 @@
|
|||
<li>download this repository and uncompress the file.</li>
|
||||
<li>change your current directory to the top directory of the source files.</li>
|
||||
<li>type <code>rake html</code> to create html files. The files are created under the <code>docs</code> directory.</li>
|
||||
<li>type <code>rake pdf</code> to create pdf file. The file is created under the <code>latex</code> directory.</li>
|
||||
<li>type <code>rake pdf</code> to create pdf a file. The file is created under the <code>latex</code> directory.</li>
|
||||
</ol>
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
<ul>
|
||||
|
@ -124,15 +124,15 @@
|
|||
</ol></li>
|
||||
<li>Ruby and rake.</li>
|
||||
<li>Pandoc. It is used to convert markdown to html and/or latex.</li>
|
||||
<li>Latex system. Texlive2020 or later version is recommended. It is used to generate pdf file.</li>
|
||||
<li>Latex system. Texlive2020 or later version is recommended. It is used to generate the pdf file.</li>
|
||||
</ul>
|
||||
<h2 id="github-flavored-markdown">Github flavored markdown</h2>
|
||||
<p>When you see <a href="https://github.com/ToshioCP/Gtk4-tutorial">gtk4_tutorial github repository</a>, you’ll find the contents of the <code>Readme.md</code> file. This file is written in markdown language. Markdown files have <code>.md</code> suffix.</p>
|
||||
<p>There are several kinds of markdown language. <code>Readme.md</code> uses ‘github flavored markdown’, which is often shortened as GFM. Markdown files in the <code>gfm</code> directory are written in GFM. If you are not familiar with it, refer to the page <a href="https://github.github.com/gfm/">github flavor markdown spec</a>.</p>
|
||||
<h2 id="pandocs-markdown">Pandoc’s markdown</h2>
|
||||
<p>This tutorial also uses another markdown – ‘pandoc’s markdown’. Pandoc is a converter between markdown, html, latex, word docx and so on. This type of markdown is used to convert markdown to html and/or latex.</p>
|
||||
<h2 id="src.md-file">Src.md file</h2>
|
||||
<p>Src.md file has “.src.md” suffix. The syntax of .src.md file is similar to markdown but it has a special command which isn’t included in markdown syntax. It is @@@ command. The command starts with a line begins with “@@@” and ends with a line “@@@”. For example,</p>
|
||||
<h2 id="src.md-file">.Src.md file</h2>
|
||||
<p>.Src.md file has “.src.md” suffix. The syntax of .src.md file is similar to markdown but it has a special command which isn’t included in markdown syntax. It is @@@ command. The command starts with a line begins with “@@@” and ends with a line “@@@”. For example,</p>
|
||||
<pre><code>@@@include
|
||||
tfeapplication.c
|
||||
@@@</code></pre>
|
||||
|
@ -147,7 +147,7 @@ tfeapplication.c
|
|||
tfeapplication.c main startup
|
||||
@@@</code></pre>
|
||||
<p>The command above is replaced by the contents of <code>main</code> and <code>startup</code> functions in the file <code>tfeapplication.c</code>.</p>
|
||||
<p>Other language’s source files are also possible. The following example shows that the ruby file ‘lib_src2.rb’ is inserted by the command.</p>
|
||||
<p>Other language’s source files are also possible. The following example shows that the ruby file ‘lib_src2md.rb’ is inserted by the command.</p>
|
||||
<pre><code>@@@include
|
||||
lib_src2md.rb
|
||||
@@@</code></pre>
|
||||
|
@ -165,7 +165,7 @@ $cat src/sample.src.md
|
|||
sample.c
|
||||
@@@
|
||||
... ...
|
||||
$ ruby src2md.rb src/sample.src.md gfm/sample.md
|
||||
$ ruby src2md.rb src/sample.src.md
|
||||
$ cat gfm/sample.md
|
||||
... ...
|
||||
~~~C
|
||||
|
@ -195,7 +195,7 @@ main (int argc, char **argv) {
|
|||
sample.c
|
||||
@@@
|
||||
... ...
|
||||
$ ruby src2md.rb src/sample.src.md gfm/sample.md
|
||||
$ ruby src2md.rb src/sample.src.md
|
||||
$ cat gfm/sample.md
|
||||
... ...
|
||||
~~~C
|
||||
|
@ -205,7 +205,7 @@ $ cat gfm/sample.md
|
|||
14 }
|
||||
~~~
|
||||
... ...</code></pre>
|
||||
<p>If a markdown is an intermediate file to html, then another type of info string follows the fence. If @@<span class="citation" data-cites="include">@include</span> command doesn’t have -N option, then the generated markdown is:</p>
|
||||
<p>If a markdown is an intermediate file to html, another type of info string follows the fence. If @@<span class="citation" data-cites="include">@include</span> command doesn’t have -N option, then the generated markdown is:</p>
|
||||
<pre><code>~~~{.C .numberLines}
|
||||
int
|
||||
main (int argc, char **argv) {
|
||||
|
@ -213,22 +213,22 @@ main (int argc, char **argv) {
|
|||
}
|
||||
~~~</code></pre>
|
||||
<p>The info string <code>.C</code> specifies C language. The info string <code>.numberLines</code> is a class of the pandoc markdown. If the class is given, pandoc generates CSS to insert line numbers to the source code in the html file. That’s why the fence code block in the markdown doesn’t have line numbers, which is different from gfm markdown. If <code>-N</code> option is given, then the info string is <code>{.C}</code> only.</p>
|
||||
<p>If a markdown is an intermediate file to latex, then the same info string follows the beginning fence.</p>
|
||||
<p>If a markdown is an intermediate file to latex, the same info string follows the beginning fence.</p>
|
||||
<pre><code>~~~{.C .numberLines}
|
||||
int
|
||||
main (int argc, char **argv) {
|
||||
... ...
|
||||
}
|
||||
~~~</code></pre>
|
||||
<p>Rake uses pandoc with –listings option when it converts markdown to latex. The generated latex file uses ‘listings package’ to list source files instead of verbatim environment. The markdown above is converted to the following latex source file.</p>
|
||||
<p>Rake uses pandoc with –listings option to convert the markdown to a latex file. The generated latex file uses ‘listings package’ to list source files instead of verbatim environment. The markdown above is converted to the following latex source file.</p>
|
||||
<pre><code>\begin{lstlisting}[language=C, numbers=left]
|
||||
int
|
||||
main (int argc, char **argv) {
|
||||
... ...
|
||||
}
|
||||
\end{lstlisting}</code></pre>
|
||||
<p>Listing package can color or emphasize keywords, strings, comments and directives. But it doesn’t really analyze the syntax of the language, so the emphasis tokens is limited.</p>
|
||||
<p>@@<span class="citation" data-cites="include">@include</span> command have two advantages.</p>
|
||||
<p>Listing package can color or emphasize keywords, strings, comments and directives. But it doesn’t really analyze the syntax of the language, so the emphasis tokens are limited.</p>
|
||||
<p>@@<span class="citation" data-cites="include">@include</span> command has two advantages.</p>
|
||||
<ol type="1">
|
||||
<li>Less typing.</li>
|
||||
<li>You don’t need to modify your .src.md file, even if the C source file is modified.</li>
|
||||
|
@ -254,7 +254,7 @@ $ wc Rakefile
|
|||
164 475 4971 Rakefile
|
||||
~~~</code></pre>
|
||||
<h3 id="if-series">@@<span class="citation" data-cites="if">@if</span> series</h3>
|
||||
<p>This type of @@@ command starts with a line begins with “@@<span class="citation" data-cites="if">@if</span>”, and followed by “@@<span class="citation" data-cites="elif">@elif</span>”, “@@<span class="citation" data-cites="else">@else</span>” or “@@<span class="citation" data-cites="end">@end</span>”. This command is similar to “#if”, “#elif”, #else" and “#endif” directives in C preprocessor. For example,</p>
|
||||
<p>This type of @@@ command starts with a line begins with “@@<span class="citation" data-cites="if">@if</span>”, and followed by “@@<span class="citation" data-cites="elif">@elif</span>”, “@@<span class="citation" data-cites="else">@else</span>” or “@@<span class="citation" data-cites="end">@end</span>”. This command is similar to “#if”, “#elif”, #else" and “#endif” directives in the C preprocessor. For example,</p>
|
||||
<pre><code>@@@if gfm
|
||||
Refer to [tfetextview API reference](tfetextview_doc.md)
|
||||
@@@elif html
|
||||
|
@ -266,7 +266,7 @@ Refer to tfetextview API reference in appendix.
|
|||
<ul>
|
||||
<li>gfm: if the target is GFM</li>
|
||||
<li>html: if the target is html</li>
|
||||
<li>latex: if the target is latex (or pdf).</li>
|
||||
<li>latex: if the target is pdf.</li>
|
||||
</ul>
|
||||
<p>Other type of conditions may be available in the future version.</p>
|
||||
<p>The code analyzing @@<span class="citation" data-cites="if">@if</span> series command is rather complicated. It is based on the state diagram below.</p>
|
||||
|
@ -274,7 +274,7 @@ Refer to tfetextview API reference in appendix.
|
|||
<img src="image/state_diagram.png" alt="" /><figcaption>state diagram</figcaption>
|
||||
</figure>
|
||||
<h3 id="table">@@<span class="citation" data-cites="table">@table</span></h3>
|
||||
<p>This type of @@@ command starts with a line begins with “@@<span class="citation" data-cites="table">@table</span>”. The contents of this command is a table of GFM or pandoc’s markdown. The command makes a table easy to read. For example, a text file <code>sample.md</code> has a table like this:</p>
|
||||
<p>This type of @@@ command starts with a line begins with “@@<span class="citation" data-cites="table">@table</span>”. The contents of this command is a table of the GFM or pandoc’s markdown. The command makes a table easy to read. For example, a text file <code>sample.md</code> has a table like this:</p>
|
||||
<pre><code>Price list
|
||||
|
||||
@@@table
|
||||
|
@ -293,15 +293,16 @@ Refer to tfetextview API reference in appendix.
|
|||
<p>This command just changes the appearance of the table. There’s no influence on html/latex files that is converted from the markdown. Notice that the command supports only the above type of markdown table format.</p>
|
||||
<p>A script <code>mktbl.rb</code> supports this command. If you run the script like this:</p>
|
||||
<pre><code>$ ruby mktbl.rb sample.md</code></pre>
|
||||
<p>The script also makes a backup file <code>sample.md.bak</code>.</p>
|
||||
<p>Then, the tables in ‘sample.md’ will be arranged. The script also makes a backup file <code>sample.md.bak</code>.</p>
|
||||
<p>The task of the script seems easy, but the program is not so simple. The script <code>mktbl.rb</code> uses a library <code>lib/lib_src2md.rb</code></p>
|
||||
<p>@@<span class="citation" data-cites="commands">@commands</span> are effective in the whole text. This means you can’t stop the @@<span class="citation" data-cites="commands">@commands</span>. But sometimes you want to show the commands literally like this document. One solution is to add four blanks at the top of the line. Then @@<span class="citation" data-cites="commands">@commands</span> are not effective because @@<span class="citation" data-cites="commands">@commands</span> must be at the top of the line.</p>
|
||||
<h2 id="conversion">Conversion</h2>
|
||||
<p>The @@@ commands are carried out by a method <code>src2md</code>, which is in the file <code>lib/lib_src2md.rb</code>. This method converts <code>.src.md</code> file into <code>.md</code> file. In addition, some other conversions are made by <code>src2md</code> method.</p>
|
||||
<ul>
|
||||
<li>Relative links are changed according to the change of the base directory.</li>
|
||||
<li>Size option in image link is removed when the destination is GFM or html.</li>
|
||||
<li>Relative link is removed when the destination is html and/or latex.</li>
|
||||
<li>Size option in an image link is removed when the destination is GFM or html.</li>
|
||||
<li>Relative link is removed except .src.md files when the destination is html.</li>
|
||||
<li>Relative link is removed when the destination is latex.</li>
|
||||
</ul>
|
||||
<p>The order of the conversions are:</p>
|
||||
<ol type="1">
|
||||
|
@ -311,15 +312,15 @@ Refer to tfetextview API reference in appendix.
|
|||
<li>@@<span class="citation" data-cites="shell">@shell</span></li>
|
||||
<li>others</li>
|
||||
</ol>
|
||||
<p>There is <code>src2md.rb</code> file in the top directory of this repository. It just invokes the method <code>src2md</code>. In the same way, the method is called in the action in the <code>Rakefile</code>.</p>
|
||||
<p>There is the <code>src2md.rb</code> file in the top directory of this repository. It just invokes the method <code>src2md</code>. In the same way, the method is called in the action in the <code>Rakefile</code>.</p>
|
||||
<h2 id="directory-structure">Directory structure</h2>
|
||||
<p>There are seven directories under <code>gtk4_tutorial</code> directory. They are <code>gfm</code>, <code>docs</code>, <code>latex</code>, <code>src</code>, <code>image</code>, <code>test</code> and <code>lib</code>. Three directories <code>gfm</code>, <code>docs</code> and <code>latex</code> are the destination directories for GFM, html and latex files respectively. It is possible that these three directories don’t exist before the conversion.</p>
|
||||
<ul>
|
||||
<li>src: This directory contains .src.md files and C-related source files.</li>
|
||||
<li>image: This directory contains image files like png or jpg.</li>
|
||||
<li>gfm: <code>rake</code> converts src.md files to GFM files and store them in this directory.</li>
|
||||
<li>docs: <code>rake html</code> will convert src.md files to html files and store them in this directory.</li>
|
||||
<li>latex: <code>rake pdf</code> will convert src.md files to latex files and store them in this directory. Finally it creates a pdf file in <code>latex</code> directory.</li>
|
||||
<li>gfm: <code>rake</code> converts .src.md files to GFM files and store them in this directory.</li>
|
||||
<li>docs: <code>rake html</code> will convert .src.md files to html files and store them in this directory.</li>
|
||||
<li>latex: <code>rake pdf</code> will convert .src.md files to latex files and store them in this directory. Finally it creates a pdf file in <code>latex</code> directory.</li>
|
||||
<li>lib: This directory includes ruby library files.</li>
|
||||
<li>test: This directory contains test files. The tests are carried out by typing <code>rake test</code> on the terminal.</li>
|
||||
</ul>
|
||||
|
@ -327,25 +328,27 @@ Refer to tfetextview API reference in appendix.
|
|||
<p>Src directory contains .src.md files and C-related source files. The top directory, which is gtk_tutorial directory, contains <code>Rakefile</code>, <code>src2md.rb</code> and some other files. When <code>Readme.md</code> is generated, it will be located at the top directory. <code>Readme.md</code> has title, abstract, table of contents with links to GFM files.</p>
|
||||
<p>Rakefile describes how to convert .src.md files into GFM, html and/or pdf files. Rake carries out the conversion according to the <code>Rakefile</code>.</p>
|
||||
<h2 id="the-name-of-files-in-src-directory">The name of files in src directory</h2>
|
||||
<p>Each file in <code>src</code> directory is an abstract, sections of the whole document and other .src.md files. An <code>abstract.src.md</code> contains the abstract of this tutorial. Each section filename is “sec”, number of the section and “.src.md” suffix. For example, “sec1.src.md”, “sec5.src.md” or “sec12.src.md”. They are the files correspond to section 1, section 5 and section 12 respectively.</p>
|
||||
<p>Files in <code>src</code> directory are an abstract, sections of the document and other .src.md files. An <code>abstract.src.md</code> contains the abstract of this tutorial. Each section filename is “sec”, number of the section and “.src.md” suffix. For example, “sec1.src.md”, “sec5.src.md” or “sec12.src.md”. They are the files correspond to the section 1, section 5 and section 12 respectively.</p>
|
||||
<h2 id="c-source-file-directory">C source file directory</h2>
|
||||
<p>Most of .src.md files have <code>@@@include</code> commands and they include C source files. Such C source files are located in the subdirectories of <code>src</code> directory.</p>
|
||||
<p>Those C files have been compiled and tested. When you compile source files, some auxiliary files and a target file like <code>a.out</code> are created. Or <code>_build</code> directory is made when <code>meson</code> and <code>ninja</code> is used when compiling. Those files are not tracked by <code>git</code> because they are specified in <code>.gitignore</code>.</p>
|
||||
<p>The name of the subdirectories should be independent of section names. It is because of renumbering, which will be explained in the next subsection.</p>
|
||||
<h2 id="renumbering">Renumbering</h2>
|
||||
<p>Sometimes you might want to insert a section. For example, you want to insert it between section 4 and section 5. You can make a temporary section 4.5, that is a rational number between 4 and 5. However, section numbers are usually integer so section 4.5 must be changed to section 5. And the numbers of the following sections must be increased by one.</p>
|
||||
<p>This renumbering is done by a method <code>renum!</code> of the class <code>Sec_files</code>. The method and class is written in <code>lib/lib_sec_file.rb</code>.</p>
|
||||
<p>Sometimes you might want to insert a new section. For example, you want to insert it between section 4 and section 5. You can make a temporary section 4.5, that is a rational number between 4 and 5. However, section numbers are usually integer so section 4.5 must be changed to section 5. And the numbers of the following sections must be increased by one.</p>
|
||||
<p>This renumbering is done by the <code>renumber</code> method in the <code>lib/lib_renumber.rb</code> file.</p>
|
||||
<ul>
|
||||
<li>It changes file names.</li>
|
||||
<li>If there are references to sections in .src.md files, the section numbers will be automatically renumbered.</li>
|
||||
<li>If there are references (links) to sections in .src.md files, the section numbers will be automatically renumbered.</li>
|
||||
</ul>
|
||||
<h2 id="rakefile">Rakefile</h2>
|
||||
<p>Rakefile is a similar file to Makefile but controlled by rake, which is a make-like program written in ruby. Rakefile in this tutorial has the following tasks.</p>
|
||||
<p>Rakefile is similar to Makefile but controlled by rake, which is a ruby script. Rakefile in this tutorial has the following tasks.</p>
|
||||
<ul>
|
||||
<li>md: generate GFM markdown files. This is the default.</li>
|
||||
<li>html: generate html files.</li>
|
||||
<li>pdf: generate latex files and a pdf file, which is compiled by lualatex.</li>
|
||||
<li>all: generate md, html and pdf files.</li>
|
||||
<li>clean: delete latex intermediate files.</li>
|
||||
<li>clobber: delete all the generated files.</li>
|
||||
</ul>
|
||||
<p>Rake does renumbering before the tasks above.</p>
|
||||
<h2 id="generate-gfm-markdown-files">Generate GFM markdown files</h2>
|
||||
|
@ -355,7 +358,7 @@ Refer to tfetextview API reference in appendix.
|
|||
<p>You can describe width and height of images in .src.md files. For example,</p>
|
||||
<pre><code>![sample image](../image/sample_image.png){width=10cm height=6cm}</code></pre>
|
||||
<p>The size between left brace and right brace is used in latex file and it is not fit to GFM syntax. So the size will be removed in the conversion.</p>
|
||||
<p>If a .src.md file has relative URL link, it will be changed by conversion. Because .src.md files are located under <code>src</code> directory and GFM files are located under <code>gfm</code> directory, base URL of GFM files is different from base URL of .src.md files. For example, <code>[src/sample.c](sample.c)</code> is translated to <code>[src/sample.c](../src/sample.c)</code>.</p>
|
||||
<p>If a .src.md file has relative URL links, they will be changed by conversion. Because .src.md files are located under the <code>src</code> directory and GFM files are located under the <code>gfm</code> directory. That means the base directory of the relative link are different. For example, <code>[src/sample.c](sample.c)</code> is translated to <code>[src/sample.c](../src/sample.c)</code>.</p>
|
||||
<p>If a link points another .src.md file, then the target filename will be changed to .md file. For example, <code>[Section 5](sec5.src.md)</code> is translated to <code>[Section 5](sec5.md)</code>.</p>
|
||||
<p>If you want to clean the directory, that means remove all the generated markdown files, type <code>rake clobber</code>.</p>
|
||||
<pre><code>$ rake clobber</code></pre>
|
||||
|
@ -373,7 +376,7 @@ $ rake</code></pre>
|
|||
<p>Image files are copied to <code>docs/image</code> direcotiry and links to them will be converted like this:</p>
|
||||
<pre><code>[sample.png](../image/sample.png) => [sample.png](image/sample.png)</code></pre>
|
||||
<p>Other relative links will be removed.</p>
|
||||
<p><code>index.html</code> is the top html file. If you want to clean html files, type <code>rake clobber</code></p>
|
||||
<p><code>index.html</code> is the top html file. If you want to clean html files, type <code>rake clobber</code> or <code>cleanhtml</code>.</p>
|
||||
<pre><code>$ rake clobber</code></pre>
|
||||
<p>Every html file has a header (<code><head> -- </head></code>). It is created by pandoc with ‘-s’ option. You can customize the output with your own template file for pandoc. Rake uses <code>lib/lib_mk_html_template.rb</code> to create its own template. The template inserts bootstrap CSS and Javascript through <code>jsDelivr</code>.</p>
|
||||
<p>The <code>docs</code> directory contains all the necessary html files. They are used in the <a href="https://ToshioCP.github.io/Gtk4-tutorial">github pages</a> of this repository.</p>
|
||||
|
@ -387,8 +390,8 @@ $ rake</code></pre>
|
|||
<p>You need to specify appropriate width and height. It is almost <code>0.015 x pixels</code> cm. For example, if the width of an image is 400 pixels, the width in a latex file will be almost 6cm.</p>
|
||||
<p>A file <code>main.tex</code> is the root file of all the generated latex files. It has <code>\input</code> commands, which inserts each section file, between <code>\begin{document}</code> and <code>\end{document}</code>. It also has <code>\input</code>, which inserts <code>helper.tex</code>, in the preamble. Two files <code>main.tex</code> and <code>helper.tex</code> are created by <code>lib/lib_gen_main_tex.rb</code>. It has a sample markdown code and converts it witn <code>pandoc -s</code>. Then, it extracts the preamble in the generated file and puts it into <code>helper.tex</code>. You can customize <code>helper.tex</code> by modifying <code>lib/lib_gen_main_tex.rb</code>.</p>
|
||||
<p>Finally, lualatex compiles the <code>main.tex</code> into a pdf file.</p>
|
||||
<p>If you want to clean <code>latex</code> directory, type <code>rake cleanlatex</code></p>
|
||||
<pre><code>$ rake cleanlatex</code></pre>
|
||||
<p>If you want to clean <code>latex</code> directory, type <code>rake clobber</code> or <code>rake cleanlatex</code></p>
|
||||
<pre><code>$ rake clobber</code></pre>
|
||||
<p>This removes all the latex source files and a pdf file.</p>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
2. download this repository and uncompress the file.
|
||||
3. change your current directory to the top directory of the source files.
|
||||
4. type `rake html` to create html files. The files are created under the `docs` directory.
|
||||
5. type `rake pdf` to create pdf file. The file is created under the `latex` directory.
|
||||
5. type `rake pdf` to create pdf a file. The file is created under the `latex` directory.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
@ -22,7 +22,7 @@ Then, click "Download ZIP".
|
|||
- Ruby and rake.
|
||||
- Pandoc. It is used to convert markdown to html and/or latex.
|
||||
- Latex system. Texlive2020 or later version is recommended.
|
||||
It is used to generate pdf file.
|
||||
It is used to generate the pdf file.
|
||||
|
||||
## Github flavored markdown
|
||||
|
||||
|
@ -41,9 +41,9 @@ This tutorial also uses another markdown -- 'pandoc's markdown'.
|
|||
Pandoc is a converter between markdown, html, latex, word docx and so on.
|
||||
This type of markdown is used to convert markdown to html and/or latex.
|
||||
|
||||
## Src.md file
|
||||
## .Src.md file
|
||||
|
||||
Src.md file has ".src.md" suffix.
|
||||
.Src.md file has ".src.md" suffix.
|
||||
The syntax of .src.md file is similar to markdown but it has a special command which isn't included in markdown syntax.
|
||||
It is @@@ command.
|
||||
The command starts with a line begins with "@@@" and ends with a line "@@@".
|
||||
|
@ -73,7 +73,7 @@ If a function list follows the filename, only the functions are read.
|
|||
The command above is replaced by the contents of `main` and `startup` functions in the file `tfeapplication.c`.
|
||||
|
||||
Other language's source files are also possible.
|
||||
The following example shows that the ruby file 'lib_src2.rb' is inserted by the command.
|
||||
The following example shows that the ruby file 'lib_src2md.rb' is inserted by the command.
|
||||
|
||||
@@@include
|
||||
lib_src2md.rb
|
||||
|
@ -100,7 +100,7 @@ The following example shows that the @@@ command includes a C source file `sampl
|
|||
sample.c
|
||||
@@@
|
||||
... ...
|
||||
$ ruby src2md.rb src/sample.src.md gfm/sample.md
|
||||
$ ruby src2md.rb src/sample.src.md
|
||||
$ cat gfm/sample.md
|
||||
... ...
|
||||
~~~C
|
||||
|
@ -136,7 +136,7 @@ The following shows that the line numbers are inserted at the beginning of each
|
|||
sample.c
|
||||
@@@
|
||||
... ...
|
||||
$ ruby src2md.rb src/sample.src.md gfm/sample.md
|
||||
$ ruby src2md.rb src/sample.src.md
|
||||
$ cat gfm/sample.md
|
||||
... ...
|
||||
~~~C
|
||||
|
@ -147,7 +147,7 @@ The following shows that the line numbers are inserted at the beginning of each
|
|||
~~~
|
||||
... ...
|
||||
|
||||
If a markdown is an intermediate file to html, then another type of info string follows the fence.
|
||||
If a markdown is an intermediate file to html, another type of info string follows the fence.
|
||||
If @@@include command doesn't have -N option, then the generated markdown is:
|
||||
|
||||
~~~{.C .numberLines}
|
||||
|
@ -163,7 +163,7 @@ If the class is given, pandoc generates CSS to insert line numbers to the source
|
|||
That's why the fence code block in the markdown doesn't have line numbers, which is different from gfm markdown.
|
||||
If `-N` option is given, then the info string is `{.C}` only.
|
||||
|
||||
If a markdown is an intermediate file to latex, then the same info string follows the beginning fence.
|
||||
If a markdown is an intermediate file to latex, the same info string follows the beginning fence.
|
||||
|
||||
~~~{.C .numberLines}
|
||||
int
|
||||
|
@ -172,7 +172,7 @@ If a markdown is an intermediate file to latex, then the same info string follow
|
|||
}
|
||||
~~~
|
||||
|
||||
Rake uses pandoc with --listings option when it converts markdown to latex.
|
||||
Rake uses pandoc with --listings option to convert the markdown to a latex file.
|
||||
The generated latex file uses 'listings package' to list source files instead of verbatim environment.
|
||||
The markdown above is converted to the following latex source file.
|
||||
|
||||
|
@ -184,9 +184,9 @@ The markdown above is converted to the following latex source file.
|
|||
\end{lstlisting}
|
||||
|
||||
Listing package can color or emphasize keywords, strings, comments and directives.
|
||||
But it doesn't really analyze the syntax of the language, so the emphasis tokens is limited.
|
||||
But it doesn't really analyze the syntax of the language, so the emphasis tokens are limited.
|
||||
|
||||
@@@include command have two advantages.
|
||||
@@@include command has two advantages.
|
||||
|
||||
1. Less typing.
|
||||
2. You don't need to modify your .src.md file, even if the C source file is modified.
|
||||
|
@ -221,7 +221,7 @@ This is converted to:
|
|||
### @@@if series
|
||||
|
||||
This type of @@@ command starts with a line begins with "@@@if", and followed by "@@@elif", "@@@else" or "@@@end".
|
||||
This command is similar to "#if", "#elif", #else" and "#endif" directives in C preprocessor.
|
||||
This command is similar to "#if", "#elif", #else" and "#endif" directives in the C preprocessor.
|
||||
For example,
|
||||
|
||||
@@@if gfm
|
||||
|
@ -237,7 +237,7 @@ They are `gfm`, `html` or `latex` so far.
|
|||
|
||||
- gfm: if the target is GFM
|
||||
- html: if the target is html
|
||||
- latex: if the target is latex (or pdf).
|
||||
- latex: if the target is pdf.
|
||||
|
||||
Other type of conditions may be available in the future version.
|
||||
|
||||
|
@ -249,7 +249,7 @@ It is based on the state diagram below.
|
|||
### @@@table
|
||||
|
||||
This type of @@@ command starts with a line begins with "@@@table".
|
||||
The contents of this command is a table of GFM or pandoc's markdown.
|
||||
The contents of this command is a table of the GFM or pandoc's markdown.
|
||||
The command makes a table easy to read.
|
||||
For example, a text file `sample.md` has a table like this:
|
||||
|
||||
|
@ -284,6 +284,7 @@ If you run the script like this:
|
|||
$ ruby mktbl.rb sample.md
|
||||
~~~
|
||||
|
||||
Then, the tables in 'sample.md' will be arranged.
|
||||
The script also makes a backup file `sample.md.bak`.
|
||||
|
||||
The task of the script seems easy, but the program is not so simple.
|
||||
|
@ -303,8 +304,9 @@ This method converts `.src.md` file into `.md` file.
|
|||
In addition, some other conversions are made by `src2md` method.
|
||||
|
||||
- Relative links are changed according to the change of the base directory.
|
||||
- Size option in image link is removed when the destination is GFM or html.
|
||||
- Relative link is removed when the destination is html and/or latex.
|
||||
- Size option in an image link is removed when the destination is GFM or html.
|
||||
- Relative link is removed except .src.md files when the destination is html.
|
||||
- Relative link is removed when the destination is latex.
|
||||
|
||||
The order of the conversions are:
|
||||
|
||||
|
@ -314,7 +316,7 @@ The order of the conversions are:
|
|||
4. @@@shell
|
||||
5. others
|
||||
|
||||
There is `src2md.rb` file in the top directory of this repository.
|
||||
There is the `src2md.rb` file in the top directory of this repository.
|
||||
It just invokes the method `src2md`.
|
||||
In the same way, the method is called in the action in the `Rakefile`.
|
||||
|
||||
|
@ -327,9 +329,9 @@ It is possible that these three directories don't exist before the conversion.
|
|||
|
||||
- src: This directory contains .src.md files and C-related source files.
|
||||
- image: This directory contains image files like png or jpg.
|
||||
- gfm: `rake` converts src.md files to GFM files and store them in this directory.
|
||||
- docs: `rake html` will convert src.md files to html files and store them in this directory.
|
||||
- latex: `rake pdf` will convert src.md files to latex files and store them in this directory.
|
||||
- gfm: `rake` converts .src.md files to GFM files and store them in this directory.
|
||||
- docs: `rake html` will convert .src.md files to html files and store them in this directory.
|
||||
- latex: `rake pdf` will convert .src.md files to latex files and store them in this directory.
|
||||
Finally it creates a pdf file in `latex` directory.
|
||||
- lib: This directory includes ruby library files.
|
||||
- test: This directory contains test files.
|
||||
|
@ -347,11 +349,11 @@ Rake carries out the conversion according to the `Rakefile`.
|
|||
|
||||
## The name of files in src directory
|
||||
|
||||
Each file in `src` directory is an abstract, sections of the whole document and other .src.md files.
|
||||
Files in `src` directory are an abstract, sections of the document and other .src.md files.
|
||||
An `abstract.src.md` contains the abstract of this tutorial.
|
||||
Each section filename is "sec", number of the section and ".src.md" suffix.
|
||||
For example, "sec1.src.md", "sec5.src.md" or "sec12.src.md".
|
||||
They are the files correspond to section 1, section 5 and section 12 respectively.
|
||||
They are the files correspond to the section 1, section 5 and section 12 respectively.
|
||||
|
||||
## C source file directory
|
||||
|
||||
|
@ -368,27 +370,28 @@ It is because of renumbering, which will be explained in the next subsection.
|
|||
|
||||
## Renumbering
|
||||
|
||||
Sometimes you might want to insert a section.
|
||||
Sometimes you might want to insert a new section.
|
||||
For example, you want to insert it between section 4 and section 5.
|
||||
You can make a temporary section 4.5, that is a rational number between 4 and 5.
|
||||
However, section numbers are usually integer so section 4.5 must be changed to section 5.
|
||||
And the numbers of the following sections must be increased by one.
|
||||
|
||||
This renumbering is done by a method `renum!` of the class `Sec_files`.
|
||||
The method and class is written in `lib/lib_sec_file.rb`.
|
||||
This renumbering is done by the `renumber` method in the `lib/lib_renumber.rb` file.
|
||||
|
||||
- It changes file names.
|
||||
- If there are references to sections in .src.md files, the section numbers will be automatically renumbered.
|
||||
- If there are references (links) to sections in .src.md files, the section numbers will be automatically renumbered.
|
||||
|
||||
## Rakefile
|
||||
|
||||
Rakefile is a similar file to Makefile but controlled by rake, which is a make-like program written in ruby.
|
||||
Rakefile is similar to Makefile but controlled by rake, which is a ruby script.
|
||||
Rakefile in this tutorial has the following tasks.
|
||||
|
||||
- md: generate GFM markdown files. This is the default.
|
||||
- html: generate html files.
|
||||
- pdf: generate latex files and a pdf file, which is compiled by lualatex.
|
||||
- all: generate md, html and pdf files.
|
||||
- clean: delete latex intermediate files.
|
||||
- clobber: delete all the generated files.
|
||||
|
||||
Rake does renumbering before the tasks above.
|
||||
|
||||
|
@ -410,8 +413,9 @@ For example,
|
|||
The size between left brace and right brace is used in latex file and it is not fit to GFM syntax.
|
||||
So the size will be removed in the conversion.
|
||||
|
||||
If a .src.md file has relative URL link, it will be changed by conversion.
|
||||
Because .src.md files are located under `src` directory and GFM files are located under `gfm` directory, base URL of GFM files is different from base URL of .src.md files.
|
||||
If a .src.md file has relative URL links, they will be changed by conversion.
|
||||
Because .src.md files are located under the `src` directory and GFM files are located under the `gfm` directory.
|
||||
That means the base directory of the relative link are different.
|
||||
For example, `[src/sample.c](sample.c)` is translated to `[src/sample.c](../src/sample.c)`.
|
||||
|
||||
If a link points another .src.md file, then the target filename will be changed to .md file.
|
||||
|
@ -460,7 +464,7 @@ Image files are copied to `docs/image` direcotiry and links to them will be conv
|
|||
Other relative links will be removed.
|
||||
|
||||
`index.html` is the top html file.
|
||||
If you want to clean html files, type `rake clobber`
|
||||
If you want to clean html files, type `rake clobber` or `cleanhtml`.
|
||||
|
||||
$ rake clobber
|
||||
|
||||
|
@ -505,8 +509,8 @@ You can customize `helper.tex` by modifying `lib/lib_gen_main_tex.rb`.
|
|||
|
||||
Finally, lualatex compiles the `main.tex` into a pdf file.
|
||||
|
||||
If you want to clean `latex` directory, type `rake cleanlatex`
|
||||
If you want to clean `latex` directory, type `rake clobber` or `rake cleanlatex`
|
||||
|
||||
$ rake cleanlatex
|
||||
$ rake clobber
|
||||
|
||||
This removes all the latex source files and a pdf file.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
2. download this repository and uncompress the file.
|
||||
3. change your current directory to the top directory of the source files.
|
||||
4. type `rake html` to create html files. The files are created under the `docs` directory.
|
||||
5. type `rake pdf` to create pdf file. The file is created under the `latex` directory.
|
||||
5. type `rake pdf` to create pdf a file. The file is created under the `latex` directory.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
@ -22,7 +22,7 @@ Then, click "Download ZIP".
|
|||
- Ruby and rake.
|
||||
- Pandoc. It is used to convert markdown to html and/or latex.
|
||||
- Latex system. Texlive2020 or later version is recommended.
|
||||
It is used to generate pdf file.
|
||||
It is used to generate the pdf file.
|
||||
|
||||
## Github flavored markdown
|
||||
|
||||
|
@ -41,9 +41,9 @@ This tutorial also uses another markdown -- 'pandoc's markdown'.
|
|||
Pandoc is a converter between markdown, html, latex, word docx and so on.
|
||||
This type of markdown is used to convert markdown to html and/or latex.
|
||||
|
||||
## Src.md file
|
||||
## .Src.md file
|
||||
|
||||
Src.md file has ".src.md" suffix.
|
||||
.Src.md file has ".src.md" suffix.
|
||||
The syntax of .src.md file is similar to markdown but it has a special command which isn't included in markdown syntax.
|
||||
It is @@@ command.
|
||||
The command starts with a line begins with "@@@" and ends with a line "@@@".
|
||||
|
@ -73,7 +73,7 @@ If a function list follows the filename, only the functions are read.
|
|||
The command above is replaced by the contents of `main` and `startup` functions in the file `tfeapplication.c`.
|
||||
|
||||
Other language's source files are also possible.
|
||||
The following example shows that the ruby file 'lib_src2.rb' is inserted by the command.
|
||||
The following example shows that the ruby file 'lib_src2md.rb' is inserted by the command.
|
||||
|
||||
@@@include
|
||||
lib_src2md.rb
|
||||
|
@ -100,7 +100,7 @@ The following example shows that the @@@ command includes a C source file `sampl
|
|||
sample.c
|
||||
@@@
|
||||
... ...
|
||||
$ ruby src2md.rb src/sample.src.md gfm/sample.md
|
||||
$ ruby src2md.rb src/sample.src.md
|
||||
$ cat gfm/sample.md
|
||||
... ...
|
||||
~~~C
|
||||
|
@ -136,7 +136,7 @@ The following shows that the line numbers are inserted at the beginning of each
|
|||
sample.c
|
||||
@@@
|
||||
... ...
|
||||
$ ruby src2md.rb src/sample.src.md gfm/sample.md
|
||||
$ ruby src2md.rb src/sample.src.md
|
||||
$ cat gfm/sample.md
|
||||
... ...
|
||||
~~~C
|
||||
|
@ -147,7 +147,7 @@ The following shows that the line numbers are inserted at the beginning of each
|
|||
~~~
|
||||
... ...
|
||||
|
||||
If a markdown is an intermediate file to html, then another type of info string follows the fence.
|
||||
If a markdown is an intermediate file to html, another type of info string follows the fence.
|
||||
If @@@include command doesn't have -N option, then the generated markdown is:
|
||||
|
||||
~~~{.C .numberLines}
|
||||
|
@ -163,7 +163,7 @@ If the class is given, pandoc generates CSS to insert line numbers to the source
|
|||
That's why the fence code block in the markdown doesn't have line numbers, which is different from gfm markdown.
|
||||
If `-N` option is given, then the info string is `{.C}` only.
|
||||
|
||||
If a markdown is an intermediate file to latex, then the same info string follows the beginning fence.
|
||||
If a markdown is an intermediate file to latex, the same info string follows the beginning fence.
|
||||
|
||||
~~~{.C .numberLines}
|
||||
int
|
||||
|
@ -172,7 +172,7 @@ If a markdown is an intermediate file to latex, then the same info string follow
|
|||
}
|
||||
~~~
|
||||
|
||||
Rake uses pandoc with --listings option when it converts markdown to latex.
|
||||
Rake uses pandoc with --listings option to convert the markdown to a latex file.
|
||||
The generated latex file uses 'listings package' to list source files instead of verbatim environment.
|
||||
The markdown above is converted to the following latex source file.
|
||||
|
||||
|
@ -184,9 +184,9 @@ The markdown above is converted to the following latex source file.
|
|||
\end{lstlisting}
|
||||
|
||||
Listing package can color or emphasize keywords, strings, comments and directives.
|
||||
But it doesn't really analyze the syntax of the language, so the emphasis tokens is limited.
|
||||
But it doesn't really analyze the syntax of the language, so the emphasis tokens are limited.
|
||||
|
||||
@@@include command have two advantages.
|
||||
@@@include command has two advantages.
|
||||
|
||||
1. Less typing.
|
||||
2. You don't need to modify your .src.md file, even if the C source file is modified.
|
||||
|
@ -221,7 +221,7 @@ This is converted to:
|
|||
### @@@if series
|
||||
|
||||
This type of @@@ command starts with a line begins with "@@@if", and followed by "@@@elif", "@@@else" or "@@@end".
|
||||
This command is similar to "#if", "#elif", #else" and "#endif" directives in C preprocessor.
|
||||
This command is similar to "#if", "#elif", #else" and "#endif" directives in the C preprocessor.
|
||||
For example,
|
||||
|
||||
@@@if gfm
|
||||
|
@ -237,7 +237,7 @@ They are `gfm`, `html` or `latex` so far.
|
|||
|
||||
- gfm: if the target is GFM
|
||||
- html: if the target is html
|
||||
- latex: if the target is latex (or pdf).
|
||||
- latex: if the target is pdf.
|
||||
|
||||
Other type of conditions may be available in the future version.
|
||||
|
||||
|
@ -249,7 +249,7 @@ It is based on the state diagram below.
|
|||
### @@@table
|
||||
|
||||
This type of @@@ command starts with a line begins with "@@@table".
|
||||
The contents of this command is a table of GFM or pandoc's markdown.
|
||||
The contents of this command is a table of the GFM or pandoc's markdown.
|
||||
The command makes a table easy to read.
|
||||
For example, a text file `sample.md` has a table like this:
|
||||
|
||||
|
@ -284,6 +284,7 @@ If you run the script like this:
|
|||
$ ruby mktbl.rb sample.md
|
||||
~~~
|
||||
|
||||
Then, the tables in 'sample.md' will be arranged.
|
||||
The script also makes a backup file `sample.md.bak`.
|
||||
|
||||
The task of the script seems easy, but the program is not so simple.
|
||||
|
@ -303,8 +304,9 @@ This method converts `.src.md` file into `.md` file.
|
|||
In addition, some other conversions are made by `src2md` method.
|
||||
|
||||
- Relative links are changed according to the change of the base directory.
|
||||
- Size option in image link is removed when the destination is GFM or html.
|
||||
- Relative link is removed when the destination is html and/or latex.
|
||||
- Size option in an image link is removed when the destination is GFM or html.
|
||||
- Relative link is removed except .src.md files when the destination is html.
|
||||
- Relative link is removed when the destination is latex.
|
||||
|
||||
The order of the conversions are:
|
||||
|
||||
|
@ -314,7 +316,7 @@ The order of the conversions are:
|
|||
4. @@@shell
|
||||
5. others
|
||||
|
||||
There is `src2md.rb` file in the top directory of this repository.
|
||||
There is the `src2md.rb` file in the top directory of this repository.
|
||||
It just invokes the method `src2md`.
|
||||
In the same way, the method is called in the action in the `Rakefile`.
|
||||
|
||||
|
@ -327,9 +329,9 @@ It is possible that these three directories don't exist before the conversion.
|
|||
|
||||
- src: This directory contains .src.md files and C-related source files.
|
||||
- image: This directory contains image files like png or jpg.
|
||||
- gfm: `rake` converts src.md files to GFM files and store them in this directory.
|
||||
- docs: `rake html` will convert src.md files to html files and store them in this directory.
|
||||
- latex: `rake pdf` will convert src.md files to latex files and store them in this directory.
|
||||
- gfm: `rake` converts .src.md files to GFM files and store them in this directory.
|
||||
- docs: `rake html` will convert .src.md files to html files and store them in this directory.
|
||||
- latex: `rake pdf` will convert .src.md files to latex files and store them in this directory.
|
||||
Finally it creates a pdf file in `latex` directory.
|
||||
- lib: This directory includes ruby library files.
|
||||
- test: This directory contains test files.
|
||||
|
@ -347,11 +349,11 @@ Rake carries out the conversion according to the `Rakefile`.
|
|||
|
||||
## The name of files in src directory
|
||||
|
||||
Each file in `src` directory is an abstract, sections of the whole document and other .src.md files.
|
||||
Files in `src` directory are an abstract, sections of the document and other .src.md files.
|
||||
An `abstract.src.md` contains the abstract of this tutorial.
|
||||
Each section filename is "sec", number of the section and ".src.md" suffix.
|
||||
For example, "sec1.src.md", "sec5.src.md" or "sec12.src.md".
|
||||
They are the files correspond to section 1, section 5 and section 12 respectively.
|
||||
They are the files correspond to the section 1, section 5 and section 12 respectively.
|
||||
|
||||
## C source file directory
|
||||
|
||||
|
@ -368,27 +370,28 @@ It is because of renumbering, which will be explained in the next subsection.
|
|||
|
||||
## Renumbering
|
||||
|
||||
Sometimes you might want to insert a section.
|
||||
Sometimes you might want to insert a new section.
|
||||
For example, you want to insert it between section 4 and section 5.
|
||||
You can make a temporary section 4.5, that is a rational number between 4 and 5.
|
||||
However, section numbers are usually integer so section 4.5 must be changed to section 5.
|
||||
And the numbers of the following sections must be increased by one.
|
||||
|
||||
This renumbering is done by a method `renum!` of the class `Sec_files`.
|
||||
The method and class is written in `lib/lib_sec_file.rb`.
|
||||
This renumbering is done by the `renumber` method in the `lib/lib_renumber.rb` file.
|
||||
|
||||
- It changes file names.
|
||||
- If there are references to sections in .src.md files, the section numbers will be automatically renumbered.
|
||||
- If there are references (links) to sections in .src.md files, the section numbers will be automatically renumbered.
|
||||
|
||||
## Rakefile
|
||||
|
||||
Rakefile is a similar file to Makefile but controlled by rake, which is a make-like program written in ruby.
|
||||
Rakefile is similar to Makefile but controlled by rake, which is a ruby script.
|
||||
Rakefile in this tutorial has the following tasks.
|
||||
|
||||
- md: generate GFM markdown files. This is the default.
|
||||
- html: generate html files.
|
||||
- pdf: generate latex files and a pdf file, which is compiled by lualatex.
|
||||
- all: generate md, html and pdf files.
|
||||
- clean: delete latex intermediate files.
|
||||
- clobber: delete all the generated files.
|
||||
|
||||
Rake does renumbering before the tasks above.
|
||||
|
||||
|
@ -410,8 +413,9 @@ For example,
|
|||
The size between left brace and right brace is used in latex file and it is not fit to GFM syntax.
|
||||
So the size will be removed in the conversion.
|
||||
|
||||
If a .src.md file has relative URL link, it will be changed by conversion.
|
||||
Because .src.md files are located under `src` directory and GFM files are located under `gfm` directory, base URL of GFM files is different from base URL of .src.md files.
|
||||
If a .src.md file has relative URL links, they will be changed by conversion.
|
||||
Because .src.md files are located under the `src` directory and GFM files are located under the `gfm` directory.
|
||||
That means the base directory of the relative link are different.
|
||||
For example, `[src/sample.c](sample.c)` is translated to `[src/sample.c](../src/sample.c)`.
|
||||
|
||||
If a link points another .src.md file, then the target filename will be changed to .md file.
|
||||
|
@ -460,7 +464,7 @@ Image files are copied to `docs/image` direcotiry and links to them will be conv
|
|||
Other relative links will be removed.
|
||||
|
||||
`index.html` is the top html file.
|
||||
If you want to clean html files, type `rake clobber`
|
||||
If you want to clean html files, type `rake clobber` or `cleanhtml`.
|
||||
|
||||
$ rake clobber
|
||||
|
||||
|
@ -505,8 +509,8 @@ You can customize `helper.tex` by modifying `lib/lib_gen_main_tex.rb`.
|
|||
|
||||
Finally, lualatex compiles the `main.tex` into a pdf file.
|
||||
|
||||
If you want to clean `latex` directory, type `rake cleanlatex`
|
||||
If you want to clean `latex` directory, type `rake clobber` or `rake cleanlatex`
|
||||
|
||||
$ rake cleanlatex
|
||||
$ rake clobber
|
||||
|
||||
This removes all the latex source files and a pdf file.
|
||||
|
|
12
src2md.rb
12
src2md.rb
|
@ -7,14 +7,16 @@ exec ruby -x "$0" "$@"
|
|||
require_relative 'lib/lib_src2md.rb'
|
||||
|
||||
def usage
|
||||
$stderr.print "Usage: ruby srcd2md.rb src.md_file md_file type\n"
|
||||
$stderr.print "Usage: ruby srcd2md.rb XXXX.src.md type\n"
|
||||
$stderr.print " XXXX.src.md is a .src.md file, which is like sec1.src.md.\n"
|
||||
$stderr.print " type is gfm (default), html or latex.\n"
|
||||
$stderr.print "src2md.rb converts XXXX.src.md into (gfm|docs|latex)/XXXX.md.\n"
|
||||
end
|
||||
|
||||
if ARGV.size == 2
|
||||
src2md ARGV[0], ARGV[1], "gfm"
|
||||
elsif ARGV.size == 3
|
||||
src2md ARGV[0], ARGV[1], ARGV[2]
|
||||
if ARGV.size == 1
|
||||
src2md ARGV[0], "gfm"
|
||||
elsif ARGV.size == 2
|
||||
src2md ARGV[0], ARGV[1]
|
||||
else
|
||||
usage
|
||||
exit 1
|
||||
|
|
Loading…
Reference in a new issue