- 字下げに意味がある記法は採用しない。(NoraMarkの基本的な方針)
==:
など
text =<<EOF | |
speak(Alice): Alice is speaking. | |
speak(Bob): and this is Bob. | |
EOF | |
document = NoraMark::Document.parse(text) | |
document.add_transformer(generator: :html) do | |
modify "speak" do | |
@node.name = 'p' | |
@node.prepend_child inline('span', @node.parameters[0], classes: ['speaker']) |
# Markdown-ish heading with explicit setion boundary | |
--- | |
lang: ja | |
title: test title | |
stylesheets: css/normalize.css, css/main.css | |
--- | |
=: this is the first heading |
start | |
= Document | |
Document | |
= EmptyLine* blocks:Block* { return blocks.join("\n"); } | |
Block | |
= b:(ExplicitBlock / ParagraphGroup) EmptyLine* | |
{ return b; } | |
ExplicitBlockHead |
start | |
= Document | |
Document | |
= l:TheLine LF d:Document { d.unshift(l); return d } | |
/ l:TheLine { return [l]; } | |
TheLine = DocumentLine / NotAllowedLine | |
NotAllowedLine = "not allowed" LF { return "not allowed but here."; } | |
DocumentLine |
--- | |
title: サンプル文書 | |
generator: htmlbook | |
--- | |
#(titlepage) サンプル文書 | |
by Satoshi Kojima | |
#(preface) 前書き |
rubyでメソッドの引数にデフォルト式を渡したとき、その引数が省略されたかどうか知る一番よい方法はなんだろう。
ふつうに
class TheClass
def the_method(a = nil)
if a.nil?
do_something
else
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>test</title> | |
<style type="text/css"> | |
body { | |
margin: 1em; | |
writing-mode: vertical-rl; | |
-webkit-writing-mode: vertical-rl; |
start = element ydml { Block* } | |
Block = Paragraph* & Center* & Left* & Right* & Quote* & Hasen* | |
Paragraph = Inline + | |
Inline = Large|Small|Bold|Image|Ruby|text | |
Center = element center { Inline+ } | |
Left = element left { Inline+ } | |
Right = element right { Inline+ } | |
Quote = element quote { Inline+ } | |
Hasen = element hasen { empty } |
require 'uri' | |
class DenshoConv | |
attr_accessor :file_prefix, :file_suffix, :title, :stylesheets, :count, :toc, :count_format, :replace_url, :outer_div_class | |
def init_default_filters | |
before_filter do | |
|text| | |
if @replace_url | |
URI.extract(text, ['http', 'https']).each { |url| |