SlideShare a Scribd company logo
1 of 35
Download to read offline
Pillarの紹介
Smalltalkで文書生成
2015/09/30 第80回Smalltalk勉強会
合同会社ソフトウメヤ 梅澤真史
Pillarとは??
● 文書生成ツール
○ https://github.com/pillar-markup
○ SphinxやRe:VIEWのSmalltalk版
● Wikiに似た記法のテキストから各種文書を生成できる
○ HTML
○ LaTeX
○ Markdown
○ Pillar
○ text
○ Beamer
○ deck.js
● Smalltalkがわかれば拡張も容易
Pillarの利用例
● PillarHub
○ http://pillarhub.pharocloud.com
■ Pillerで書かれた文書の置き場
○ オンラインエディタでプレビューしながら文書の作成が可能
● Book
○ Book Skeleton
■ https://github.com/pillar-markup/book-skeleton
○ 改訂版Pharo by ExampleやEnterprise Pharo などがPillarで
書かれている
● Ecstatic
○ 静的サイトジェネレータ
■ https://github.com/guillep/ecstatic
入手の仕方
● SmalltalkHubからロード
○ Pillar.imageとして保存
Gofer new smalltalkhubUser: 'Pier' project: 'Pillar';
configuration;
load.
(Smalltalk at: #ConfigurationOfPillar) load
● またはインストール済みイメージをCIサーバから
○ https://ci.inria.fr/pharo-
contribution/job/Pillar/PHARO=40,VERSION=stable,
VM=vm/lastSuccessfulBuild/artifact/Pillar.zip
● Pharo VMは別途取得
$ curl get.pharo.org/vm40 | bash
チュートリアル
● Enterprise PharoのPillarの章
○ HTML版
○ Pillar版
■ Pillarフォーマットの網羅的な例にもなっているので
オススメ
● Pillar Cheet Sheet
○ http://www.cheatography.
com/benjaminvanryseghem/cheat-
sheets/pillar/
○ Tableの箇所が一部間違っているので注意すること
Hello, world
● Pillarを実行
○ output.htmlが生成される
!Hello, world
!!こんにちは世界
$ ./pharo Pillar.image pillar export --
to=html first.pillar
● first.pillar というファイルを作成
メタ情報の記述
● 文章の先頭にJSON(STON)形式で記述
{
"title": "こんにちはPillar",
"author": "ume"
}
!Hello, world
!!こんにちは世界
● 共通の設定はpillar.confに記述
{
"level1":
{"numbering": true, "size": 1, "renderAs": "number"}
}
リスト
● -か#で指定
{
"title": "こんにちはPillar"
}
!Hello, world
!!こんにちは世界
-項目1
--項目2
--#項目3
-##項目4
テーブル
● 先頭|で指定
○ !が続くとヘッダ
○ { or } or !が続くと位置の指定 (右寄せ、左寄せ、中央寄せ)
{
"title": "こんにちはPillar"
}
!Hello, world
!!こんにちは世界
|!ヘッダ1 |!ヘッダ2 |!ヘッダ3
|{セル1 |}セル2 ||セル2
リンク
● *label>url* で通常リンク
● +caption>url+ で画像リンク
● @ でアンカー
{
"title": "こんにちはPillar"
}
@top
!Hello, world
!!こんにちは世界
*Pharo>http://pharo.org*
+Pharo image>http://pharo.org/web/files/pharo.png+
*top>@top*
コードブロック
● [[[と]]]で囲む
● language=xxx で言語を指定
● eval=true で実行結果を表示可能 (但しSmalltalkに限る)
{
"title": "こんにちはPillar"
}
[[[language=smalltalk|lineNumber=true
| sum |
sum := (1 to: 100) sum.
]]]
[[[eval=true
stream << ('sum = ', (1 to: 100) sum asString).
]]]
RAWブロック
● {{{と}}}で囲む
● 出力言語をそのまま埋め込むことができる
{
"title": "こんにちはPillar"
}
__以下HTML__
{{{
<hr>
<div>HTML文書そのまま</div>
}}}
その他、強調など
● "" (ダブルクォート2つ)で囲むとボールド
● '' (シングルクォート2つ)で囲むとイタリック
● __ で囲むとアンダーライン
● -- で囲むと打ち消し線
{
"title": "こんにちはPillar"
}
- ""ボールド""
- ''イタリック''
- __アンダーライン__
- --打ち消し--
エディタ用プラグイン
● Pillarのシンタックスハイライトなどをしてくれる
○ Emacs
○ Vim
○ TextMate
○ Atom
複数ファイルの扱い
● pillar.confに以下を指定
○ inputFileNames
○ outputDirectory
○ separateOutputFiles
{
"level1":
{"numbering": true, "size": 0, "renderAs": "number"},
"outputDirectory" : "result",
"inputFiles" : ["first.pillar","second.pillar"],
"separateOutputFiles" : true
}
$ ./pharo Pillar.image pillar export --to=html
テンプレートの使用
● pillar.confで出力フォーマットに応じたテンプレートを指定できる
● テンプレートはMustache形式
{
"level1": {"numbering": true, "size": 0, "renderAs":
"number"},
"configurations" : {
"html": {
"outputType" : #html,
"template" : "pillar-template.html"
}
}
}
HTMLテンプレート例
● Safariでも文字化けしないようにcharsetを指定
● addressタグ部分に値が入るように設定
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>{{{title}}}</title>
</head>
<body>
<div>{{{content}}}<div>
<address>{{address}}</address>
</body>
</html>
first.pillar では...
● メタ情報部分にaddressを入れておく
{
"title": "こんにちはPillar",
"address": "ume@softumeya.com"
}
!第1章
!!これこれ
あれあれ
Pillar の拡張
● PRDocumentWriterを継承して各種のwriter
が作られている
○ visitXXX: を実装していけば良い
(XXX部分はPillarのパースされた要素)
○ PRTextWriterやPRMarkdownWriterを
見るとなんとなくわかる
GitHub Flavored Markdownの拡張例
● PillarにPRGitHubMarkdownWriter
があるが...
○ コードブロックのサポートが弱い
(``` が使えない)ので追加してみる
○ 参考: GitHub Flavored Markdown
PRGitHubMarkdownWriterにメソッド追加
● コードブロック用のvisitメソッドはvisitScript:なのでオーバーライド
○ 引数はPRScriptオブジェクト、languageなどの情報が取れる
○ canvasを使って書いていく
PRGitHubMarkdownWriter >> visitScript: aScript
canvas newLine.
canvas raw: '```'.
aScript language isSpecified
ifTrue:[canvas raw: aScript language class standardName].
canvas newLine.
canvas raw: aScript text trimBoth.
canvas newLine.
canvas raw: '```'
markdown-test.pillar でテスト
● コードブロックのプロパティにlanguage=smalltalkを入れておく
[[[language=smalltalk
Transcript cr; show: 'hi'.
]]]
$ ./pharo Pillar.image pillar export --
to=githubmarkdown markdown-test.pillar
$ ./pharo Pillar.image pillar export --
to=markdown markdown-test.pillar
● markdownとgithubmarkdownで出力
まとめ
● Pillarを使うと、Wikiに似たマークアップを元に
様々なフォーマットの出力を行うことができる
● 本を書いたり、サイトを作成したり、プレゼンを作成したりする
際に役立つ
● VMとイメージさえ用意すればすぐに動くのでインストールも
楽
● PDF、EPUB、reveal.jsなどの出力も欲しいところ
● ライブラリの見通しが良いので、作ってみると良いかも

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Pillarの紹介