Class: Markbridge::AST::Quote
- Defined in:
- lib/markbridge/ast/quote.rb
Overview
Represents a quote/blockquote element.
The attribution fields follow Discourse's quote format
([quote="username, post:2, topic:456"]): post_number is the
position of the quoted post within its topic (not a database
id), topic_id is the topic's id. Sources that attribute quotes
by database id instead (phpBB, XenForo) use post_id and
user_id — those never feed a Discourse post: reference and
are carried for consumers to remap.
Instance Attribute Summary collapse
-
#author ⇒ String?
readonly
The author attribution (display name).
-
#post_id ⇒ Integer?
readonly
The quoted post's database id, for sources that attribute quotes by id (phpBB's
post_id, XenForo'spost:). -
#post_number ⇒ Integer?
readonly
The quoted post's number within its topic (Discourse semantics — not a post id).
-
#topic_id ⇒ Integer?
readonly
The topic id the quoted post belongs to.
-
#user_id ⇒ Integer?
readonly
The quoted user's id, for sources that attribute quotes by id (usernames may be unknown or stale).
-
#username ⇒ String?
readonly
The quoted user's username.
Attributes inherited from Element
Instance Method Summary collapse
-
#initialize(author: nil, post_number: nil, post_id: nil, topic_id: nil, username: nil, user_id: nil) ⇒ Quote
constructor
Create a new Quote element.
Methods inherited from Element
#<<, #descendants, #each_descendant, #replace_child
Constructor Details
#initialize(author: nil, post_number: nil, post_id: nil, topic_id: nil, username: nil, user_id: nil) ⇒ Quote
Create a new Quote element.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/markbridge/ast/quote.rb', line 58 def initialize( author: nil, post_number: nil, post_id: nil, topic_id: nil, username: nil, user_id: nil ) super() @author = @post_number = post_number @post_id = post_id @topic_id = topic_id @username = username @user_id = user_id end |
Instance Attribute Details
#author ⇒ String? (readonly)
Returns the author attribution (display name).
28 29 30 |
# File 'lib/markbridge/ast/quote.rb', line 28 def @author end |
#post_id ⇒ Integer? (readonly)
Returns the quoted post's database id, for sources
that attribute quotes by id (phpBB's post_id, XenForo's
post:). Distinct from #post_number; parsers map whichever
their dialect provides.
38 39 40 |
# File 'lib/markbridge/ast/quote.rb', line 38 def post_id @post_id end |
#post_number ⇒ Integer? (readonly)
Returns the quoted post's number within its topic (Discourse semantics — not a post id).
32 33 34 |
# File 'lib/markbridge/ast/quote.rb', line 32 def post_number @post_number end |
#topic_id ⇒ Integer? (readonly)
Returns the topic id the quoted post belongs to.
41 42 43 |
# File 'lib/markbridge/ast/quote.rb', line 41 def topic_id @topic_id end |
#user_id ⇒ Integer? (readonly)
Returns the quoted user's id, for sources that attribute quotes by id (usernames may be unknown or stale).
48 49 50 |
# File 'lib/markbridge/ast/quote.rb', line 48 def user_id @user_id end |
#username ⇒ String? (readonly)
Returns the quoted user's username.
44 45 46 |
# File 'lib/markbridge/ast/quote.rb', line 44 def username @username end |